ZealynxSecurity / solana-LzApp-ONFT

0 stars 0 forks source link

Solana ONFT (Omnichain Non-Fungible Token) Documentation

1. Project Overview

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.

2. Solana Program Structure

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:

Main Program Logic

Instruction Handlers

State Management

3. Key Functionalities

The Solana program implements the following core functionalities:

  1. Initialization:

    • Sets up the ONFT configuration and LayerZero endpoint interaction
    • Implemented in init_oft.rs and init_adapter_oft.rs
  2. Cross-Chain Operations:

    • Sending: send.rs prepares and sends messages through the LayerZero Endpoint
    • Receiving: lz_receive.rs handles incoming messages from other chains
  3. Token Management:

    • Minting: mint_to.rs handles token creation
    • Authority Management: set_mint_authority.rs controls minting permissions
  4. Administrative Functions:

    • Various files in instructions/ handle admin operations like setting peers and enforcing options

4. LayerZero Integration

Unlike the Ethereum version which inherits from an OApp Standard, the Solana program directly interacts with the LayerZero Endpoint:

5. Testing

The 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.