Skip to content

rounceydev/evm-rwa-treasury-tokenization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

EVM RWA Treasury Tokenization

A complete Solidity-based Real-World Asset (RWA) treasury tokenization protocol inspired by Ondo Finance's OUSG tokenized short-term US Treasuries product. This protocol enables tokenization of off-chain treasury assets with yield accrual, compliance features, and upgradeable architecture.

πŸ“‹ Table of Contents

✨ Features

Core Functionality

  • Yield-Bearing Tokens: Two token models:
    • OUSG-style (Appreciating): Token balance stays fixed, price/NAV increases over time to reflect yield
    • rOUSG-style (Rebasing): Token price stays ~$1, balances increase daily to reflect yield accrual
  • Minting & Redemption: Permissioned minting when off-chain assets are deposited, redemption with off-chain payout signaling
  • Yield Accrual: Configurable APY (default 4%) with daily/periodic yield updates
  • Compliance: Whitelist/blacklist functionality for KYC/AML compliance
  • Access Control: Role-based access control (MINTER, REDEEMER, PAUSER, ORACLE, ADMIN)
  • Upgradeability: UUPS proxy pattern for implementation upgrades
  • Pausability: Emergency pause functionality for all operations

Technical Features

  • Price Oracle: Mock oracle for NAV/price updates (production-ready for Chainlink integration)
  • Transfer Restrictions: Enforceable whitelist/blacklist on transfers
  • Gas Optimized: Efficient storage and computation patterns
  • Security: Reentrancy guards, access control, overflow protection

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Users / Investors                        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
                     β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              UUPS Proxy (TreasuryToken)                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚         Implementation Contract                     β”‚  β”‚
β”‚  β”‚  - mint() / redeem()                                β”‚  β”‚
β”‚  β”‚  - yield accrual                                    β”‚  β”‚
β”‚  β”‚  - whitelist/blacklist                              β”‚  β”‚
β”‚  β”‚  - pause/unpause                                    β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚              β”‚              β”‚
       β–Ό              β–Ό              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Price Oracle β”‚ β”‚ Access Controlβ”‚ β”‚ MockUSDC     β”‚
β”‚  (NAV/Price) β”‚ β”‚   (Roles)     β”‚ β”‚ (Underlying) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Contract Components

  1. TreasuryToken: Main appreciating token (OUSG-style) - balance fixed, price increases
  2. RebasingTreasuryToken: Rebasing variant (rOUSG-style) - price fixed, balance increases
  3. TreasuryPriceOracle: Price oracle for NAV updates and yield rate management
  4. MockUSDC: Mock stablecoin for testing mint/redemption flows

Token Models

OUSG-style (Appreciating Token)

  • Token balance remains constant
  • Price/NAV per token increases over time
  • Formula: price = initialPrice * (1 + yieldRate * timeElapsed / 365 days)
  • Users see value appreciation through price increase

rOUSG-style (Rebasing Token)

  • Token price stays constant (~$1)
  • Token balances increase daily via rebasing
  • Formula: balance = scaledBalance * rebaseIndex
  • Users see value appreciation through balance increase

πŸ“ Project Structure

evm-rwa-treasury-tokenization/
β”œβ”€β”€ contracts/
β”‚   β”œβ”€β”€ interfaces/
β”‚   β”‚   β”œβ”€β”€ ITreasuryToken.sol
β”‚   β”‚   └── ITreasuryPriceOracle.sol
β”‚   β”œβ”€β”€ treasury/
β”‚   β”‚   β”œβ”€β”€ TreasuryToken.sol
β”‚   β”‚   └── RebasingTreasuryToken.sol
β”‚   β”œβ”€β”€ oracle/
β”‚   β”‚   └── TreasuryPriceOracle.sol
β”‚   └── mocks/
β”‚       └── MockUSDC.sol
β”œβ”€β”€ scripts/
β”‚   └── deploy.js
β”œβ”€β”€ test/
β”‚   β”œβ”€β”€ TreasuryToken.test.js
β”‚   └── RebasingTreasuryToken.test.js
β”œβ”€β”€ hardhat.config.js
β”œβ”€β”€ helper-config.js
β”œβ”€β”€ package.json
└── README.md

πŸš€ Setup

Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn
  • Git

Installation

  1. Navigate to the project directory:
cd evm-rwa-treasury-tokenization-1/evm-rwa-treasury-tokenization
  1. Install dependencies:
npm install
# or
yarn install
  1. Create a .env file (optional, for testnet deployment):
PRIVATE_KEY=your_private_key_here
SEPOLIA_RPC_URL=https://sepolia.infura.io/v3/your_key
ETHERSCAN_API_KEY=your_etherscan_api_key
  1. Compile the contracts:
npx hardhat compile

πŸ§ͺ Testing

Run the complete test suite:

npx hardhat test

Run specific test files:

npx hardhat test test/TreasuryToken.test.js
npx hardhat test test/RebasingTreasuryToken.test.js

Run tests with gas reporting:

REPORT_GAS=true npx hardhat test

Test Coverage

The test suite covers:

  • βœ… Contract deployment and initialization
  • βœ… Minting and redemption flows
  • βœ… Yield accrual mechanisms
  • βœ… Whitelist/blacklist enforcement
  • βœ… Transfer restrictions
  • βœ… Pausability
  • βœ… Upgradeability (UUPS proxy)
  • βœ… Role-based access control
  • βœ… Edge cases (zero amounts, unauthorized actions, etc.)

🚒 Deployment

Local Network

  1. Start a local Hardhat node:
npx hardhat node
  1. In another terminal, deploy to localhost:
npx hardhat run scripts/deploy.js --network localhost

Testnet Deployment (Sepolia)

  1. Ensure your .env file is configured with:

    • PRIVATE_KEY: Your wallet private key
    • SEPOLIA_RPC_URL: Sepolia RPC endpoint
    • ETHERSCAN_API_KEY: Etherscan API key (for verification)
  2. Deploy to Sepolia:

npx hardhat run scripts/deploy.js --network sepolia
  1. Verify contracts (optional):
npx hardhat verify --network sepolia <CONTRACT_ADDRESS> <CONSTRUCTOR_ARGS>

πŸ“§ Contact

Releases

No releases published

Packages

 
 
 

Contributors