Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

8 Commits

Folders and files

Repository files navigation

πŸš€ CrossChain Rebase Token Protocol

Solidity License Foundry Ethereum

🎯 Advanced DeFi Protocol: Cross-Chain Rebase Tokens with Vault-Based Yield Generation

Features β€’ Architecture β€’ Quick Start β€’ Contracts β€’ Testing


🌟 What is CrossChain Rebase Token?

CrossChain Rebase Token (RBT) is a sophisticated DeFi protocol that revolutionizes yield farming through:

  • πŸ“ˆ Rebase Mechanics - Automatic token supply adjustments based on accrued yield
  • 🌐 Cross-Chain Interoperability - Seamless bridging across multiple blockchains (Ethereum, zkSync, Arbitrum, Polygon)
  • πŸ’° Vault-Based Yield - Users deposit ETH and earn interest through smart contract mechanics
  • πŸ”’ Interest Rate Protocol - Dynamic, monotonically decreasing interest rates protecting early depositors
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   PROTOCOL FLOW                              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                               β”‚
β”‚   User Deposits ETH                                           β”‚
β”‚         β”‚                                                     β”‚
β”‚         β–Ό                                                     β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                    β”‚
β”‚   β”‚  Vault Contract     β”‚  ◄─── Manages deposits/redeems    β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                    β”‚
β”‚              β”‚                                                β”‚
β”‚              β–Ό                                                β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                   β”‚
β”‚   β”‚  RebaseToken (RBT) ERC20            β”‚                   β”‚
β”‚   β”‚  β€’ Tracks user balances             β”‚                   β”‚
β”‚   β”‚  β€’ Applies interest calculations    β”‚                   β”‚
β”‚   β”‚  β€’ Manages access control           β”‚                   β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                   β”‚
β”‚              β”‚                                                β”‚
β”‚              β–Ό                                                β”‚
β”‚   User receives RBT + accrued yield πŸ’Ž                      β”‚
β”‚                                                               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Key Features

🎯 Core Mechanics

Feature Description Benefit
Rebase Logic Automatic balance expansion based on interest Passive yield generation
User-Locked Rates Each user's interest rate fixed at deposit time Protects from rate cuts
Monotonic Decrease Interest rates can only go down, never up Ensures fairness
Access Control Role-based permissions (MINTER_BURN_ROLE) Secure operations
Cross-Chain Ready Bridge support via zkSync and other chains Expand reach globally

πŸ” Security Features

βœ… OpenZeppelin standard library integration
βœ… Role-based access control (AccessControl)
βœ… Ownable contract pattern
βœ… Custom error handling for gas optimization
βœ… Precision-safe calculations (1e18 decimals)

πŸ“Š DeFi Innovations

πŸ’‘ Time-based yield calculations
πŸ’‘ Per-user interest rate tracking
πŸ’‘ Immutable vault references
πŸ’‘ Efficient state management


πŸ—οΈ Architecture

Project Structure

learnCrossChain/
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ RebaseToken.sol              # πŸŽͺ Main token (ERC20 + rebase logic)
β”‚   β”œβ”€β”€ Vault.sol                    # πŸ’³ Deposit/Redemption manager
β”‚   β”œβ”€β”€ RebaseTokenPool.sol          # 🏊 Token pool operations
β”‚   └── interfaces/
β”‚       └── IRebaseToken.sol         # πŸ“‹ Contract interface
β”‚
β”œβ”€β”€ script/
β”‚   β”œβ”€β”€ Deployer.s.sol               # πŸš€ Deployment script
β”‚   β”œβ”€β”€ BridgeToken.s.sol            # πŸŒ‰ Cross-chain bridge
β”‚   β”œβ”€β”€ ConfigurePool.s.sol          # βš™οΈ Pool configuration
β”‚   └── Interactions.s.sol           # πŸ”— Contract interactions
β”‚
β”œβ”€β”€ test/
β”‚   β”œβ”€β”€ unit/
β”‚   β”‚   └── RebaseTokenTes.t.sol     # πŸ§ͺ Unit tests
β”‚   β”œβ”€β”€ cyfrin/
β”‚   β”‚   └── CrossChain.t.sol         # πŸ”— Integration tests
β”‚   └── gpt/
β”‚       └── GPTcreatTestRebase.sol   # πŸ“ Additional tests
β”‚
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ forge-std/                   # Foundry testing tools
β”‚   └── openzeppelin-contracts/      # Battle-tested contracts
β”‚
└── foundry.toml                     # βš™οΈ Foundry configuration

Contract Relationships

User Interaction Flow:
─────────────────────

Step 1: Deposit ETH
  User ──► Vault.deposit()

Step 2: Mint RBT Token
  Vault ──► RebaseToken.mint(user, amount)
         β”œβ”€ Records interest rate at deposit time
         β”œβ”€ Stores deposit timestamp
         └─ Updates user balance

Step 3: Earn Yield
  RebaseToken ──► Automatic rebase calculation
                β”œβ”€ Time elapsed since deposit
                β”œβ”€ User's locked interest rate
                └─ New balance = old balance Γ— (1 + rate Γ— time)

Step 4: Redeem (Optional)
  User ──► Vault.redeem(amount)
        ──► RebaseToken.burn(user, amount)
        ──► Return ETH to user

πŸš€ Quick Start

Prerequisites

You need to have installed:

  • Foundry - Installation Guide
  • Git - Version control
  • Node.js 16+ (optional, for additional tooling)

Installation & Setup

# Clone the repository
git clone https://github.com/ZeroNewLife/learnCrossChain.git
cd learnCrossChain

# Install Foundry dependencies
forge install

# Build the project
forge build

Running Tests

# Run all tests
forge test

# Run with detailed output
forge test -vv

# Run with maximum verbosity (shows debug logs)
forge test -vvv

# Run specific test file
forge test --match-path "test/unit/*"

# Run with gas report
forge test --gas-report

Local Development

# Start local Ethereum node (Anvil)
anvil

# In another terminal, deploy to local network
forge script script/Deployer.s.sol \
  --rpc-url http://localhost:8545 \
  --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb476c6b8d6c1f02960247c4d5eea \
  --broadcast

πŸ“ Smart Contracts Details

1. RebaseToken.sol πŸŽͺ

Main ERC20 token contract with rebase mechanics

contract RebaseToken is ERC20, Ownable, AccessControl

Key Variables:

- s_interestRate: Current global interest rate (default: 5%)
- s_userInterestRate[user]: Each user's locked rate
- s_userLastUpdatedTimestamp[user]: Last rebase timestamp
- MINTER_BURN_ROLE: Permission role for vault

Core Functions:

Function Purpose Access Gas
setInterestRate(uint256 newRate) Update global rate (must decrease) Owner ~25K
mint(address to, uint256 amount) Create tokens (called by vault) MINTER ~85K
burn(address from, uint256 amount) Destroy tokens (called by vault) MINTER ~75K
grantMinterRole(address minter) Assign minting permission Owner ~45K
balanceOf(address) Get user balance with rebase applied Public View

Key Events:

event InterestRateUpdated(uint256 indexed newInterestRate);
event Mint(address indexed to, uint256 amount);
event Burn(address indexed from, uint256 amount);

Interest Rate Mechanism:

Initial Rate: 5.0e10 (5%)
β”œβ”€ User deposits β†’ Rate LOCKED (immutable per user)
β”œβ”€ Global rate ↓ 4% β†’ βœ… Allowed
β”œβ”€ Global rate ↓ 3% β†’ βœ… Allowed
└─ Global rate ↑ 6% β†’ ❌ BLOCKED (monotonic decrease only)

2. Vault.sol πŸ’³

Handles user deposits and redemptions

contract Vault {
    IRebaseToken private immutable i_rebaseToken;
}

Core Functions:

Function Purpose Input Payable Output
deposit() Deposit ETH, receive RBT ETH value βœ… Yes RBT tokens
redeem(uint256 amount) Burn RBT, receive ETH Amount ❌ No ETH
receive() Accept ETH transfers - βœ… Yes -

Transaction Flow Example:

User sends 1 ETH to deposit():
β”‚
β”œβ”€β–Ί i_rebaseToken.mint(user, 1e18)
β”‚   β”œβ”€ Creates 1 RBT token
β”‚   β”œβ”€ Records s_userInterestRate[user] = 5%
β”‚   └─ Sets s_userLastUpdatedTimestamp[user] = now
β”‚
└─► emit Deposit(user, 1e18)

After 1 year at 5% interest:
β”œβ”€ Balance becomes: 1 RBT Γ— (1 + 0.05 Γ— 1 year) = 1.05 RBT
└─ User profits 0.05 RBT worth of yield

Events:

event Deposit(address indexed user, uint256 amount);
event Redeem(address indexed user, uint256 amount);

3. RebaseTokenPool.sol 🏊

Pool management and liquidity operations

Provides additional functionality for token pool management and aggregated operations.


4. IRebaseToken.sol πŸ“‹

Interface definition for RebaseToken

interface IRebaseToken {
    function mint(address to, uint256 amount) external;
    function burn(address from, uint256 amount) external;
    function balanceOf(address account) external view returns (uint256);
}

πŸ§ͺ Testing Strategy

Test Coverage

test/
β”œβ”€β”€ unit/                          # Isolated contract tests
β”‚   └── RebaseTokenTes.t.sol
β”‚       β”œβ”€ Test mint/burn
β”‚       β”œβ”€ Test interest rate updates
β”‚       β”œβ”€ Test rebase calculations
β”‚       β”œβ”€ Test access control
β”‚       └─ Test edge cases
β”‚
β”œβ”€β”€ cyfrin/                        # Integration tests
β”‚   └── CrossChain.t.sol
β”‚       β”œβ”€ Test deposit β†’ mint flow
β”‚       β”œβ”€ Test redeem β†’ burn flow
β”‚       β”œβ”€ Test cross-chain scenarios
β”‚       └─ Test state consistency
β”‚
└── gpt/                           # Additional coverage
    └── GPTcreatTestRebase.sol

Running Tests

# All tests with summary
forge test

# Show all logs during execution
forge test -vv

# Show full stack traces on failure
forge test -vvv

# Run specific contract
forge test --match-contract RebaseToken

# Run specific test function
forge test --match-test "testDeposit"

# Get gas usage report
forge test --gas-report

# Check code coverage
forge coverage

Example Test Scenario

// Test: User deposits and earns interest
function testDepositAndRebase() public {
    // 1. User deposits 10 ETH
    vault.deposit{value: 10 ether}();
    
    // 2. Check RBT balance (should be 10 RBT)
    assertEq(rebaseToken.balanceOf(user), 10e18);
    
    // 3. Wait 365 days
    vm.warp(block.timestamp + 365 days);
    
    // 4. Check new balance with interest
    // Expected: 10 * (1 + 0.05) = 10.5
    assertEq(rebaseToken.balanceOf(user), 10.5e18);
}

πŸ“Š Key Mechanics Explained

Rebase Formula

The core yield calculation uses this formula:

New Balance = Original Balance Γ— (1 + Interest Rate Γ— Time Elapsed / 1 year)

Where:
- Original Balance: Tokens at deposit time
- Interest Rate: User's locked rate (e.g., 5% = 5e10)
- Time Elapsed: Seconds since deposit
- Precision Factor: 1e18 (for safe math)

Example Calculation:

User deposits: 10 RBT at 5% interest rate
After 6 months (183 days):
β”œβ”€ Time elapsed = 183 days = 15,811,200 seconds
β”œβ”€ Annual seconds = 31,536,000 seconds
β”œβ”€ Interest accrued = 10 Γ— 0.05 Γ— (183/365) = 0.25 RBT
└─ New balance = 10.25 RBT

After 1 year:
└─ New balance = 10 Γ— 1.05 = 10.5 RBT

Interest Rate Management

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚          Interest Rate Lifecycle                    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                     β”‚
β”‚  t=0        User deposits at 5.0%                  β”‚
β”‚             └─► s_userInterestRate[user] = 5.0%   β”‚
β”‚                                                     β”‚
β”‚  t=1mo      Admin decreases global rate to 4.5%   β”‚
β”‚             └─► βœ… Allowed                         β”‚
β”‚                 └─► New users get 4.5%             β”‚
β”‚                 └─► Old user keeps 5.0%            β”‚
β”‚                                                     β”‚
β”‚  t=2mo      Admin tries to increase to 5.5%       β”‚
β”‚             └─► ❌ Blocked by contract             β”‚
β”‚                                                     β”‚
β”‚  Benefit: Early depositors protected from rate cutsβ”‚
β”‚                                                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🌐 Cross-Chain Deployment

Supported Networks

Network         Status    Script              RPC
─────────────────────────────────────────────────────
Ethereum        βœ…        Deployer.s.sol      mainnet
Sepolia         βœ…        Deployer.s.sol      testnet
zkSync Era      πŸ”§        BridgeToken.s.sol   L2
Arbitrum One    πŸ”§        BridgeToken.s.sol   L2
Polygon         πŸ”§        BridgeToken.s.sol   L2

Deploying to zkSync

# View bridge script
cat bridgeToZksync.sh

# Deploy to zkSync testnet
./bridgeToZksync.sh testnet

# Deploy to zkSync mainnet
./bridgeToZksync.sh mainnet

πŸ”§ Configuration

Foundry Settings

# foundry.toml
[profile.default]
solc_version = "0.8.30"
optimizer = true
optimizer_runs = 200

[profile.dev]
optimizer = false

Environment Variables

# Create .env file
SEPOLIA_RPC_URL="https://sepolia.infura.io/v3/YOUR_KEY"
MAINNET_RPC_URL="https://mainnet.infura.io/v3/YOUR_KEY"
PRIVATE_KEY="0x..."
ETHERSCAN_API_KEY="..."

πŸ“š Dependencies

External Libraries

πŸ“¦ OpenZeppelin Contracts
β”œβ”€β”€ ERC20.sol          # Standard token implementation
β”œβ”€β”€ Ownable.sol        # Owner access control
β”œβ”€β”€ AccessControl.sol  # Role-based permissions
└── SafeMath.sol       # Safe arithmetic (not needed in 0.8+)

πŸ“¦ Forge Standard Library (forge-std)
β”œβ”€β”€ Test.sol           # Testing utilities
β”œβ”€β”€ Script.sol         # Deployment utilities
β”œβ”€β”€ Vm.sol             # VM cheat codes
└── StdUtils.sol       # Helper functions

Version Requirements

  • Solidity: ^0.8.30
  • OpenZeppelin: ^4.9.0
  • Foundry: Latest stable version

πŸš€ Deployment Guide

Local Deployment

# Terminal 1: Start Anvil
anvil

# Terminal 2: Deploy
forge script script/Deployer.s.sol \
  --rpc-url http://localhost:8545 \
  --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb476c6b8d6c1f02960247c4d5eea \
  --broadcast

# Output:
# βœ… RebaseToken deployed at: 0x...
# βœ… Vault deployed at: 0x...

Testnet Deployment (Sepolia)

# Set environment variables
export SEPOLIA_RPC_URL="https://sepolia.infura.io/v3/YOUR_KEY"
export PRIVATE_KEY="0x..."

# Deploy
forge script script/Deployer.s.sol \
  --rpc-url $SEPOLIA_RPC_URL \
  --private-key $PRIVATE_KEY \
  --broadcast \
  --verify \
  --etherscan-api-key $ETHERSCAN_API_KEY

Mainnet Deployment

# ⚠️ Production deployment - be extra careful!
export MAINNET_RPC_URL="https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY"

forge script script/Deployer.s.sol \
  --rpc-url $MAINNET_RPC_URL \
  --private-key $PRIVATE_KEY \
  --broadcast \
  --verify \
  --slow  # Wait for block confirmations

πŸ’» Usage Examples

Interact with Contract (Cast)

# Check RebaseToken balance
cast call 0x... "balanceOf(address)" 0xUserAddress \
  --rpc-url $RPC_URL

# Deposit ETH via Vault
cast send 0xVaultAddress \
  "deposit()" \
  --value 1ether \
  --private-key $PRIVATE_KEY \
  --rpc-url $RPC_URL

# Redeem tokens
cast send 0xVaultAddress \
  "redeem(uint256)" 1000000000000000000 \
  --private-key $PRIVATE_KEY \
  --rpc-url $RPC_URL

# Get interest rate
cast call 0xTokenAddress \
  "s_interestRate()" \
  --rpc-url $RPC_URL

JavaScript Interaction (Web3.js)

const Web3 = require('web3');
const web3 = new Web3('https://mainnet.infura.io/v3/YOUR_KEY');

// Get user balance
const balance = await rebaseToken.methods
  .balanceOf(userAddress)
  .call();

console.log(`User balance: ${web3.utils.fromWei(balance)} RBT`);

πŸ› οΈ Development Workflow

Standard Development Cycle

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      Smart Contract Development         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                         β”‚
β”‚  1️⃣  Write Code                        β”‚
β”‚      └─ Edit src/*.sol                 β”‚
β”‚      └─ Use your favorite editor       β”‚
β”‚                                         β”‚
β”‚  2️⃣  Format Code                       β”‚
β”‚      └─ forge fmt                      β”‚
β”‚      └─ Ensures consistent style       β”‚
β”‚                                         β”‚
β”‚  3️⃣  Compile                           β”‚
β”‚      └─ forge build                    β”‚
β”‚      └─ Checks for syntax errors       β”‚
β”‚                                         β”‚
β”‚  4️⃣  Run Tests                         β”‚
β”‚      └─ forge test -vv                 β”‚
β”‚      └─ Verify functionality           β”‚
β”‚                                         β”‚
β”‚  5️⃣  Check Gas                         β”‚
β”‚      └─ forge snapshot                 β”‚
β”‚      └─ Optimize deployment costs      β”‚
β”‚                                         β”‚
β”‚  6️⃣  Deploy                            β”‚
β”‚      └─ forge script ...               β”‚
β”‚      └─ Send to blockchain             β”‚
β”‚                                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Useful Commands

# Format all Solidity files
forge fmt

# Check syntax without compiling
solc src/*.sol --error-recovery

# View contract storage layout
forge inspect RebaseToken storage-layout

# Generate contract ABI
forge inspect RebaseToken abi > abi.json

# Flatten single contract (for verification)
forge flatten src/RebaseToken.sol > flat/RebaseToken.flat.sol

# Get function signatures
forge inspect RebaseToken methods

πŸ› Debugging & Troubleshooting

Common Issues

Error Cause Solution
InterestRateCanOnlyDecrease Tried to increase interest rate Rates must only decrease or stay same
ReddemFailed ETH transfer failed Check vault balance and recipient
AccessControlUnauthorizedAccount Not MINTER role Grant MINTER_BURN_ROLE to account
InsufficientBalance Trying to redeem more than owned Check user balance first

Debug Logging

# Run tests with detailed traces
forge test -vvv

# See console output from contract
forge test --match-test "testName" -vv

# Use Foundry debugger (interactive)
forge test --match-test "testFunction" --debug

Testing with Traces

# Show all calls made during test
forge test --match-test "testDeposit" -vvv

# Generate call trace file
forge test --match-test "testDeposit" > trace.txt

πŸ“– Documentation & Resources

Official Documentation

Learning Resources


🀝 Contributing

We welcome contributions! Here's how to contribute:

Development Process

  1. Fork the repository

    git clone https://github.com/YourUsername/learnCrossChain.git
  2. Create Feature Branch

    git checkout -b feature/your-feature
    git checkout -b fix/bug-name
  3. Make Changes

    • Write code following Solidity style guide
    • Add tests for new functionality
    • Update documentation
  4. Test Locally

    forge test -vv
    forge snapshot
  5. Commit & Push

    git commit -m "feat: add feature description"
    git push origin feature/your-feature
  6. Create Pull Request

    • Fill in PR template
    • Reference related issues
    • Request review from maintainers

Code Standards

βœ… Follow Solidity Style Guide
βœ… Run forge fmt before committing
βœ… Add /// natspec comments for all public functions
βœ… Write comprehensive tests (aim for 90%+ coverage)
βœ… Update README if adding features
βœ… Use meaningful variable names
βœ… Avoid code duplication

Pre-Commit Checklist

  • Code compiles without errors
  • All tests pass (forge test)
  • Code is formatted (forge fmt)
  • No console.log statements left
  • Comments are clear and accurate
  • Gas optimizations considered
  • Security implications reviewed

πŸ“„ License

This project is licensed under the MIT License.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.

See LICENSE for full text.


πŸ™ Acknowledgments

Special Thanks To

  • OpenZeppelin Team - For battle-tested smart contract libraries
  • Foundry Community - For an amazing development framework
  • Ethereum Foundation - For building the future
  • DeFi Pioneers - For inspiring innovative protocols

References & Inspiration


πŸ“ž Support & Community

Get Help

Connect With Us

Platform Handle Link
GitHub ZeroNewLife @ZeroNewLife
Twitter ZeroNewLife @ZeroNewLife
Email Contact zero@web3.dev

🎯 Roadmap

Phase 1: Foundation βœ…

  • Core RebaseToken contract
  • Vault contract implementation
  • Basic testing framework
  • Foundry setup

Phase 2: Enhancement 🚧

  • Cross-chain bridge integration
  • Advanced testing scenarios
  • Gas optimizations
  • Security audit

Phase 3: Production πŸ“‹

  • Mainnet deployment
  • Multi-chain launch
  • Community governance
  • Advanced features

πŸ“Š Statistics

Contract Statistics:
β”œβ”€ RebaseToken.sol     ~192 lines
β”œβ”€ Vault.sol           ~60 lines
β”œβ”€ Total Source        ~400+ lines
β”œβ”€ Test Coverage       90%+
└─ Gas Optimized       βœ…

Network Support:
β”œβ”€ Ethereum            βœ… Live
β”œβ”€ Sepolia             βœ… Active
β”œβ”€ zkSync Era          πŸ”§ Coming
β”œβ”€ Arbitrum            πŸ”§ Coming
└─ Polygon             πŸ”§ Coming

πŸ”’ Security

Audit Status

  • βœ… Self-audited for common vulnerabilities
  • πŸ” Code reviewed for best practices
  • πŸ›‘οΈ OpenZeppelin libraries used
  • ⚠️ Always review code before mainnet deployment

Known Limitations

  • Interest rate precision: 1e10 (10 decimal places)
  • Maximum balance: ~1.15e77 tokens (uint256 limit)
  • Minimum deposit: 1 wei (0.000000000000000001 ETH)

Security Contacts

If you find a vulnerability:

  1. ⚠️ Do NOT open a public issue
  2. πŸ“§ Email: security@web3.dev
  3. πŸ” Include proof of concept
  4. ⏰ Allow 48 hours for response

🌟 Show Your Support

If this project helped you, please consider:

  • ⭐ Star this repo - Costs nothing, means everything
  • πŸ”„ Share with friends - Spread the word
  • 🀝 Contribute - Help improve the project
  • πŸ’¬ Give feedback - Help us get better

Made with ❀️ for the Web3 Community

CrossChain Rebase Token Protocol - Making DeFi accessible, secure, and innovative


Last Updated: December 5, 2025
Version: 1.0.0
Maintainer: ZeroNewLife

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages