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.
- 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.
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.
- 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
TokenPoolfor 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.
- 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.
- Deposit ETH: User deposits ETH into the Vault, receiving rebase tokens.
- Interest Accrual: User’s token balance increases over time due to interest.
- Transfer: Users can transfer tokens; interest is updated for both parties.
- Redeem: Users can redeem tokens for ETH at any time.
- Cross-Chain Bridge: Users can bridge tokens to another chain; their balance and interest rate are preserved.
script/Deployer.s.sol: Deploys RebaseToken, Vault, and Pool contracts.script/ConfigurePool.s.sol: Configures cross-chain pool connections and rate limiters.script/BridgeTokens.s.sol: Bridges tokens between chains using CCIP.
test/RebaseToken.t.sol: Unit tests for deposit, redeem, transfer, and interest accrual.test/CrossChain.t.sol: Integration tests for cross-chain bridging and state synchronization.
- Deploy the RebaseToken and Pool using
Deployer.s.sol. - Deploy the Vault using
VaultDeployerin the same script. - Configure pools for cross-chain operation using
ConfigurePool.s.sol.
- Deposit ETH into the Vault to receive rebase tokens.
- Redeem tokens from the Vault to withdraw ETH.
- Use
BridgeTokens.s.solto bridge tokens to a remote chain. - The protocol ensures user balances and interest rates are preserved.
- Foundry
- Node.js (for Chainlink/CCIP dependencies)
- Chainlink CCIP local simulator (for cross-chain tests)
forge testUse Foundry’s forge script command to run deployment and configuration scripts.
src/ # Core contracts script/ # Deployment and configuration scripts test/ # Foundry tests lib/ # External dependencies (Chainlink, OpenZeppelin, etc.)
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
For more details, see the contract source files and tests.
# Cross-Chain-Rebase-Token-Protocol