INK Protocol
Search…
Smart Contract Calls
Common queries to interact with INK Protocol smart contracts.
Use the following query examples to interact with INK Protocol contracts as listed in Contract Addresses & Parameters.
THIS PROJECT IS IN BETA VERSION. Smart contract has been audited by Oak.

INK Core

INK Core is the main contract that interacts with users. This contract stores the deposit amount of every player, and also contain the logic to random winners.

Handle Message

Deposit

Deposit native token to the input strategy. The input sent_asset determines the amount of token sent to this contract. The input tax determines the amount of token to reserve from sent_asset to pay to Terra. If the tax is not enough, the transaction will be reverted.
Total deposit amount = sent asset amount - tax amount
{
"deposit": {
"sid": 0,
"sent_asset": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "10000000"
},
"tax": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "1000"
}
}
}

Withdraw

Withdraw the deposited token.
{
"withdraw": {
"sid": 0,
"asset": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "10000000"
}
}
}

ClaimAward

Claim award for the winner address. The input index is the index of the winner that stored in the winners array. (See query winners response)
{
"claim_award": {
"sid": 0,
"round": 1,
"index": 0
}
}

Query Message

Strategy

Get strategy information. The input sid is the strategy id that registered on the INK Core when the deployer executes add_strategy
{
"strategy": {
"sid": 0
}
}

StrategyResponse

{
"address": "terra...",
"total_deposit": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "1000000"
},
"round_period": 604800,
"end_round_time": 1600000000,
"round": 1
}

StrategyNumber

Get a number of registered strategies.
{
"strategy_number": {}
}

StrategyNumberResponse

{
"n": 1
}

DepositTax

Get the amount of tax that this contract has to pay to Terra blockchain in order to deposit token to the strategy. The input asset amount is the amount of token that the user send to the contract when the user executes deposit
{
"sid": 0,
"asset": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "1000000"
}
}

DepositTaxResponse

{
"asset": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "3000"
}
}

WithdrawTax

Get the amount of tax that this contract has to pay to Terra blockchain in order to withdraw token from the strategy. The input asset amount is the amount of token that the user wants to withdraw.
{
"sid": 0,
"asset": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "1000000"
}
}

WithdrawTaxResponse

{
"asset": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "3000"
}
}

DepositInfo

Get the user's deposited token amount.
{
"deposit_info": {
"sid": 0,
"address": "terra..."
}
}

DepositInfoResponse

{
"asset": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "1000"
}
}

Winners

Get the winners of the input strategy and round. the snapshot data is used to calculate the probability to win the prize at the drawing time.
{
"winners": {
"sid": 0,
"round": 1
}
}

WinnersResponse

{
"total_deposit_snapshot": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "100000000"
},
"total_blacklist_snapshot": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "20000000"
},
"winners": [
{
"award": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "10000000"
},
"address": "terra...",
"deposit_snapshot": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "5000000"
},
"is_claimed": false
}
]
}

Round

Get current round.
{
"round": {
"sid": 0,
}
}

RoundResponse

{
"round": 1
}

INK Anchor strategy

INK Anchor strategy is the contract that contains the logic to deposit and withdraw token from Anchor protocol. This contract does not interact with users directly. INK Core will interact with this contract when the user deposit, withdraw and claim the prize.

Query Message

AssetInfo

Get AssetInfo of the strategy. AssetInfo determines the token that the strategy accepts.
{
"asset_info": {}
}

AssetInfoResponse

{
"asset_info": {
"native_token": {
"denom": "uusd"
}
}
}

Strategy

Get strategy id that registered to INK Core.
{
"strategy": {}
}

StrategyResponse

{
"sid": 0
}

ExecuteTax

Get the amount of tax that this contract has to pay to Terra blockchain in order to deposit token to Anchor protocol.
{
"execute_tax": {
"asset": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "1000000"
}
}
}

ExecuteTaxResponse

{
"asset": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "1000"
}
}

ClaimTax

Get the amount of tax that this contract has to pay to Terra blockchain in order to claim token from Anchor protocol.
{
"claim_tax": {
"asset": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "1000000"
}
}
}

ClaimTaxResponse

{
"asset": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "1000"
}
}

TotalAsset

Get the amount of total UST that this contract holds in the aUST form.
{
"total_asset": {
"block": 1000000
}
}

TotalAssetResponse

{
"asset": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "1000"
}
}
Copy link
Outline
INK Core
Handle Message
Query Message
INK Anchor strategy
Query Message