Skip to main content

neo_solana_compat/
lib.rs

1// Copyright (c) 2025 R3E Network
2// Licensed under the MIT License
3
4//! Neo-Solana Compatibility Layer
5//!
6//! This crate provides a Solana-compatible API surface that compiles to WASM
7//! and can be translated to `NeoVM` bytecode via `wasm-neovm`.
8//!
9//! # Usage
10//!
11//! Replace `solana_program` imports with `neo_solana_compat`:
12//!
13//! ```rust,ignore
14//! // Before (Solana)
15//! use solana_program::{account_info::AccountInfo, entrypoint, pubkey::Pubkey};
16//!
17//! // After (Neo-compatible)
18//! use neo_solana_compat::{account_info::AccountInfo, entrypoint, pubkey::Pubkey};
19//! ```
20//!
21//! # Architecture
22//!
23//! The compatibility layer maps Solana concepts to Neo equivalents:
24//!
25//! - **Accounts** → Neo contract storage slots
26//! - **Program IDs** → Neo contract hashes (`UInt160`)
27//! - **Syscalls** → Neo interop services
28//! - **Signatures** → `CheckWitness` verification
29
30#![no_std]
31#![allow(dead_code)]
32
33pub mod account_info;
34pub mod entrypoint;
35pub mod program;
36pub mod program_error;
37pub mod pubkey;
38pub mod syscalls;
39
40pub use account_info::AccountInfo;
41pub use entrypoint::ProgramResult;
42pub use program_error::ProgramError;
43pub use pubkey::Pubkey;
44
45/// Re-export commonly used items
46pub mod prelude {
47    pub use crate::account_info::AccountInfo;
48    pub use crate::entrypoint;
49    pub use crate::entrypoint::ProgramResult;
50    pub use crate::program::invoke;
51    pub use crate::program_error::ProgramError;
52    pub use crate::pubkey::Pubkey;
53}