This documentation inherits from a template project for getting started with LayerZero's OApp
contract development.
We recommend using pnpm
as a package manager (but you can of course use a package manager of your choice):
pnpm install
This project supports both hardhat
and forge
compilation. By default, the compile
command will execute both:
pnpm compile
If you prefer one over the other, you can use the tooling-specific commands:
pnpm compile:forge
pnpm compile:hardhat
Or adjust the package.json
to for example remove forge
build:
- "compile": "$npm_execpath run compile:forge && $npm_execpath run compile:hardhat",
- "compile:forge": "forge build",
- "compile:hardhat": "hardhat compile",
+ "compile": "hardhat compile"
Similarly to the contract compilation, we support both hardhat
and forge
tests. By default, the test
command will execute both:
pnpm test
If you prefer one over the other, you can use the tooling-specific commands:
pnpm test:forge
pnpm test:hardhat
Or adjust the package.json
to for example remove hardhat
tests:
- "test": "$npm_execpath test:forge && $npm_execpath test:hardhat",
- "test:forge": "forge test",
- "test:hardhat": "$npm_execpath hardhat test"
+ "test": "forge test"
Set up deployer wallet/account:
- Rename
.env.example
->.env
- Create and fund a new wallet
- Choose your preferred means of setting up your deployer wallet/account:
MNEMONIC="test test test test test test test test test test test junk"
or...
PRIVATE_KEY="0xabc...def"
To deploy your contracts to your desired blockchains, run the following command in your project's folder:
npx hardhat lz:deploy
More information about available CLI arguments can be found using the --help
flag:
npx hardhat lz:deploy --help
By following these steps, you can focus more on creating innovative omnichain solutions and less on the complexities of cross-chain communication.
There are 2 main set up steps for Omni X Multisender. Before executing the set up, set the deployment address and chain related constants to yours in the constants folder
First, run the following command to setPeers on every deployed chain:
npx hardhat setPeers --network ethereum
This will be automated in the future however it is still beneficial to run chains one by one or in small groups as error handling in case of multiple failures in 30+ network environment could get cumbersome.
Next, run:
npx hardhat setUlnConfigs --network ethereum
By default it will use a lean single DVN config with either Omni X DVN or LayerZero DVN depending on the chain availability. We reccomend using exactly the same config, but of course you are free to change number and types of DVNs that you want to use. Note that the number of confirmations, optional or required DVNs, and their types MUST MATCH EXACTLY between a source and a destination chain.