- Swap exact tokens for tokens
- Swap tokens for exact tokens
- Swap exact tokens for tokens supporting custom fees
Contract ID: SaucerSwapV1RouterV3
Consider the token’s decimal places when determining input and output values.Input and output amounts passed to the solidity function should all be in the token’s smallest unit. For the SAUCE token, which has 6 decimal places, an input of 123.45 SAUCE should be entered as 123450000 (123.45 multiplied by 10^6).
Granting an spender allowance to the router contract is required when the input token is not native HBAR for security reasons enforced at the native code layer . Ensure that the allowance amount is in token’s smallest unit.
Swap Exact Tokens for Tokens
Swap an exact amount of tokens for a minimum token amount. Solidity function name: swapExactTokensForTokens| Parameter Name | Description |
|---|---|
| uint amountIn | The exact input token amount in its smallest unit |
| uint amountOutMin | The minimum token amount to receive in its smallest unit |
| address[] calldata path | An ordered list of token EVM addresses |
| address to | EVM address for the token recipient |
| uint deadline | Deadline in unix seconds |
Code Overview
- JavaScript SDK
Swap Tokens for Exact Tokens
Swap a maximum amount of tokens to receive an exact tokens amount. Solidity function name: swapTokensForExactTokens| Parameter name | Description |
|---|---|
| uint amountOut | The exact output amount to receive in its smallest unit |
| uint amountInMax | The maximum allowed input amount in its smallest unit |
| address[] calldata path | An ordered list of token EVM addresses |
| address to | EVM address for the token recipient |
| uint deadline | Deadline in unix seconds |
Code Overview
- JavaScript SDK
Swap Exact Tokens for Tokens Supporting Custom Fees
Swap an exact amount of tokens for a minimum HBAR amount, supporting HTS tokens with custom fees on token transfer. Solidity function name: swapExactTokensForTokensSupportingFeeOnTransferTokens| Parameter Name | Description |
|---|---|
| uint amountIn | The input token amount in its smallest unit |
| uint amountOutMin | The minimum token amount to receive in its smallest unit |
| address[] calldata path | An ordered list of token EVM addresses |
| address to | EVM address for the token recipient |
| uint deadline | Deadline in unix seconds |
Code Overview
- JavaScript SDK