Ankr Bridge mechanics
Smart contracts
Smart contracts involved in bridging Liquid Staking tokens are:
- Ankr Bridge on Avalanche (opens in a new tab) (0x31BE0FA706E391a88C3A09cC13112bd55E0887f5) — sends assets to other blockchains from Avalanche and receives assets sent to Avalanche.
- Ankr Bridge on Binance (opens in a new tab) (0xc437df90b37c1db6657339e31bfe54627f0e7181) — sends assets to other blockchains from Binance and receives assets sent to Binance.
- Ankr Bridge on Ethereum (opens in a new tab) (0xc437df90b37c1db6657339e31bfe54627f0e7181) — sends assets to other blockchains from Ethereum and receives assets sent to Ethereum.
- Ankr Bridge on Fantom (opens in a new tab) (0x31BE0FA706E391a88C3A09cC13112bd55E0887f5) — sends assets to other blockchains from Fantom and receives assets sent to Fantom.
- Ankr Bridge on Polygon (opens in a new tab) (0x31be0fa706e391a88c3a09cc13112bd55e0887f5) — sends assets to other blockchains from Polygon and receives assets sent to Polygon.
Briding workflow
The mechanics of what's going on under the hood when a user transfers their funds between networks can be described as following:
- The user has Ankr Liquid Staking tokens on the network where our smart contract minted them for said user.
- The user wants to transfer them onto another network. They visit Ankr Bridge (opens in a new tab), choose the amount to be transferred and click Approve.
That causes Ankr Bridge to call the
approve()
function of the bridging smart contract to allow transfer of the assets. From the user side, it looks like they approve the operation in their MetaMask. - The user clicks Send on the page, which causes Ankr Bridge to call the
deposit()
function to transfer the assets to the destination network. This operation is called peg-in. - The user's assets are now locked on Ankr Bridge and the user gets the transaction hash.
- The user sends the transaction hash to Ankr backend for notarization.
- The user clicks Switch on the page and switches to the destination network.
- The user clicks Receive, which causes Ankr Bridge to call the
withdraw()
function (both for ERC-20 or native tokens). This operation is called peg-out. - The user sees the transferred assets deposited to their wallet on the destination network.
To sum up, the flow in any direction is the same: approve()
(if necessary) -> deposit()
-> notarize
-> withdraw()
.