Skip to content

Latest commit

 

History

History
67 lines (42 loc) · 2.07 KB

File metadata and controls

67 lines (42 loc) · 2.07 KB

Bridging ERC20 Tokens to Berachain with LayerZero V2

This repository contains an example of how to bridge an existing ERC20 token (in this case, $UNI) from the Sepolia Testnet to the Berachain Testnet using LayerZero V2 and their Omnichain Fungible Token (OFT) standard.

👉 Learn more about LayerZero V2

LayerZero Berachain OFT Bridging

Requirements

Step 1 - Setup Project & Install Dependencies

Install project dependencies:

# FROM: ./layerzero-oft

npm install;

Step 2 - Deploy Adapter to Sepolia

Create a .env file at the root of ./layerzero-oft with the following and populate it with your PRIVATE_KEY:

PRIVATE_KEY=
SEPOLIA_ADAPTER_ADDRESS=
BERACHAIN_OFT_ADDRESS=

Deploy MyAdapter.sol to Sepolia:

# FROM: ./layerzero-oft

forge script script/MyAdapter.s.sol --rpc-url https://rpc.sepolia.org/ --broadcast

Update SEPOLIA_ADAPTER_ADDRESS in your .env file with the address of your MyAdapter deployment.

Step 3 - Deploy OFT to Berachain

Deploy MyOFT.sol to Berachain:

# FROM: ./layerzero-oft

forge script script/MyOFT.s.sol --rpc-url https://bepolia.rpc.berachain.com/ --broadcast

Update BERACHAIN_OFT_ADDRESS in your .env file with the address of your MyOFT deployment.

Step 4 - Bridge Tokens from Sepolia to Berachain

Finally, run the Bridge.s.sol script to bridge your $UNI tokens to Berachain:

# FROM: ./layerzero-oft

forge script script/Bridge.s.sol --rpc-url https://rpc.sepolia.org/ --broadcast