Homepage | Docs | Developers
Quickstart | Configuration | Message Execution Options | Endpoint Addresses
A LayerZero-powered NFT collection that enables cross-chain NFT transfers using the ONFT721 standard.
- In your
hardhat.config.tsfile, add the following configuration to the network you want to deploy the ONFT721Adapter to:// Replace `0x0` with the address of the ERC721 token you want to adapt to the ONFT721 functionality. onft721Adapter: { tokenAddress: '0x0', }
- Network: OP Sepolia (Optimism Testnet)
- Contract Address:
0xA1C178304D40841703c454D43187E029dbf5173e - Contract Name: MyONFT721
- Symbol: ONFT
- Block Explorer: View on Etherscan
- Cross-chain NFT transfers using LayerZero
- ERC721 standard compliance
- Customizable base URI for NFT metadata
- Configurable mint price in BTB tokens
- Owner-only minting functions
- Maximum supply cap of 10,000 NFTs
- Node.js
- pnpm (Package Manager)
- Hardhat
# Install dependencies
pnpm install- Create a
.envfile based on.env.example - Set your private key or mnemonic
- (Optional) Set RPC URLs for different networks
# Compile contracts
pnpm hardhat compile
# Run tests
pnpm hardhat test
# Deploy to OP Sepolia
pnpm hardhat deploy --network op-sepolia
# Verify contract
pnpm hardhat verify --network op-sepolia <contract-address> <constructor-args>buyToken(uint256 tokenId): Buy an NFT using BTB tokenstokenURI(uint256 tokenId): Get the metadata URI for a specific token
mint(address to, uint256 tokenId): Mint a new NFT (owner only)safeMint(address to, uint256 tokenId): Safely mint a new NFT (owner only)updateBaseURI(string calldata _newBaseURI): Update the base URI for token metadatasetBaseExtension(string memory _newBaseExtension): Update the file extension for token metadata
This project uses LayerZero's ONFT721 standard for cross-chain NFT transfers. The contract is deployed with the following LayerZero configuration:
- LayerZero Endpoint (OP Sepolia):
0x6edce65403992e310a62460808c4b910d972f10f - Main Chain ID: 11155420 (OP Sepolia)
UNLICENSED
This project is provided as-is. Please conduct your own security review before using any of the code in production.
We recommend using pnpm as a package manager (but you can of course use a package manager of your choice):
pnpm installThis project supports both hardhat and forge compilation. By default, the compile command will execute both:
pnpm compileIf you prefer one over the other, you can use the tooling-specific commands:
pnpm compile:forge
pnpm compile:hardhatOr 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 testIf you prefer one over the other, you can use the tooling-specific commands:
pnpm test:forge
pnpm test:hardhatOr 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 - 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"
- Fund this address with the corresponding chain's native tokens you want to deploy to.
To deploy your contracts to your desired blockchains, run the following command in your project's folder:
npx hardhat lz:deployMore information about available CLI arguments can be found using the --help flag:
npx hardhat lz:deploy --helpBy following these steps, you can focus more on creating innovative omnichain solutions and less on the complexities of cross-chain communication.