Pair

Transaction

Provide liquidity

Send user's assets to SecretSwap contract and provide liquidity.

Assets can be both SNIP20 and native tokens. It can be distinguished with the key under info.token or info.native_token.

{
  "provide_liquidity": {
    "assets": [
      {
        "info": {
          "token": {
            "contract_addr": "<HumanAddr>",
            "token_code_hash": "<HASH>",
            "viewing_key": "" // empty
          }
        },
        "amount": "10"
      },
      {
        "info": {
          "native_token": {
            "denom": "uscrt"
          }
        },
        "amount": "10"
      }
    ],
    "slippage_tolerance": 0.1 // optinonal
  }
}

For SNIP20 assets, you first have to set an allowance for the pair to spend the token.

For SCRT, you have to send the SCRT amount to the provide_liquidity contract call.

Swap

Swap between the given two tokens. offer_asset is your source asset and to is your destination token contract.

{
  "swap": {
    "offer_asset": {
      "info": {
        "native_token": {
          "denom": "uluna"
        }
      },
      "amount": "10"
    },
    "expected_return": "13", // optional
    "belief_price": 0.1, // optional
    "max_spread": 0.1, // optional
    "to": "<HumanAddr>" // optional
  }
}
{
  "swap": {
    "offer_asset": {
      "info": {
        "token": {
          "contract_addr": "<HumanAddr>",
          "token_code_hash": "<HASH>",
          "viewing_key": "" // empty
        }
      },
      "amount": "10"
    },
    "expected_return": "13", // optional
    "belief_price": 0.1, // optional
    "max_spread": 0.1, // optional
    "to": "<HumanAddr>" // optional
  }
}

Query

Pool

{
  "pool": {}
}

Simulation

{
  "simulation": {
    "offer_asset": {
      "info": {
        "token": {
          "contract_addr": "<HumanAddr>",
          "token_code_hash": "<HASH>",
          "viewing_key": "" // empty
        }
      },
      "amount": "10"
    }
  }
}

Reverse Simulation

{
  "reverse_simulation": {
    "ask_asset": {
      "info": {
        "token": {
          "contract_addr": "<HumanAddr>",
          "token_code_hash": "<HASH>",
          "viewing_key": "" // empty
        }
      },
      "amount": "10"
    }
  }
}

Last updated