Bridge
Bridge
Twin's bridge lets you move any token between the supported networks with no custodians and no liquidity pools. It is built on LayerZero V2 using the OFT (Omnichain Fungible Token) standard.
Model: burn & mint
Unlike a lock & mint bridge (which locks funds in a source contract), Twin uses burn & mint:
- The user calls
send()on the source network's adapter. - The adapter burns the tokens on the source network.
- LayerZero carries the message to the destination network.
- The destination adapter mints the same amount to the recipient.
Total supply is preserved: what is burned on one network is minted on the other. There is no insufficient-liquidity risk.
OFT interface
Each adapter exposes the standard LayerZero OFT interface. The two key functions to integrate:
Code
Code
Integration flow
- Approve — the user approves the adapter as spender of the ERC-20 (a prior transaction).
- quoteSend — quote the
nativeFee(message gas). - send — execute with
msg.value = nativeFee. The wallet must be connected to the source network.
sendis payable: you must forward thenativeFeereturned byquoteSendasvalue.- The recipient
tois abytes32(20-byte address left-padded with zeros). extraOptions: '0x'works because the adapters have enforcedOptions configured on-chain.
Adapters per network
Each token has one adapter per network. All LayerZero peers are wired bidirectionally between the 4 networks (verified on-chain via peers()), so any pair of networks is a valid route for all 10 tokens.
Base · EID 30184
Polygon · EID 30109
Arbitrum · EID 30110
Ethereum · EID 30101
The same address can appear as the adapter of different tokens on different networks (deterministic deployment — same bytecode, same address, different contract). Always use the row for the correct network + token.
Using the bridge from the app
End users don't need to interact with the contracts directly: the Twin app exposes the bridge with token selection, source/destination network and automatic fee quoting.
