This repo is intended to serve as a potential starting point for building on top of LayerZero. This repo is setup to deploy the following:
- OFT (V1) on the original 7 chains LayerZero initially supported.
- OFTV2 contracts on goerli and bsc-testnet.
- ProxyOFTWithFee on fuji to convert already deployed ERC20 into OFT and OFTWithFee on arbitrum-goerli and bsc-testnet.
Learn about the difference between OFT(v1) and OFTV2 here.
This repo comes with LayerZero tooling to Lock in UA Configuration and Wire Up Configuration. To use the UA Configuration script please fill in your appConfig.json according to this documentation. To use the Wire Up Configuration script please fill in your wireUpConfig.json according to this documentation.
- Add a .env file (to the root project directory) with your MNEMONIC="" and fund your wallet in order to deploy!
Run the following hardhat commands to deploy OFT to the original 7 chains:
npx hardhat deploy --network goerli --tags ExampleOFT
npx hardhat deploy --network bsc-testnet --tags ExampleOFT
npx hardhat deploy --network fuji --tags ExampleOFT
npx hardhat deploy --network mumbai --tags ExampleOFT
npx hardhat deploy --network arbitrum-goerli --tags ExampleOFT
npx hardhat deploy --network optimism-goerli --tags ExampleOFT
npx hardhat deploy --network fantom-testnet --tags ExampleOFT
Then run the Wire Up Configuration to:
- function setTrustedRemote(uint16, bytes)
- function setUseCustomAdapterParams(bool)
- function setMinDstGas(uint16, uint16, uint)
npx hardhat wireAll --e testnet --config-path "./constants/oftConfig/wireUpConfig.json"
npx hardhat --network fuji oftSend --qty 100000000000000000 --target-network mumbai
Run the following hardhat commands to deploy OFTV2 to goerli and bsc-testnet:
npx hardhat deploy --network goerli --tags ExampleOFTV2
npx hardhat deploy --network bsc-testnet --tags ExampleOFTV2
Then run the Wire Up Configuration to:
- function setTrustedRemote(uint16, bytes)
- function setUseCustomAdapterParams(bool)
- function setMinDstGas(uint16, uint16, uint)
- function setDefaultFeeBp(uint16)
- function setFeeBp(uint16, bool, uint16)
npx hardhat wireAll --e testnet --config-path "./constants/oftv2Config/wireUpConfig.json"
npx hardhat --network fuji oftv2Send --qty 100000000000000000 --target-network arbitrum-goerli
Run the following hardhat commands to deploy OFTV2 to goerli and bsc-testnet:
npx hardhat deploy --network fuji --tags ExampleProxyOFTWithFee
npx hardhat deploy --network bsc-testnet --tags ExampleOFTWithFee
npx hardhat deploy --network arbitrum-goerli --tags ExampleOFTWithFee
Then run the Wire Up Configuration to:
- function setTrustedRemote(uint16, bytes)
- function setUseCustomAdapterParams(bool)
- function setMinDstGas(uint16, uint16, uint)
- function setDefaultFeeBp(uint16)
- function setFeeBp(uint16, bool, uint16)
npx hardhat wireAll --e testnet --config-path "./constants/oftWithFeeConfig/wireUpConfig.json"
npx hardhat --network fuji oftv2Send --qty 100000000000000000 --target-network arbitrum-goerli
npx hardhat setConfig --config-path "./constants/oftConfig/appConfig.json"
npx hardhat setConfig --config-path "./constants/oftv2Config/appConfig.json"
npx hardhat setConfig --config-path "./constants/oftWithFeeConfig/appConfig.json"