Security advisory: The permissionless WAB deployment configures its own DVN set at deploy
time. Child bridges may have varying security assumptions. Before bridging significant value
through a WAB child, users should verify the DVN configuration via
endpoint.getConfig(childAddress, sendLibrary, destinationEid, 2). Configurations with fewer than
2 required DVN attestations should be treated as single-point-of-failure risk.
Use this guide when you want to bridge an existing ERC20 from another chain (e.g. Sepolia) to Berachain using LayerZero V2 and the OFT (Omnichain Fungible Token) standard.
Repository
Official documentation
Requirements
- Node
v20.11.0 or greater, npm
- Wallet with Berachain testnet $BERA — Bepolia Faucet
- Wallet with Sepolia $UNI (or other source token) — see README for faucet/Uniswap
- Foundry
Stack
Solidity, Foundry (Forge scripts), Node.js, LayerZero V2 OFT.
Quick start
- Clone and install
git clone https://github.com/berachain/guides.git && cd guides/apps/layerzero-oft
npm install
- Create
.env with PRIVATE_KEY, SEPOLIA_ADAPTER_ADDRESS, BERACHAIN_OFT_ADDRESS (fill addresses after deploying).
- Deploy adapter on Sepolia
forge script script/MyAdapter.s.sol --rpc-url https://rpc.sepolia.org/ --broadcast
Set SEPOLIA_ADAPTER_ADDRESS in .env.
- Deploy OFT on Berachain
forge script script/MyOFT.s.sol --rpc-url https://bepolia.rpc.berachain.com/ --broadcast
Set BERACHAIN_OFT_ADDRESS in .env.
- Bridge tokens
forge script script/Bridge.s.sol --rpc-url https://rpc.sepolia.org/ --broadcast
Key files
| Purpose | Path |
|---|
| Source chain adapter | script/MyAdapter.s.sol (and source) |
| Berachain OFT | script/MyOFT.s.sol (and source) |
| Bridge script | script/Bridge.s.sol |