Skip to content

codiiman/Solana-RWA-Treasury-Tokenization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solana RWA Treasury Tokenization

Anchor Solana Rust Token-2022 RWA

A production-grade Solana smart contract system for Real World Asset (RWA) treasury tokenization, inspired by leading protocols like Ondo Finance's tokenized U.S. Treasuries products. This implementation enables tokenization of U.S. Treasury-backed assets (or similar short-duration government securities) into on-chain yield-bearing tokens with institutional-grade features.

Overview

This project implements a complete smart contract system that tokenizes U.S. Treasury-backed assets into yield-bearing tokens on Solana. It supports:

  • Permissioned Minting/Redemption: Controlled by off-chain attestation from custodians
  • Yield Accrual: Automatic interest accrual based on treasury yields
  • NAV-Based Pricing: Net Asset Value calculations for accurate token pricing
  • Token-2022 Compliance: Transfer restrictions, whitelisting, and KYC/AML capabilities
  • Oracle Integration: Pyth oracle support for yield rates and NAV updates
  • Institutional Features: Admin controls, pause functionality, and protocol fees

Features

Core Functionality

  • Permissioned Minting: Mint new tokens when underlying assets are deposited (requires attester signature)
  • Permissioned Redemption: Redeem tokens for underlying assets (requires attester authorization)
  • Automatic Yield Accrual: Continuous yield accrual based on treasury yield rates
  • NAV Calculation: Real-time Net Asset Value per token calculation
  • Protocol Fees: Configurable fees on mint/redeem operations

Compliance & Access Control

  • Token-2022 Extensions: Full support for Token-2022 program features
  • Transfer Hooks: Compliance enforcement via transfer hook program
  • Whitelist/Blacklist: Account-level access control
  • Compliance State Management: Enable/disable compliance checks dynamically

Oracle Integration

  • Yield Rate Oracle: Pyth oracle integration for treasury yield rates
  • NAV Oracle: Optional Pyth oracle for NAV/price feeds
  • Oracle Staleness Checks: Configurable staleness thresholds

Admin & Security

  • Pause/Unpause: Emergency pause functionality
  • Admin Controls: Configurable protocol parameters
  • Attester Management: Off-chain custodian/attester authority
  • Event Emission: Comprehensive event logging for indexers

Architecture

Account Structure

┌─────────────────────────────────────────────────────────────┐
│                    GlobalConfig (PDA)                       │
│  - Admin authority                                          │
│  - Protocol fee settings                                     │
│  - Pause state                                              │
│  - Min mint/redeem amounts                                  │
│  - Oracle staleness threshold                               │
└─────────────────────────────────────────────────────────────┘
                            │
                            ▼
┌─────────────────────────────────────────────────────────────┐
│                 TokenVaultState (PDA)                        │
│  - RWA token mint (Token-2022)                              │
│  - Total supply & underlying assets                         │
│  - NAV per token (scaled by 1e9)                            │
│  - Current yield rate                                       │
│  - Last yield accrual timestamp                             │
│  - Oracle accounts                                          │
│  - Attester authority                                       │
└─────────────────────────────────────────────────────────────┘
                            │
                            ▼
┌─────────────────────────────────────────────────────────────┐
│                ComplianceState (PDA)                         │
│  - Compliance enabled/disabled                               │
│  - Whitelist/blacklist mode                                 │
│  - Account list counts                                       │
└─────────────────────────────────────────────────────────────┘
                            │
                            ▼
┌─────────────────────────────────────────────────────────────┐
│              AccountList (PDA per list type)                 │
│  - Whitelist accounts (max 100)                             │
│  - Blacklist accounts (max 100)                             │
└─────────────────────────────────────────────────────────────┘

Installation

Prerequisites

  • Rust 1.70+
  • Solana CLI 1.18.0+
  • Anchor 0.30.0+
  • Node.js 18+ and Yarn

Setup

  1. Clone the repository
git clone <repository-url>
cd Solana-RWA-Treasury-Tokenization-1
  1. Install dependencies
yarn install
  1. Build the program
anchor build
  1. Run tests
anchor test

Project Structure

Solana-RWA-Treasury-Tokenization-1/
├── Anchor.toml
├── package.json
├── tsconfig.json
├── README.md
├── programs/
│   ├── solana-rwa-treasury-tokenization/
│   │   ├── Cargo.toml
│   │   └── src/
│   │       ├── lib.rs                 # Main program entry point
│   │       ├── state.rs               # Account structs
│   │       ├── errors.rs              # Custom error types
│   │       ├── events.rs              # Event definitions
│   │       ├── utils.rs               # Utility functions (yield accrual)
│   │       └── instructions/
│   │           ├── mod.rs
│   │           ├── initialize.rs
│   │           ├── mint.rs
│   │           ├── redeem.rs
│   │           ├── update_yield_oracle.rs
│   │           ├── pause.rs
│   │           ├── update_compliance.rs
│   │           ├── add_to_list.rs
│   │           ├── remove_from_list.rs
│   │           └── accrue_yield.rs
│   └── rwa-transfer-hook/
│       ├── Cargo.toml
│       └── src/
│           └── lib.rs                  # Transfer hook program
└── tests/
    └── solana-rwa-treasury-tokenization.ts

Support

Releases

No releases published

Packages

No packages published