Purpose
This article explains how bridge fees are calculated when bridging from GalaChain to other blockchains, such as Ethereum.
Assumptions Made
This article assumes the reader understands the information in the following articles:
Sign Up For a Gala Games and Entertainment Account
What is the Gala Games and Entertainment Ecosystem
What is "Gas" and How Does it Work?
What are Non-Fungible-Tokens (NFTs)?
Summary
When bridging to another blockchain, a fee is required to move from GalaChain to another blockchain and vice versa. This fee can differ based on what kind of token is being bridged. Fungible tokens like $GALA typically have a cheaper bridge fee than non-fungible tokens such as a Cranebot in Common Ground World. When bridging from another blockchain to GalaChain, there's a standard bridging fee set by their particular blockchain. When bridging from a blockchain such as Ethereum, the bridging fee is paid in Ethereum. When bridging from GalaChain to another blockchain, there's a specific formula that is used to determine a Base Bridge Fee. This bridge from GalaChain to another blockchain is typically paid in $GALA.
Base Bridge Fee
(Ethereum Bridge Fee x Price Multiplier) = Base Bridge Fee
Ethereum Bridge Fee - This fee is calculated using this formula:
Ethereum Bridge Fee = averageHistoricGas * ethereumGasPrice * ethPriceUSD
averageHistoricGas = The average last 10 gas values for bridging.
ethereumGasPrice = The current gas price on the Ethereum Network
ethPriceUSD = The current USD value of Ethereum
Note: The value of averageHistoricGas is different depending on if it is a a fee for an NFT or a fungible token.
Price Multiplier = Currently 1.5.
Say if, for example, a person sees their Base Bridge fee as 52.59 USD, the formula that determined it was :
(35.06)*1.5 = 52.59
The base fee is split where ~ 67% of the fee is used to pay Ethereum's Bridge Gas fee, while the remaining amount of the fee is burned.
The base bridge fee is used if the network does not experience a higher-than-normal number of bridges from GalaChain to another blockchain. If there is a surge in bridges away from GalaChain, a Congestion Bridge fee is used.
Congestion Bridge Fee
The formula for if Congestion Bridge Fee pricing becomes activated is
(actualBridges - expectedBridgesPerHour) <= acceptedDeltaPerHour
actualBridges = How many bridges occurred roughly within an hour.
expectedBridgesPerHour = Currently 5
acceptedDeltaPerHour = Currently 5
Say if 10 bridges occurred within roughly the last hour, it would be:
10 - 5 <= 5
5 <= 5
Since the actualBridges - expectedBridgesPerHour is less than or equal to acceptedDeltaPerHour, congestion pricing is turned off, and the standard Base Bridge Fee is used.
If 11 bridges or more occurred within roughly the last hour, the formula would be:
11 - 5 <= 5
6 <= 5
Since the number exceeds the acceptedDeltaPerHour, Congestion pricing is turned on.
Note: The additional fee added to the Base Bridge Fee is burned. When Congestion pricing is active, waiting until the amount of bridging decreases below this threshold is recommended so that users can pay less in bridging fees.
If congestion pricing is turned on, then the bridge fee becomes:
(NormalizedBridgesPerHour/ExpectedBridgesPerHour) * Base Bridge Fee = Congestion Total Gas Fee
NormalizedBridgesPerHour = represents the calculated number of bridges for a given hour in relation to the hour they occurred.
ExpectedBridgesPerHour = Currently 5.
Base Bridge Fee = Ethereum Bridge Fee x Price Multiplier
Say if, for example, a person sees their Congestion Bridge fee as 100.16 USD, the formula that determined it was:
9.5233/5 * (35.06)1.5 = 100.16 USD
1.90466 * 52.59 = 100.16 USD
Note: This is the equation for congestion and normal gas fee, it accounts for both:
f(x) = if ABS(x - expectedBridgesPerHour) ≤ acceptedDeltaPerHour
then expectedBridgesPerHour else x
g(x, a) = if a ≤ 1 then f(x) else f(x) * ((1/(a/100+0.99))-0.3731343283)
galaGasFeeUSD = MAX(g(X₁, 1)...g(X₁₆₉, 169))/expectedBridgesPerHour * ethgasFeeUsd * priceMultiplier
given Xₙ = actual bridges in hour n