这是indexloc提供的服务,不要输入任何密码
Skip to content

Tyronexx/CrossChain_Rebase_Token

Repository files navigation

🪙 Rebase Token Protocol

Cross-Chain Interest-Bearing Vault System


📘 Overview

Rebase Token Protocol is a cross-chain, interest-bearing system that incentivizes users to deposit ETH into a vault and earn yield through a rebase token.
It integrates Chainlink CCIP to enable seamless bridging of rebase balances between chains while maintaining users’ individualized interest rates.

The system consists of three core contracts:

  • RebaseToken.sol — ERC20-compatible rebase token that grows in balance over time.
  • Vault.sol — Main user-facing contract for depositing and redeeming ETH.
  • RebaseTokenPool.sol — CCIP-compatible pool contract enabling cross-chain token transfers while preserving accrued yield data.

🧩 Contracts 🧠 1. RebaseToken.sol

A custom ERC20 token that automatically accrues interest to user balances.

Key Features

Each user has a personal interest rate based on the global rate at deposit time.

The global interest rate can only decrease to ensure fairness.

Tokens “rebase” — users’ balances grow linearly with time.

Supports cross-chain minting and burning through MINT_AND_BURN_ROLE.

Core Functions Function Description mint(address to, uint256 amount, uint rate) Mints tokens for deposits or cross-chain transfers. burn(address from, uint256 amount) Burns tokens on withdrawal or bridge transfer. balanceOf(address user) Returns balance including accrued interest. setInterestRate(uint newRate) Updates (only decreases) the global interest rate. 🏦 2. Vault.sol

The Vault manages ETH deposits and redemptions for RebaseTokens.

Key Features

Accepts ETH deposits and mints RebaseTokens 1:1.

Burns tokens on redemption and returns ETH.

Supports ETH rewards via the receive() fallback.

Core Functions Function Description deposit() Deposit ETH and mint RebaseTokens. redeem(uint256 amount) Redeem RebaseTokens for ETH. getRebaseTokenAddress() Returns the linked RebaseToken address. 🌐 3. RebaseTokenPool.sol

The CCIP Token Pool connects the protocol across chains. Implements TokenPool from Chainlink to lock and mint tokens across networks while preserving user-specific interest data.

How It Works

On the source chain, lockOrBurn() burns tokens and sends the user’s interest rate to the destination.

On the destination chain, releaseOrMint() mints equivalent tokens using the same interest rate.

Core Functions Function Description lockOrBurn(Pool.LockOrBurnInV1 calldata data) Burns tokens on the source chain before bridging. releaseOrMint(Pool.ReleaseOrMintInV1 calldata data) Mints tokens on the destination chain with the same rate. 🔐 Access Control Role Description Owner Can set global interest rate and grant mint/burn privileges. MINT_AND_BURN_ROLE Allows minting and burning (used by Vault and Pool). 🚀 Deployment Order

Deploy RebaseToken.sol

Deploy Vault.sol, passing the RebaseToken address to its constructor

Deploy RebaseTokenPool.sol, linking CCIP router and RebaseToken

Grant MINT_AND_BURN_ROLE to both Vault and Pool contracts

🧠 Technical Highlights

Interest Calculation: Linear growth per user based on timestamps

Cross-Chain Compatibility: Fully Chainlink CCIP-enabled

AccessControl Security: Role-based mint/burn management

ETH-backed Model: 1:1 mint and burn with ETH reserves

🧪 Example Usage Deposit vault.deposit{value: 1 ether}();

Redeem vault.redeem(type(uint256).max);

Cross-Chain Transfer (simplified)

Burn on Chain A → CCIP message → Mint on Chain B with same interest rate

🧰 Tech Stack

Solidity ^0.8.18 / ^0.8.24

OpenZeppelin Contracts

Chainlink CCIP

Hardhat / Foundry for development & testing

📄 License

MIT License © 2025 Richard Ikenna

About

Rebase token with cross chain capabilities implementation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published