This project implements an Omnichain Non-Fungible Token (ONFT) on the Solana blockchain using LayerZero's cross-chain messaging protocol. Unlike the Ethereum implementation which uses contract inheritance, this Solana version utilizes LayerZero's Endpoint Cross Program Invocation (CPI) Helper to achieve cross-chain functionality.
The Solana program is structured to work with LayerZero's messaging interface, allowing for sending and receiving arbitrary data between different blockchain networks. Here's an overview of the key components:
programs/zealot_nft/src/lib.rs
programs/zealot_nft/src/instructions/
init_oft.rs
and init_adapter_oft.rs
: Initialize the ONFTsend.rs
: Handles sending tokens to other chainslz_receive.rs
: Processes incoming messages from other chainsmint_to.rs
: Mints new tokensset_mint_authority.rs
: Sets the minting authorityprograms/zealot_nft/src/state/
onft.rs
: ONFT configurationpeer.rs
: Manages cross-chain peer informationThe Solana program implements the following core functionalities:
Initialization:
init_oft.rs
and init_adapter_oft.rs
Cross-Chain Operations:
send.rs
prepares and sends messages through the LayerZero Endpointlz_receive.rs
handles incoming messages from other chainsToken Management:
mint_to.rs
handles token creationset_mint_authority.rs
controls minting permissionsAdministrative Functions:
instructions/
handle admin operations like setting peers and enforcing optionsUnlike the Ethereum version which inherits from an OApp Standard, the Solana program directly interacts with the LayerZero Endpoint:
send.rs
and lz_receive.rs
are key files that interact with the LayerZero EndpointThe test file tests/zealot_nft.ts
covers basic operations:
These tests ensure that the program correctly interacts with the LayerZero Endpoint for cross-chain operations.