This repository was created to promote understanding of the LayerZero protocol and how to use it.
It is an end-to-end demonstration of LayerZero, with everything running locally.
This is only a demo of personal development. Please refer to the ISC license for details.
The following modules are docker-composed. This is because OApp developers can use contracts that have already been deployed to the network.
Please check List of deployed contracts in the official documentation.
- LayerZero Protocol (On-Chain)
- LayerZero Message Library (On-Chain)
- LayerZero OApp (On-Chain)
- DVN (On-Chain / Off-Chain)
- Executor (On-Chain / Off-Chain)
Look at the layerzero
package. Here are a set of LayerZero contracts and default Config settings.
The LICENSE-LZBL-1.2 license covers the LayerZero contract. No modifications are made to the library in this repository and it is intended for personal use only.
I would appreciate it if you could point out any errors in my understanding.
I created the off-chain DVNs and executers basically according to the documentation. (Build DVNs / Build Executor)
At this time only one DVN has been created, but theoretically, it is possible to have multiple DVNs.
The demo OApp supports L1 lock → L2 mint and L2 burn → L1 unlock messaging using OFT, which transfers the ERC20 token.
$ git submodule update --init --recursive
$ pushd lib/TypeChain && pnpm install && pnpm build && popd
$ pnpm install
$ pnpm build
$ pnpm build-image
$ pnpm start
Open another console and run the following.
Run demo-oft
to send OFTs from the source chain to the destination chain.
check-oft
can be used to check the token balance in the destination chain to see if the message succeeds.
$ pnpm demo-oft
$ pnpm check-oft