Skip to content

LayerZero-Labs/devtools

Repository files navigation

LayerZero

Homepage | Docs | Developers

LayerZero Developer Utilities

Development | Cheatsheet | Examples


Please note that this repository is in a beta state and backwards-incompatible changes might be introduced in future releases. While we strive to comply to semver, we can not guarantee to avoid breaking changes in minor releases.


Introduction

This toolkit is designed to streamline the process of building, testing, and deploying omnichain applications (OApps) using LayerZero. This tool is meant to support you through the end-to-end development lifecycle of a cross-chain project.

Visit our developer docs to get started building omnichain applications.

Bootstrapping an Example Cross-Chain Project

Kick-start your development with our create-lz-oapp CLI utility. This command-line tool facilitates the creation of a new omnichain application project, setting up the necessary environment and dependencies:

npx create-lz-oapp@latest

Following this, you will be guided through setting up a project template. Choose from a variety of examples to match your project needs.

Writing Smart Contracts

Our example project offers templates for both the Omnichain Application (OApp) and Omnichain Fungible Token (OFT) contracts. Select the template that suits your project:

Writing Unit Tests

Testing your contracts is crucial. We support both Hardhat and Foundry frameworks for writing and running unit tests for your LayerZero contracts.

Use npx hardhat compile or forge build to compile your smart contracts.

Test your contract using npx hardhat test or forge test.

Deploying Contracts

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

Configuring contracts

The examples come with basic layerzero.config.ts files that should get you started on testnet straight away.

More information on how to configure your OApp will be available in our docs soon.

Wiring Contracts

Pair your deployed contracts using:

npx hardhat lz:oapp:wire --oapp-config layerzero.config.ts

By following these steps, you can focus more on creating innovative omnichain solutions and less on the complexities of cross-chain communication.



Join our community on Discord | Follow us on Twitter