A Foundry-based Solidity project that mints yield-bearing rebase tokens for ETH deposits and bridges them across chains with Chainlink CCIP while preserving each user's accrued-interest rate.
- Overview
- How It Works
- Tech Stack
- Repository Layout
- Getting Started
- Environment Variables
- Commands
- CI and Releases
This protocol lets users deposit ETH into a vault and receive a rebase token that represents their underlying position plus linearly accrued interest over time.
The design centers on three ideas:
Vaultaccepts ETH deposits and redemptions.RebaseTokentracks principal balances and lazily realizes accrued interest during user actions.RebaseTokenPoolintegrates Chainlink CCIP so balances can move cross-chain without losing the user's assigned interest rate.
- A user deposits ETH into
Vault. - The vault mints
RebaseTokento the depositor using the protocol's current global interest rate. - Each account keeps its own interest rate snapshot from the moment it enters the system.
- The token balance grows linearly over time and accrued interest is minted when the user interacts with the token.
- When tokens are bridged with CCIP, the pool encodes the user's interest rate in the cross-chain payload and restores it on the destination chain.
- Solidity
0.8.24 - Foundry for build, test, scripting, and formatting
- OpenZeppelin Contracts for ERC-20, ownership, and access control primitives
- Chainlink CCIP and
CCIPLocalSimulatorForkfor cross-chain token pool logic and fork-based testing - GitHub Actions for CI and automated releases with
semantic-release
src/RebaseToken.sol: Core rebase token with user-specific interest rates and lazy interest realizationsrc/Vault.sol: ETH vault that mints and redeems the rebase tokensrc/RebaseTokenPool.sol: Chainlink CCIP token pool used to burn, mint, and preserve interest-rate state across chainssrc/interfaces/IRebaseToken.sol: Shared interface used by the vault and pooltest/RebaseToken.t.sol: Unit tests for deposit, redeem, transfer, and interest-rate behaviortest/CrossChain.t.sol: Fork-based cross-chain bridging tests using Sepolia and Arbitrum Sepolia RPC endpointsscript/Deployer.s.sol: Deployment helpers for token, pool, vault, and token admin configurationscript/ConfigurePool.s.sol: Script for applying remote chain pool configurationscript/BridgeTokens.s.sol: Script for sending tokens through the CCIP router
- Foundry
- Git with submodule support
Clone with submodules:
git clone --recurse-submodules git@github.com:Axeloooo/Cross-Chain-Rebase-Token.gitIf the repository is already cloned:
git submodule update --init --recursiveCross-chain tests use live RPC endpoints for Sepolia and Arbitrum Sepolia forks:
export SEPOLIA_RPC_URL="<your-sepolia-rpc-url>"
export ARBITRUM_SEPOLIA_RPC_URL="<your-arbitrum-sepolia-rpc-url>"When broadcasting deployment scripts, provide the usual Foundry CLI flags such as --rpc-url, --private-key, or --account.
forge build
forge fmt
forge fmt --checkRun the full test suite:
forge test -vvvRun only unit tests:
forge test --match-path test/RebaseToken.t.sol -vvvRun the cross-chain fork test:
SEPOLIA_RPC_URL="$SEPOLIA_RPC_URL" \
ARBITRUM_SEPOLIA_RPC_URL="$ARBITRUM_SEPOLIA_RPC_URL" \
forge test --match-path test/CrossChain.t.sol -vvvDeploy token and pool:
forge script script/Deployer.s.sol:TokenAndPoolDeployer --rpc-url "$SEPOLIA_RPC_URL" --broadcastDeploy the vault:
forge script script/Deployer.s.sol:VaultDeployer --rpc-url "$SEPOLIA_RPC_URL" --broadcast --sig "run(address)" <REBASE_TOKEN_ADDRESS>Configure a remote pool:
forge script script/ConfigurePool.s.sol:ConfigurePoolScript --rpc-url "$SEPOLIA_RPC_URL" --broadcastBridge tokens with CCIP:
forge script script/BridgeTokens.s.sol:BridgeTokenScript --rpc-url "$SEPOLIA_RPC_URL" --broadcast.github/workflows/test.ymlruns formatting checks, builds the contracts, and executes tests in CI..github/workflows/release.ymlrunssemantic-releaseon pushes tomain.- The release workflow now fetches full git history and tags so semantic-release can compute versions from the complete commit and tag graph.