Dashboard Guide
Bridge Admin
The bridge allows cross-chain transfers of Twin tokens using LayerZero V2 OFT adapters.
Access Paths
- Operations > Bridge -- Operational view: execute bridge transfers (Admin + Operations roles)
- Configuracion > Bridge -- Configuration view: manage bridge routes (Admin only)
Route Configuration
Each bridge route is stored in the bridge_route table with the following fields:
| Field | Description |
|---|---|
bridge_token_key | Groups routes for the same conceptual token (e.g., ARGT). Auto-uppercased. |
ops_token_id | FK to ops_token -- the specific token on this network |
network | Network where this route operates (BASE, POLYGON, etc.) |
adapter_address | OFT adapter contract address on this network |
lz_eid | LayerZero endpoint ID for this network (Base: 30184, Polygon: 30109) |
The table has a partial unique index (bridge_token_key, network) WHERE deleted_at IS NULL to prevent duplicate active routes for the same token on the same network while supporting soft-delete.
Why bridge_token_key? The ops_token table has one row per (address, network). The bridge thinks in terms of "ARGT" across chains, not "ARGT@Base + ARGT@Polygon". The bridge_token_key groups these together.
Operating the Bridge
Steps
- Connect wallet via RainbowKit (ConnectButton in the top bar).
- Select token from available bridgeable tokens (grouped by
bridge_token_key). - Select destination network from available routes for that token.
- Enter amount to bridge.
- Quote -- the frontend calls LayerZero's
quoteSendto get the native fee estimate. - Approve -- if the adapter needs ERC20 allowance, approve first.
- Send -- execute the bridge transaction via the connected wallet.
Flow
Code
TX History
Bridge transactions are stored in the bridge_transaction table with: token, amount, source network, destination network, sender address, TX hash, LayerZero message ID, and status.
Notes
- Wallet-path only in this iteration. Safe wallets and EOA wallets are supported via WalletConnect/RainbowKit. BitGo path (constructing calldata via
encodeFunctionDataand sending through BitGo Express) is a planned follow-up. useWaitForTransactionReceiptis NOT used because Safe multisig wallets return asafeTxHashthat does not appear on-chain until the signing threshold is met.useSwitchChain()is NOT used because Safe wallets do not supportwallet_switchEthereumChain. An Alert is shown asking the user to connect on the correct network.recordBridgeTransactionis non-blocking: if the record call fails after the bridge TX is already sent on-chain, it logs a warning but does not throw. The TX already happened and cannot be undone.- Bridge hooks (
use-bridge.ts) are parametrized -- token address, adapter address, and chain ID are passed as arguments, not hardcoded constants.
Last modified on