Create Your Own Pair

Instantiation by Contract Address

You can use the Terraswap token factory contract.

  • The address on Terra 2.0: terra1466nf3zuxpya8q9emxukd7vftaf6h4psr0a07srl5zw74zh84yjqxl5qul
  • The address on Terra Classic: terra1jkndu9w5attpz09ut02sgey5dd3e8sq5watzm0

The JSON message format is as follows:

{
  "create_pair": {
    "assets": [
      {
        "info": {
          "token": {
            "contract_addr": "terra..."
          }
        },
        "amount": "0"
      },
      {
        "info": {
          "native_token": {
            "denom": "uluna"
          }
        },
        "amount": "0"
      }
    ]
  }
}

This is a JSON constructor of pair contract. Tokens of pair can be either CW20 tokens or Terra(Classic) native tokens(including IBC tokens). Use JSON keys with their corresponding values as described below.

  • assets[x].info.token.contract_addr: CW20 token address
  • assets[x].info.native_token.denom: Terra(Classic) native token(including IBC token) denominator

Then, you may execute the contract with the organized JSON above.

Provide initial liquidity

Terraswap pair contract derives the swap rate from the amount of the remained assets on the pool. However, if you have just created your own pair and haven’t provided its liquidity yet, the contract won’t be able to calculate the rate, and all swap simulations and transactions will fail. So, for the pair to work successfully, you should provide the initial liquidity.