Create Pool
Creating a stable pool
Add liquidity to your pool
Adding liquidity to an existing pool
Last updated
Now let's create a new pool utilizing Router. First of all, deploy your new own coin just for test:
Extend the example from the previous guide and add a new function:
The function above creates a new pool for your coin: MyCoin/AptosCoin. As Uncorrelated generic provided, the formula for the pool would be standard one: x*y=k.
It's very important to follow the rule about generic sorting as otherwise, the function would abort.
In the same way, you can create a stable pool by use Stable generic:
Let's add liquidity to new pool:
As you can see above, add_liquidity allows to add liquidity to the newly created pool and then deposit the remainders of both X and Y coins back in the account, together with the new LP coins.
Similarly, you can add liquidity to any other pool: replace MyCoin and AptosCoin with other coins.
When working with real-world examples, it's better to deposit liquidity immediately during the same transaction with which you create a pool. We also recommend using slippage values for the amount of the LP tokens you'll get in exchange for your liquidity.
Let's say we want to add liquidity to an existing BTC/Aptos pool created by the Pontem team:
When working with real-world examples, it's better to deposit liquidity immediately during the same transaction with which you create a pool. We also recommend using slippage values for the amount of the LP tokens you'll get in exchange for your liquidity.
Last updated