Adding Liquidity
Add liquidity to an existing HBAR/token liquidity pool.
Outlined below are two methods to add liquidity to an existing pool on SaucerSwap:
Contract ID: SaucerSwapV1RouterV3
To create a new liquidity pool, see Creating a new liquidity pool.
Ensure that the client has the LP token associated before adding liquidity.
A spender allowance for the Router contract is required for HTS tokens.
Both addLiquidityETH and addLiquidity support HTS tokens containing custom fees.
Adding HBAR/Token Liquidity
Add more liquidity to an existing HBAR/token liquidity pool.
Function name: addLiquidityETH
⛽ Recommended gas: 240,000 gwei (~ $0.020 USD)
Parameter Name | Description |
---|---|
address token | EVM address of the token to pool 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 |
address to | EVM address to receive the liquidity tokens |
uint deadline | Deadline in Unix seconds |
The addLiquidityETH 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
Adding Token/Token Liquidity
Add more liquidity to an existing token/token liquidity pool.
Function name: addLiquidity
⛽ Recommended gas: 240,000 gwei (~ $0.020 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 liquidity tokens |
uint deadline | Deadline in Unix seconds |
Code Overview
Last updated