Homepage | Docs | Developers
Quickstart | Configuration | Message Execution Options | Endpoint Addresses
Template project for getting started with LayerZero's OFT
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"
Using hardhat. Just add the network you want to deploy to.
The --tag
flag is for the contract name.
npx hardhat lz:deploy
Wire up the contracts on layerzero.config.ts
with the default configs
npx hardhat lz:oapp:wire --oapp-config layerzero.config.ts
Human readable config table
npx hardhat lz:oapp:config:get --oapp-config layerzero.config.ts
Setting LZ Configs
Make sure you set the DVN and the OAPP address in the layerzero.config.ts
file. The LZ bridge requires it. You may find the default DVN addresses here: https://docs.layerzero.network/v2/developers/evm/technical-reference/dvn-addresses
There are examples in layerzero.config.ts
to guide you.
Verify contracts on Blockscout
- Flatten contract and copy to clipboard
forge flatten contracts/LRTConfig.sol:LRTConfig | pbcopy
- Go to Blockscout and click on the contract address
- Click on the
Contract
tab - Click on
Verify and Publish
button - Paste the flattened contract in the
Contract Code
field - Click on
Verify and Publish
button
Note: you may need to find the exact EVM compiler for the contract, e.g. Paris, Shanghai, etc
Verification on Zircuit Explorer
It worked using forge verify-contract command
forge verify-contract --verifier-url https://explorer.zircuit.com/api/contractVerifyHardhat <deployed-contract-address> <source-file>:<contract-name> --root . --etherscan-api-key <ZIRCUIT_API_KEY>
RSETH_OFTAdapter: 0x85d456B2DfF1fd8245387C0BfB64Dfb700e98Ef3
RSETH_OFT: 0x4186BFC76E2E237523CBC30FD220FE055156b41F
RSETH_OFT: 0x4186BFC76E2E237523CBC30FD220FE055156b41F
RSETH_OFT: 0x4186BFC76E2E237523CBC30FD220FE055156b41F
RSETH_OFT: 0x4186BFC76E2E237523CBC30FD220FE055156b41F
RSETH_OFT: 0x4186BFC76E2E237523CBC30FD220FE055156b41F
RSETH_OFT: 0x65421ba909200b81640d98B979d07487C9781B66
RSETH_OFT: 0x1Bc71130A0e39942a7658878169764Bbd8A45993
RSETH_OFT: 0x4186BFC76E2E237523CBC30FD220FE055156b41F
RSETH_OFT: 0x1B3a9A689Ba7555F9D7984D7Ad4025574Ed5A0f9
RSETH_OFT: 0x6bE2425C381eb034045b527780D2Bf4E21AB7236
RSETH_OFT: 0x4186BFC76E2E237523CBC30FD220FE055156b41F
RSETH_OFT: 0xc3eACf0612346366Db554C991D7858716db09f58
RSETH_OFT: 0xc3eACf0612346366Db554C991D7858716db09f58
RSETH_OFT: 0x4186BFC76E2E237523CBC30FD220FE055156b41F