BridgeRouter
Contract code: https://github.com/nomad-xyz/monorepo/blob/main/packages/contracts-bridge/contracts/BridgeRouter.sol
The BridgeRouter contract is the entry point for the token bridge application and implements its interface, per the Router pattern. It enables users to “send” tokens from Chain A to Chain B via a lock-and-mint mechanism.
Sending and Receiving Tokens
Sending
The sending side logic is implemented in the send
function:
Receiving
The receiving side logic is implemented in the handle
function:
Lock-and-Mint Mechanism
The BridgeRouter enforces the following strict invariant:
The amount locked on the chain where the token originates must always be equal to the circulation of representational tokens minted on all destination chains.
You can see this in the codebase here:
Enrolling Custom Representations
The BridgeRouter enables custom tokens to be enrolled by calling enrollCustom
:
Last updated