Fees explanation
Network gas for different kinds of swaps (for current Uniswap-like DEXes) takes around:
| Token pair | Gas for SaucerSwap/Pangolin | Gas for HSuite |
|---|---|---|
| ERC20 -> ERC20 swap | 910,000 Gas | N/A |
| HBAR -> ERC20 swap | 260,000 Gas | N/A |
| ERC20 -> HBAR swap | 16,800,000 Gas | N/A |
The third option (ERC20 -> HBAR) consumes more gas than others, because of the high cost of the WHBAR burning operation (inside exchange). Additionally 1 and 3 operations require Approval transaction, which costs ~0.05 USD.
HSuite doesn't work at the smart-contract level; it utilizes Hedera Token Service (HTS) and doesn't need an approval transaction either.
Approx USD cost of swaps on the table below:
| Token pair | Fee for SaucerSwap V1 | Fee for Pangolin | Fee for HSuite |
|---|---|---|---|
| ERC20 -> ERC20 swap | ~0.0746 USD | ~0.0746 USD | ~0.0016 USD |
| HBAR -> ERC20 swap | ~0.0213 USD | ~0.0213 USD | ~0.0016 USD |
| ERC20 -> HBAR swap | ~0.1378 USD | ~0.1378 USD | ~0.0016 USD |
Amount of fee charged by EtaFinance Swap can be different for each adapter, it's possible to change/adjust the fee for a particular adapter. Current fees:
| Exchange | Fee by EtaFinance Swap |
|---|---|
| SaucerSwap | 0.3% |
| Pangolin | 0.3% |
| HSuite | 0.3% |
Network fee always charged in HBAR, so make sure you have enough HBAR coins to pay network fee before swap operation.
EtaFinance Swap fee charged in source tokens (note: for HSuite, EtaFinance Swap fee charged in HBAR).
Unused slippage always returns to user.
Example 1:
You have 100 tokenA and you want to exchange it by max possible amount of tokenB. For example lowest rate you found by EtaFinance Swap - it's SaucerSwap with rate 3 (1 tokenA costs 3 tokensB). So you initiate swap with default slippage 2.5%.
- You sign Approval transaction for 100 tokenA (spending 0.05 USD)
- You sign swap transaction ERC20 -> ERC20 (spending 0.07 USD)
- EtaFinance Swap charges a fee for the SaucerSwap operation, 0.3% deducted from your 100 tokenA, so you proceed with the swap using 99.7 tokenA.
- You expect to receive 99.7 * 3 = 299.1 tokenB. By slippage rate 2,5% expected minimum income will be 291.6225. If exchange can satisfy this amount - transaction is successful and you receive from 291.6225 up to 306.5775 tokenB.
In total your spendings: 0.12 USD + 100 tokenA, your income 291.6225 - 306.5775 tokenB.
Example 2:
You have some amount of HBAR and you want to buy exactly 200 tokenC. For example, the lowest rate you found on EtaFinance Swap is Pangolin with rate 5 (1 HBAR costs 5 tokensC). So you initiate a swap with default slippage 2.5%.
- You don't need to sign Approval transaction, since you are spending root token.
- You sign swap transaction HBAR -> ERC20 (spending 0.02 USD). Amount of allowed to spend HBARs will be calculated like: reverse rate _ amount to receive + slippage + EtaFinance Swap fee. Reverse rate will be: 1 / 5 = 0.2. So amount, that smart contract allowed to spend: 0.2 _ 200 + 0.2 _ 200 _ 0.025 + 0.2 _ 200 _ 0.003 = 41.12 HBAR.
- If exchange can satisfy this amount - transaction is successful and you receive exactly 200 tokenC.
- You receive change (unused HBAR tokens), calculated by: 41.12 HBAR (sent to smart-contract) - 39-41 HBAR (amount spent by exchange to get 200 tokenC) - 0.12 HBAR (EtaFinance Swap fee) = 0 - 2 HBAR.
In total your spendings: 39.12 - 41.12 HBAR, your income 200 tokenC.