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.Documentation Index
Fetch the complete documentation index at: https://berachain-422fce37-feat-nodes-section-reno.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Repository
- Code: github.com/berachain/guides/tree/main/apps/layerzero-oft
- README (raw): raw README
Official documentation
- LayerZero V2 — concepts and OFT.
Requirements
- Node
v20.11.0or 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
- Create
.envwithPRIVATE_KEY,SEPOLIA_ADAPTER_ADDRESS,BERACHAIN_OFT_ADDRESS(fill addresses after deploying). - Deploy adapter on Sepolia
Set
SEPOLIA_ADAPTER_ADDRESSin.env. - Deploy OFT on Berachain
Set
BERACHAIN_OFT_ADDRESSin.env. - Bridge tokens
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 |