Create a New Pool
Create a new HBAR/token or token/token liquidity pool.
There are two methods to add a new liquidity pool:
Contract ID: SaucerSwapV1RouterV3
See Pool creation fee to get the current pool creation fee.
Ensure that the liquidity pool does not exist on-chain prior to creation of the new pool. See Check for an existing pool.
Increase the clientโs max token auto-association by one to receive the incoming LP token.
To add liquidity to an existing pool, see Adding liquidity.
Both methods supports HTS tokens with custom fees.
Creating a New HBAR/Token Liquidity Pool
Create a new HBAR/token liquidity pool and provide it with initial liquidity.
Function name: addLiquidityETHNewPool
โฝ Recommended gas: 3,200,000 gwei (~ $0.27 USD)
Parameter Name | Description |
---|---|
address token | EVM address of the token to pair with HBAR |
uint amountTokenDesired | The maximum token amount in its smallest unit |
uint amountTokenMin | The minimum token amount in its smallest unit |
uint amountETHMin | The minimum HBAR amount in its smallest unit (tinybar) |
address to | EVM address to receive the new liquidity tokens |
uint deadline | Deadline in Unix seconds |
A spender allowance for the router is required for the HTS token.
The addLiquidityETHNewPool function operates in HBAR but derives its name from Uniswap on Ethereum. This name was kept to simplify integration for developers versed in Uniswap tools.
Code Overview
Creating a New Token/Token Liquidity Pool
Create a new token/token liquidity pool and provide it with initial liquidity.
Function name: addLiquidityNewPool
โฝRecommended gas: 3,200,000 gwei (~ $0.27 USD)
Parameter Name | Description |
---|---|
address tokenA | EVM address of the first HTS token |
address tokenB | EVM address of the second HTS token |
uint amountADesired | The maximum amount for the first token in its smallest unit |
uint amountBDesired | The maximum amount for the second token in its smallest unit |
uint amountAMin | The minimum amount for the first token in its smallest unit |
uint amountBMin | The minimum amount for the second token in its smallest unit |
address to | EVM address to receive the new liquidity tokens |
uint deadline | Deadline in Unix seconds |
A spender allowance for the router is required for both HTS tokens.