- Swap exact HBAR for tokens
- Swap HBAR for exact tokens
- Swap exact HBAR for tokens supporting custom fees
Contract ID: SaucerSwapV1RouterV3
The swapExactETHForTokens and swapETHForExactTokens function trades in HBAR but derives its name from Uniswap on Ethereum. This name was kept to simplify integration for developers versed in Uniswap tools.
Consider the token’s decimal places when determining the output amount.The output values should 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).
Swap Exact HBAR for Tokens
Swap an exact amount of HBAR for a minimum token amount. Solidity function name: swapExactETHForTokens| Parameter name | Description |
|---|---|
| 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 HBAR for Exact Tokens
Swap a maximum amount of HBAR to receive an exact tokens amount Solidity function name: swapETHForExactTokens| Parameter Name | Description |
|---|---|
| uint amountOut | The exact output 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
Typescript
Swap Exact HBAR for Tokens Supporting Custom Fees
Swap an exact amount of HBAR for a minimum token amount, supporting HTS tokens with custom fees on token transfer. Solidity function name: swapExactETHForTokensSupportingFeeOnTransferTokens| Parameter name | Description |
|---|---|
| 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