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 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.
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 the deposited token.
{
"withdraw": {
"sid": 0,
"asset": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "10000000"
}
}
}
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
}
}
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
}
}
{
"address": "terra...",
"total_deposit": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "1000000"
},
"round_period": 604800,
"end_round_time": 1600000000,
"round": 1
}
Get a number of registered strategies.
{
"strategy_number": {}
}
{
"n": 1
}
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"
}
}
{
"asset": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "3000"
}
}
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"
}
}
{
"asset": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "3000"
}
}
Get the user's deposited token amount.
{
"deposit_info": {
"sid": 0,
"address": "terra..."
}
}
{
"asset": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "1000"
}
}
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
}
}
{
"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
}
]
}
Get current round.
{
"round": {
"sid": 0,
}
}
{
"round": 1
}
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.
Get AssetInfo of the strategy. AssetInfo determines the token that the strategy accepts.
{
"asset_info": {}
}
{
"asset_info": {
"native_token": {
"denom": "uusd"
}
}
}
Get strategy id that registered to INK Core.
{
"strategy": {}
}
{
"sid": 0
}
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"
}
}
}
{
"asset": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "1000"
}
}
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"
}
}
}
{
"asset": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "1000"
}
}
Get the amount of total UST that this contract holds in the aUST form.
{
"total_asset": {
"block": 1000000
}
}
{
"asset": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "1000"
}
}
Last modified 1yr ago