The three contracts, tnt.sol
, L2Escrow.sol
, and L2TokenConvert.sol
, work together to manage and bridge the TNT token between Layer 1 (L1) and Layer 2 (L2). Below is an explanation of each contract's role and how they collectively enable the creation and management of TNT as an L2 token.
tnt.sol
is an ERC-20 standard token contract with extra functionality for minting and burning, allowing it to operate across blockchain layers. Key features:
- Minting and Burning: Controlled by designated roles (escrow and converter) to maintain parity across layers.
- Access Control: Ensures that only authorized roles can modify the token supply.
L2Escrow.sol
facilitates the bridging of tokens between L1 and L2. Key responsibilities:
- Receive and Transfer: Receives tokens from L1 and interacts with
L2Token
to mint TNT on L2. - Burn and Synchronize: Burns TNT on L2 when tokens are to be transferred back to L1.
L2TokenConvert.sol
manages conversion between different token standards or representations on the same layer. Features include:
- Minting and Burning: Allows minting and burning based on conversion logic.
- Access Control: Role-based controls ensure secure and authorized conversions.
- When transferring tokens from L1 to L2, an equivalent amount is locked in an escrow-like mechanism on L1, preventing double spending.
L2Escrow
initiates minting of an equivalent amount of TNT on L2 by interacting with theL2Token
contract, ensuring parity between layers.
- Once on L2, TNT can be freely transferred, used in decentralized applications, or converted via the
L2TNTConvert
.
- When returning tokens to L1, an equivalent amount of TNT is burned on L2 to unlock the original tokens on L1, maintaining conservation of the total token supply.
This interaction ensures that TNT tokens remain synchronized across blockchain layers, providing users and applications with a consistent and secure experience. Features like role-based access, upgradability, and pausing further enhance security and adaptability for the TNT token ecosystem.