Liquidswap Docs
GithubDappPontem Network
Liquidswap V0 Docs
Liquidswap V0 Docs
  • Introduction
    • Security Audits
    • Bounty Program
    • Developer Links
  • Protocol Overview
  • Smart Contracts
    • Generics
    • LP Coins
    • Routers
    • Scripts
    • Advanced Topics
    • 💥V0.5 Update
  • Integration
    • Test Coins
    • Let's Swap
    • Create Pool
    • Add Liquidity
    • Burn Liquidity
    • Basic Oracle
    • Flashloans
    • Unit Testing
  • Staking / Harvest
    • Overview
    • Smart Contracts
    • Integration Examples
    • DApp
    • Create your own farming pool
  • SDKs
  • Liquidswap Widget
  • Liquidswap DApp
    • Bridge
    • Testnet
  • Coins Registry
Powered by GitBook
On this page
  • Add liquidity to your pool
  • Adding liquidity to an existing pool
  1. Integration

Create Pool

PreviousLet's SwapNextBurn Liquidity

Last updated 2 years ago

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.

Creating a stable pool

In the same way, you can create a stable pool by use Stable generic:

Add liquidity to your pool

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.

Adding liquidity to an existing pool

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.

Create a new pool
Test coin for new pool
Create stable pool
Adding liquidity to our new pool
Adding liquidity to an existing pool