Overview
Asset bridging enables the transfer of tokens and native assets between Agglayer-connected chains. The Unified Bridge handles different token types with distinct mechanisms depending on whether the token originates from the source chain or is a foreign token.
Supported Token Types
The Unified Bridge handles different token types with specific mechanisms:Bridge Asset Function
ThebridgeAsset function initiates asset transfers between chains.
Function Signature
Parameters
destinationNetwork: Network ID of the destination chaindestinationAddress: Address to receive assets on destination chainamount: Amount of tokens to bridgetoken: Token contract address (0x0 for native gas token)forceUpdateGlobalExitRoot: Whether to update GER immediatelypermitData: Raw permit data for ERC20 tokens (optional)
Process Steps
- Validation: Check destination network is not the source network
- Token Preparation: Handle token based on type (lock, burn, or transfer)
- Event Emission: Emit
BridgeEventwith transaction details - Tree Update: Add transaction to Local Exit Tree as leaf node
Token Preparation Logic
The bridge handles different token types with specific mechanisms based on their origin and nature:Note that in caseETHis the native token, WETHToken will be at0x0address.
Native Gas Token (ETH, Custom Gas Token)
WETH Token
Foreign ERC20 Token (Not native to source chain)
Native ERC20 Token (Native to source chain)
Claim Asset Function
TheclaimAsset function claims bridged assets on the destination chain.
Function Signature
Parameters
smtProofLocalExitRoot: Merkle proof for Local Exit RootsmtProofRollupExitRoot: Merkle proof for Rollup Exit RootglobalIndex: Global index identifying the transactionmainnetExitRoot: Mainnet Exit Root at time of transactionrollupExitRoot: Rollup Exit Root at time of transactionoriginNetwork: Network ID of source chainoriginTokenAddress: Token address on source chaindestinationNetwork: Network ID of destination chaindestinationAddress: Address to receive assetsamount: Amount of tokens to claimmetadata: Additional metadata (if any)
Process Steps
- Validation: Verify destination network matches current chain
- Proof Verification: Verify Merkle proofs against Global Exit Root
- Duplicate Check: Ensure transaction hasn’t been claimed before
- Token Transfer: Transfer tokens based on token type (see Token Transfer Logic below)
- Claim Record: Mark transaction as claimed