This project follows the LayerZero CLI example.
Install dependencies using:
pnpm install
Before deploying, update the following in your hardhat.config.ts file:
- RPC: Replace the RPC endpoints under
networks
with your own value. - Etherscan: Under
etherscan
update thebrowserUrl
for each network. The correspondingapiURL
should use the same value asbrowserUrl
but with "frontend" replaced by "backend" and with /api appended. Note: The api keys are arbitrary and do not need to be changed. - Chain IDs: Ensure that all chain ids match your networks
Update the following:
- Executor and DVN addresses: For the Ethereum → Arbitrum connection, use the first executor and the first DVN address returned by the LayerZero package.
- For the Arbitrum → Ethereum connection, use the second executor and DVN address.
- Make sure to update the DVN address in both the send configuration and receive configuration.
- Confirmations: Optionally, change the number of confirmations for cross-chain messages (minimum 1).
Change the private key in the .env file with the private key of your pre-funded wallet
Deploy your contracts using:
npx hardhat lz:deploy
After deployment, verify your contracts with the following command:
npx hardhat verify --network <network_name> <deployed_contract_address> "0x0000000000000000000000000000000000000000" "0x0000000000000000000000000000000000000000"
You can run this multiple times to verify the contracts on each chain.
Note: The two addresses provided after the deployed contract address can be arbitrary.
Wire your OApp configuration with:
npx hardhat lz:oapp:wire --oapp-config layerzero.config.ts
Ensure that you have updated the executor and DVN addresses in layerzero.config.ts as described above.
To send a message, run a command like:
npx hardhat sendMessage --network ethereum --dst-network arbitrum --message "Hello World"
Here, --network represents the source chain.