Create an AMM Pool
General instructions on creating an AMM pool for use on the JunoSwap.com UI
Last updated
General instructions on creating an AMM pool for use on the JunoSwap.com UI
Last updated
JunoSwap AMM pools are created by interacting with the JunoSwap smart contract. These instructions will outline the arguments for your command and the procedure to successfully create your AMM pool on the JunoSwap smart contract.
An AMM pool can be created with any combination of native token, IBC coins and CW20 token. Developing CW20 token is outside the scope of this documentation. Refer to information here to get started.
To create a new AMM pool, you will need to have the correct denom
designations for your coins. In this example, we will be using native JUNO and IBC SCRT. The denom
for these coins are:
Symbol | Denom |
---|---|
You can find the denom
of a token by querying your wallet address:
If you're creating an AMM pool with a CW20 token, the denom
message is the contract address, as such:
Symbol | Denom |
---|---|
The procedure to create a new AMM pool is to:
The wasm contract Code ID
of the Junoswap contract is 16
. More information on wasm contracts here. Each pool needs a unique label conforming to the standard <token1> <token2> Pool
, where <token1>
and <token2>
are the two tokens in the pool.
To create an empty pool with native tokens we need to instantiate the wasm contract with our pool data. Using our denom
's identified earlier:
⚠️Attention, if your token2_denom
is a token of type CW20, you must replace native
by cw20
.
In this command, juno1pv88fxyhvyv2edwed72leupsuympnwvmsny4jtzspv9zw2dcrhkseh58kn
is the Raw Dao address which needs to be given admin rights to manage pool upgrades from the Dao.
Replace <wallet-name> with the name of your wallet in your local keystore.
If you query the <transaction-hash>
resultant from the instantiate transaction:
<transaction-hash>
will look similar to CA8A5EC4FB69B3DA95411212C9FDB9CF2A4D2128F6D3A15CFBA56136D760E023
You should have a result similar to:
If this is not successful, it is also possible to use https://dev.mintscan.io/juno/txs/6BAB0399B7A854E5CF03DEB940F87DF35B18C613ACF0AE92C9889B283B414ADE, where the transaction hash is replaced with your transaction hash. Click from parsing data to raw data, and obtain the data from there.
From this stdout you can extract the Junoswap contract address and the liquidity pool contract address. In this situaton, the data would be:
If you're one or more of the tokens in the pool is a CW20 token, you will need to approve the Junoswap contract address to spend your tokens first. Use the following command:
In ths command, juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr
is the token contract address, and juno1zz8vspvcq7a3t40sy6xfxa3yk8wuy3vr8clyn3pt8pthpucnvpyqes54md
is the Junoswap contract address.
To add liquidity, you must first make sure you have funded your wallet with enough tokens to deposit into the AMM pool. In this example, you will be adding 250ujuno
and 1000uscrt
. Please note that you must use the correct denom
for the tokens on chain.
Use the following command to send the add_liquidity
message to our junoswap contract:
Note that we have used the IBC denom
for uscrt
when sending the argument for the --amount
flag.
Check the resultant transaction hash to ensure the transaction was successful:
Now that we have created and funded the AMM pool, we can add it to the JunoSwap user interface.
JUNO
ujuno
SCRT
ibc/CD78EE5B20682E5A61B4D96C9F4DC39361269B88A6B3462C26A18652F7A90A9A
JUNO
ujuno
NETA
juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr
Junoswap
contract address
juno1zz8vspvcq7a3t40sy6xfxa3yk8wuy3vr8clyn3pt8pthpucnvpyqes54md
liquidity pool
contract address
juno1quce89l8clsn8s5tmq5sylg370h58xfnkwadx72crjv90jmetp4s3fkysl