Skip to content

fawarano/Cross-Chain-Rebase-Token-Protocol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cross-Chain Rebase Token Protocol

Overview

This project implements a cross-chain rebase token system using Chainlink CCIP for secure token bridging between EVM-compatible blockchains. The protocol incentivizes users to deposit ETH into a vault, minting rebase tokens that accrue interest over time. The interest rate can only decrease, and each user’s accrued interest is tracked individually. The system supports seamless cross-chain transfers, preserving user balances and interest rates.

Key Features

  • Rebase Token: An ERC20-compliant token with per-user, linearly accruing interest.
  • Vault: Accepts ETH deposits, mints rebase tokens, and allows redemption for ETH.
  • Cross-Chain Pool: Bridges rebase tokens between chains using Chainlink CCIP, preserving user balances and interest rates.
  • Access Control: Only authorized contracts (Vault, Pool) can mint or burn tokens.
  • Interest Rate Management: The owner can decrease (but not increase) the global interest rate.
  • Upgradeable and Modular: Designed for extensibility and integration with Chainlink infrastructure.

Architecture

User <-> Vault <-> RebaseToken <-> RebaseTokenPool <-> Chainlink CCIP <-> Remote RebaseTokenPool <-> Remote RebaseToken <-> Remote Vault <-> Remote User

  • Vault: Handles ETH deposits and redemptions, interacts with the RebaseToken.
  • RebaseToken: ERC20 token with per-user interest accrual.
  • RebaseTokenPool: Bridges tokens cross-chain, synchronizing balances and interest rates.
  • Chainlink CCIP: Provides secure cross-chain messaging and token transfer.

Contracts

  • ERC20 token with per-user interest rates.
  • Interest accrues linearly over time.
  • Only authorized contracts can mint/burn.
  • Transfers update accrued interest for both sender and recipient.
  • Owner can only decrease the global interest rate.
  • Accepts ETH deposits, mints rebase tokens 1:1.
  • Allows users to redeem tokens for ETH.
  • Only the Vault can mint/burn tokens on behalf of users.
  • Extends Chainlink's TokenPool for cross-chain bridging.
  • Handles burning on source chain and minting on destination chain.
  • Transfers user’s interest rate metadata across chains.
  • Interface for the RebaseToken contract.

Cross-Chain Functionality

  • Uses Chainlink CCIP to bridge tokens between chains.
  • When bridging, the user's interest rate is transferred and preserved.
  • Pools are configured to recognize each other as remote pools.
  • All bridging logic is tested in test/CrossChain.t.sol.

How It Works

  1. Deposit ETH: User deposits ETH into the Vault, receiving rebase tokens.
  2. Interest Accrual: User’s token balance increases over time due to interest.
  3. Transfer: Users can transfer tokens; interest is updated for both parties.
  4. Redeem: Users can redeem tokens for ETH at any time.
  5. Cross-Chain Bridge: Users can bridge tokens to another chain; their balance and interest rate are preserved.

Scripts

Testing

Usage

Deploy Contracts

  1. Deploy the RebaseToken and Pool using Deployer.s.sol.
  2. Deploy the Vault using VaultDeployer in the same script.
  3. Configure pools for cross-chain operation using ConfigurePool.s.sol.

Deposit and Redeem

  • Deposit ETH into the Vault to receive rebase tokens.
  • Redeem tokens from the Vault to withdraw ETH.

Bridge Tokens

  • Use BridgeTokens.s.sol to bridge tokens to a remote chain.
  • The protocol ensures user balances and interest rates are preserved.

Development

Prerequisites

  • Foundry
  • Node.js (for Chainlink/CCIP dependencies)
  • Chainlink CCIP local simulator (for cross-chain tests)

Running Tests

forge test

Running Scripts

Use Foundry’s forge script command to run deployment and configuration scripts.

Project Structure

src/ # Core contracts script/ # Deployment and configuration scripts test/ # Foundry tests lib/ # External dependencies (Chainlink, OpenZeppelin, etc.)

Security

Only the contract owner can decrease the interest rate. Only authorized contracts (Vault, Pool) can mint or burn tokens. Cross-chain messages are validated and routed via Chainlink CCIP. Extensibility The protocol can be extended to support additional chains by deploying new pools and configuring them. Interest rate logic can be adapted for more complex accrual models. License MIT

Author: fawarano

For more details, see the contract source files and tests.

# Cross-Chain-Rebase-Token-Protocol

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published