-
Notifications
You must be signed in to change notification settings - Fork 0
Fee System
In the BTP system, a user pays for all message deliveries in the source chain COIN. The following table shows, how it's calculated.
Name | Actual Fee | Fee on ICON |
---|---|---|
ICON to ETH | 706,938 Gwei | 706938 / (10**9) * 1880 / 0.23 = 5.778449739130435 ICX |
ETH to ICON | 0.01 ICX | 0.01 ICX |
(Assuming that ICX is 0.23 USD and ETH is 1880 USD)
So, if it sends a one-way message from ICON to ETH, it should pay for 5.78 ICX. If it sends a two-way message for ICON to ETH, it should pay for 5.79 ICX.
The same thing happens on routed messages.
We are using the following exchange rate for this BTP Test Net.
Network | COIN | Price(USD) |
---|---|---|
Ethereum2(Sepolia) | ETH | 1880.00 |
ICON(Berlin) | ICX | 0.26 |
BSC(Test) | BNB | 322.00 |
HAVAH(BTP Test) | HVH | 0.26 |
We referred actual price table of the market, but some of them were adjusted for easy usage.
And calculated fee for a message for each connection is following (We assume that 100 messages are delivered in a day)
Connection | Fee in USD | Fee in ETH(wei) |
---|---|---|
ICON -> ETH2(IE) | 1.329043 | 706937800000000 |
ETH2 -> ICON(EI) | 0.056664 | 30140466117021 |
BSC -> ICON(BI) | 0.010569 | 5621579869681 |
ICON -> BSC(IB) | 2.276340 | 1210818997872340 |
HAVAH -> ICON(HI) | 0.005054 | 2688242686170 |
ICON -> HAVAH(IH) | 0.005054 | 2688242686170 |
Fee for deliveries is calculated with the price and amount of transaction fees by the relays. The estimation logic could be changed at any time.
The example ETH fee table with the calculated values
Destination | List of Fee | Calculated |
---|---|---|
ICON | [ EI, IE ] | [ 30140466117021, 706937800000000 ] |
BSC | [ EI, IB, BI, IE ] | [ 30140466117021, 1210818997872340, 5621579869681, 706937800000000 ] |
HAVAH | [ EI, IH, HI, IE ] | [ 30140466117021, 2688242686170, 2688242686170, 706937800000000 ] |
With this fee table, Fee for a one-way message to BSC from ETH is 30140466117021
+ 1210818997872340
⇒ 1240959463989361
wei(ETH).
A similar algorithm can be applied for each chain.
When we send a transaction, we also set the amount of the fee to be paid for executing the transaction. But BTP Fee is not collected through a standard fee aggregation system because it's not a part of the system framework, but a part of DApp. So it doesn't follow the rule of the normal transaction fee system.
It uses getFee()
API to get an amount of fee to be paid while it sends a message.
While it sends a message, it should provide the fee as value
(transferring coin) along with a fee for executing the transaction.
Even if you set a system fee limit high enough to pay BTP Fee ( setting a high gas_limit or step_limit ), it can't collect them.
So, if you see "Not Enough Fee" in the user exception(revert), you should set the proper transfer amount according to the value from getFee()
method.
getFee()
returns the amount of the fee for delivering a one-way or two-way message in its own local coin unit.
So, if it returns 1240959463989361
in the Ethereum environment, it means 0.001240959463989361 ETH
.