Allbridge Core is a cross-chain swap built specifically for dollar-pegged tokens (stablecoins). Operates without wrapping tokens and works by keeping liquidity pools for the supported tokens on each blockchain. Incoming tokens go into the pool, the value of those tokens is sent via the messaging protocol to another chain, where it is converted back to the tokens to be paid to the user.
In detail, when the user sends tokens via the Allbridge Core the following happens:
- Bridge exchanges incoming tokens into their dollar value in the token pool for this particular token
- This value is send via the underlining messaging protocol to the destination chain
- Bridge contract on the destination chain swaps dollar value to the tokens from the liquidity pool and sends them to the recipient
This process is illustrated for a sample swap of USDT on Ethereum to BUSD on BNB Chain in the diagram below.
The user (or the protocol integrating Allbridge Core) only has to trigger a single transaction on the source chain (line #1 in the diagram above).
Allbridge Core currently supports the following chains and tokens:
Allbridge Core uses messaging protocols to move information between blockchains. Particularly it is used to send information about transfers and their value to the recepient's blockchain. Allbridge Core architecture allows support for multiple messaging protocols. Currently supported protocols are:
- Wormhole is a decentralized protocol operated by Jump Crypto and used by their own Portal Bridge. Does not support Tron.
- Allbridge own messaging protocol which is less decentralized (just 2 validators), but works with all blockchains Allbridge Core supports, including Tron.
Wormhole protocol is more decentralized, this is why it is used by default. Allbridge messaging however is quicker (less time required to reach consensus), less expensive (smaller transactions) and supports Tron.
Allbridge Core fees can be divided into two distinct categories: fixed transaction fee not depending on the transfer amount and value adjustment fees.
To pay for the receiving transactions on the destination chain, the user pays a transaction fee. It is paid in the gas coin of the sending chain and is attached to the transaction the user submits. It does not depend on the transfer amount.
These adjustments affect the final amount received by the user. They include:
- Dollar value of the sending token, if more than
1
the amount will increase - Source chain liquidity provider fee, always
0.15%
of the transfer amount - Dollar value of the receiving token, if more than
1
the amount will decrease - Destination chain liquidity provider fee, always
0.15%
of the transfer amount
To summarize, the user always pays 0.3%
to the liquidity providers, the rest is the token value fluctuations explained below.
When transferring tokens between blockchains the amount need to be converted into their internal dollar value. This value depends on the pool condition and the amount being evaluated.
For the sending side (converting tokens into their value):
Where:
-
$x_{orig}$ is the token balance in the pool before swap (tokenBalance
view function in thePool
contract) -
$x_{tokens}$ is the amount of tokens you plan to swap -
$y_{orig}$ is thevalue
balance in the pool (vUsdBalance
view function in thePool
contract) -
$a$ is a swap curve shape constant (a
view function in thePool
contract, does not change) -
$d$ is a measure of the total liquidity in the pool (d
view function in thePool
contract, does not change unless liquidity is added or removed) -
$y_{value}$ is the resulting dollar value of the$x_{tokens}$ tokens
For the receiving side (converting value into tokens the formula is very similar, but reversed):
The meaning of the variables is the same as before, but for the token pool on the receiving side.
The easiest way to integrate Allbridge Core into your product is to use Core SDK (npm package, source).