The entire process of bridging ERC20 tokens are shown on the diagram below
Bridge has a couple roles including:
Administrators on the bridge manage the bridge smart contracts, add or remove validators, set minimum required signatures from validators in order to relay a user's transactions.
Administrators also can upgrade contracts in case of vulnerabilities.
Validatdors do not manage smart contracts in the bridge setup, they are managed by Administrators. Validators in the network are responsible for:
providing 100% uptime to relay transactions
listening for UserRequestForSignature events on the ThunderCore and signing an approval to relay assets on foreign side
listening for CollectedSignatures events on the ThunderCore. Once enough signatures are collected, transferring all collected signatures to the foreign side.
listening for UserRequestForAffirmation or Transfer (depending on the bridge mode) events on the foreign side and sending approval to the ThunderCore to relay assets from foreign network to ThunderCore.
Users send assets to the bridge contracts and receive corresponding assets in return.
NATIVE-TO-ERC mode: Send native coins to the ThunderCore Bridge contract to receive ERC20 tokens from the foreign bridge contract, and send TT20 tokens to the foreign bridge contract to unlock TT from the ThunderCore bridge contract.
ERC-TO-NATIVE mode: Send ERC20 tokens to the foreign bridge contract to receive TT from the ThunderCore Bridge contract, and send TT to the ThunderCore Bridge contract to unlock ERC20 tokens from the Foreign bridge contract.
ERC-TO-ERC mode: Transfer ERC20 tokens to the foreign bridge contract to mint TT20 tokens on the ThunderCore network, and transfer TT20 tokens to the ThunderCore Bridge contract to unlock ERC20 tokens on the foreign network;