Contract ID: SaucerSwapV2SwapRouter
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: exactInputCode Overview
- JavaScript SDK
Resources:
- SaucerSwap deployed contract IDs
- Ethers.js docs (v6)
- Hedera JavaScript SDK
- Token approve allowance
- Associate tokens to an account
Typescript
Swap Tokens for Exact Tokens
Swap a maximum amount of tokens to receive an exact tokens amount Solidity function name: exactOutputCode Overview
- JavaScript SDK
Resources:
- SaucerSwap deployed contract IDs
- Ethers.js docs (v6)
- Hedera JavaScript SDK
- Token approve allowance
- Associate tokens to an account
Typescript