Pair
Transaction
Provide Liquidity
Send user’s asset to a Terraswap contract in order to provide liquidity.
NOTE: You should allow your allowance of the token before providing liquidity!
The asset can be both a contract-based token and a native token. It can be distinguished by the key under info
: token
or native_token
.
{
"provide_liquidity": {
"assets": [
{
"info" : {
"token": {
"contract_addr": "<Addr>"
}
},
"amount": "10"
},
{
"info" : {
"native_token": {
"denom": "uluna"
}
},
"amount": "10"
}
],
"slippage_tolerance": 0.1 // optional
}
}
Swap
Swap between the given two tokens. It can be considered as trade.offer_asset
is your source asset and to
is a destination address to receive, which is optional.Binary()
means that this JSON message should be encoded into Base64.
{
"swap": {
"offer_asset": {
"info" : {
"native_token": {
"denom": "uluna"
}
},
"amount": "10"
},
"belief_price": 0.1, // optional
"max_spread": 0.1, // optional
"to": "<Addr>", // optional
}
}
{
"send": {
"contract": "<Addr>",
"amount": "10",
"msg": Base64({
"swap": {
"offer_asset": {
"info" : {
"token": {
"contract_addr": "<Addr>"
}
},
"amount": "10"
},
"belief_price": 0.1, // optional
"max_spread": 0.1, // optional
"to": "<Addr>", // optional
}
})
}
}
{
}
Query
Pool
{
"pool": {}
}
Simulation
{
"simulation": {
"offer_asset": {
"info" : {
"token": {
"contract_addr": "<Addr>"
}
},
"amount": "10"
}
}
}
Reverse Simulation
{
"reverse_simulation": {
"ask_asset": {
"info" : {
"token": {
"contract_addr": "<Addr>"
}
},
"amount": "10"
}
}
}