Swap
1. ERC20 --> ERC20
poolRouter.exactInputSingle({
tokenIn: tokenInAddress, // input token address
amountIn: BigNumber.from(amountIn), // amount of input token to swap
amountOutMinimum: BigNumber.from(amountOutMinimum), // slippage
pool: PoolAddress, // pool address
to: recipient, // recipient address
unwrap: false // always "false" for erc20 tokens
});2. ERC20 --> KLAY
poolRouter.exactInputSingle({
tokenIn: tokenInAddress, // input token address
amountIn: BigNumber.from(amountIn), // amount of input token to swap
amountOutMinimum: BigNumber.from(amountOutMinimum), // slippage
pool: PoolAddress, // pool address
to: recipient, // recipient address
unwrap: true // always "false" for erc20 tokens
});3. KLAY --> ERC20
Last updated