> ## Documentation Index
> Fetch the complete documentation index at: https://docs.berachain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Bridging ERC20 with LayerZero V2

> Bridge ERC20 tokens (e.g. $UNI) from Sepolia to Berachain using LayerZero V2 and the Omnichain Fungible Token (OFT) standard.

<Warning>
  **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.
</Warning>

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

* **Code:** [github.com/berachain/guides/tree/main/apps/layerzero-oft](https://github.com/berachain/guides/tree/main/apps/layerzero-oft)
* **README (raw):** [raw README](https://raw.githubusercontent.com/berachain/guides/main/apps/layerzero-oft/README.md)

## Official documentation

* [LayerZero V2](https://docs.layerzero.network/v2) — concepts and OFT.

## Requirements

* Node `v20.11.0` or greater, npm
* Wallet with Berachain testnet \$BERA — [Bepolia Faucet](https://bepolia.faucet.berachain.com)
* Wallet with Sepolia \$UNI (or other source token) — see README for faucet/Uniswap
* [Foundry](https://book.getfoundry.sh/getting-started/installation)

## Stack

Solidity, Foundry (Forge scripts), Node.js, LayerZero V2 OFT.

## Quick start

1. **Clone and install**
   ```bash theme={null}
   git clone https://github.com/berachain/guides.git && cd guides/apps/layerzero-oft
   npm install
   ```
2. **Create `.env`** with `PRIVATE_KEY`, `SEPOLIA_ADAPTER_ADDRESS`, `BERACHAIN_OFT_ADDRESS` (fill addresses after deploying).
3. **Deploy adapter on Sepolia**
   ```bash theme={null}
   forge script script/MyAdapter.s.sol --rpc-url https://rpc.sepolia.org/ --broadcast
   ```
   Set `SEPOLIA_ADAPTER_ADDRESS` in `.env`.
4. **Deploy OFT on Berachain**
   ```bash theme={null}
   forge script script/MyOFT.s.sol --rpc-url https://bepolia.rpc.berachain.com/ --broadcast
   ```
   Set `BERACHAIN_OFT_ADDRESS` in `.env`.
5. **Bridge tokens**
   ```bash theme={null}
   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`                 |
