This guide is intended for both:
- Developers maintaining or contributing to
/examples - Coding agents (e.g. Cursor, Copilot, GPT) that assist with editing, reviewing, or scaffolding examples
AI agents should be pointed to this file via AGENTS.md or .cursor/rules.
Currently, this document will only detail the structure for the READMEs of the examples.
-
Header
-
Goal: Branding + promote docs site + entrypoint
-
Contents: LayerZero logo + links to docs and dev portal
-
Details: The logo should use the following code that ensures the right color logo is displayed depending on the mode (light vs dark):
<p align="center"> <a href="https://layerzero.network"> <picture> <source srcset="https://docs.layerzero.network/img/LayerZero_Logo_White.svg" media="(prefers-color-scheme: dark)"> <source srcset="https://docs.layerzero.network/img/LayerZero_Logo_Black.svg" media="(prefers-color-scheme: light)"> <img alt="LayerZero" src="https://docs.layerzero.network/img/LayerZero_Logo_Black.svg" style="width: 400px;"> </picture> </a> </p>
-
-
Example Title
- Goal: What the example will teach
- Contents: Title + 1–2 sentence goal-style description
-
Table of Contents
- Goal: Allow user to easily navigate the README
- Contents: TOC of all headings
-
Prerequisite Knowledge
- Goal: What to understand before running the example
- Contents: e.g., What is an OApp? What is an OFT?
-
Introduction (optional)
- Goal: High-level context on what this example covers
- Contents: Brief explanation; skip if title + prerequisites suffice
-
Requirements
- Goal: What needs to be installed
- Contents: Tools + versions; optionally call out testnet funding needs
-
Scaffold this example
- Goal: How to initialize the example
- Contents:
pnpm dlx create-lz-oapp@latest --example <name>(Some examples require a feature flag. Refer topackages/create-lz-oapp/src/config.tsto verify)
-
Helper Tasks (inline notice)
- Goal: Let users know helpers exist
- Contents: Single-line pointer to helper tasks section
-
Setup
- Goal: What to configure before building
- Contents:
.envsetup, deployer account prep
-
Build
- Goal: How to compile contracts/programs/modules
- Contents: Build commands
-
Deploy
- Goal: How to deploy contracts/programs/modules
- Contents: Deploy command + minting instructions (if applicable)
-
Enable Messaging
- Goal: How to wire/configure OApps for messaging
- Contents: LZ config, init, and wiring steps
-
Sending Message/OFT/ONFT
- Goal: Trigger a cross-chain action
- Contents: CLI command to triffer send, both/all directions. E.g. for examples/oft, it is
pnpm hardhat lz:oft:send --src-eid 40232 --dst-eid 40231 --amount 1 --to <EVM_ADDRESS>
-
Next Steps
- Goal: What to know after completing the deployment
- Contents: Production Deployment Checklist + links (Security Stack, Message Options)
-
Production Deployment Checklist
- Goal: Prep for production usage
- Contents: Gas profiling, DVN config, confirmation settings
-
Appendix
- Goal: Mark end of core deployment steps
- Contents: Additional topics and configuration
16.1. Running tests
- Goal: How to test contracts/programs
- Contents: Test commands
16.2. Adding other chains
- Goal: Expand the example to more networks
- Contents: Add logic, update
hardhat.config.ts
16.3. Using Multisigs
- Goal: Deploy using a multisig wallet
- Contents: Command param diffs, multi-VM notes
16.4. LayerZero Hardhat Helper Tasks (detailed)
- Goal: Understand all helper tasks
- Contents:
- Link to docs for the built-in tasks (after the page has been created in docs)
- local tasks (defined in src/tasks/index.ts) should have their params listed (manual style)
16.5. Contract/Program Verification
- Goal: Verify deployments
- Contents: VM-specific verification docs
16.6. Troubleshooting
- Goal: Resolve errors and setup issues
- Contents: Link to general troubleshooting + local fixes
16.7. Audits (include only if audits exist)
- Goal: Link to audit reports for transparency
- Contents: Commit hash audited + links to audit report PDFs
Any sections that don't appear in the above list should be considered for removal. Before removing, ask the user for confirmation.
- Example READMEs should focus on required commands, with elaborations linked to docs.
- Avoid duplicating explanations of general concepts (e.g., OFTs)—link to docs instead.
- The first mention of concepts like Endpoint IDs, Wiring, etc. should link to the glossary: https://docs.layerzero.network/v2/home/glossary
- TODO: Every README should invite partners to provide feedback to drive improvements.
- Options-first: Enforced Options implementation and instructions should be included by default (e.g. in
layerzero.config.ts). - Two chains only: Examples should use only 2 chains by default to reduce testnet setup friction; use “Add other chains” section to scale up if needed. For EVM, prefer using the following in the following order: Arbitrum Sepolia (
EndpointId.ARBSEP_V2_TESTNET), Base Sepolia (EndpointId.BASESEP_V2_TESTNET).
- in
hardhat.config.ts, the network names should be likearbitrum-sepoliaandbase-sepolia(and NOTarbitrum-testnetorbase-testnet)
- EVM OFT Test Minting: If minting is needed for testing, prefer a commented line in
contracts/MyOFT.solconstructor:// _mint(msg.sender, 100000 * (10 ** 18));. The README must: (a) instruct developers to uncomment this line for testnet, and (b) include a production checklist reminder to ensure this line is commented out for production deployments. - Example helper task runs (In Progress) For Hardhat tasks, above the
task()line there should be a comment with an example of how to run it. Prefer using only the required params for the example command run.
- param labels should be like
<EID>,<EVM_RECIPIENT>,<SOLANA_RECIPIENT>,<MINT_ADDRESS>
Note that principle items with the (In Progress) prefix are new and not yet applied to all examples, but should be.