The Compound II cToken contract is an ERC-20 compliant wrapper that represents a user's supplied balance in a specific market. Unlike a simple rebasing token, the cToken's exchange rate against the underlying asset increases with each block as interest accrues, meaning a user's cToken balance remains static while its redeemable value grows. Integrators must track the exchangeRateStored and exchangeRateCurrent functions to calculate the precise underlying value of a position, rather than relying on the token balance alone. This interface is the canonical integration surface for all legacy Compound markets and remains active, though it has been superseded by the Compound III Comet architecture.

cToken Contract Interface and Integration Guide
Integration Surface for Compound II cTokens
A precise technical definition of the cToken contract interface for teams maintaining integrations with Compound II's non-rebasing, exchange-rate-based token wrapper architecture.
The core operational methods for integrators are mint, redeem, redeemUnderlying, borrow, repayBorrow, repayBorrowBehalf, liquidateBorrow, and transfer. A critical operational detail is that mint is a payable function for ETH markets but requires a prior ERC-20 approve call for token markets. The redeem function accepts a cToken amount, while redeemUnderlying accepts an underlying asset amount, requiring the caller to calculate the required cToken quantity off-chain using the current exchange rate. Failure to account for accrual between transaction simulation and confirmation can lead to failed redemptions. For borrowing, the borrow function's success depends on the account's liquidity, calculated by the Comptroller across all entered markets, not just the target market's collateral.
Governance and risk parameters are enforced by the Comptroller, not the cToken itself. The Comptroller's enterMarkets, exitMarket, getAccountLiquidity, and getHypotheticalAccountLiquidity functions are essential for any integration that assesses borrowing capacity or liquidation risk. The liquidateBorrow function's closeFactor and the Comptroller's liquidationIncentive are set via governance and directly impact liquidation bot profitability. Integrators must monitor AccrueInterest events to update their off-chain position ledgers and listen for PauseGuardian events that can halt mint, redeem, borrow, or liquidateBorrow operations, requiring graceful degradation in user interfaces and automated systems.
Teams maintaining wallets, custodians, or aggregators that interact with cToken markets should audit their integration against the precise mechanics of the exchange rate, the Comptroller's liquidity checks, and the error codes returned by the ErrorReporter contract. Chainscore can perform a targeted review of an existing cToken integration to validate accurate balance tracking, correct transaction construction for all core operations, and robust handling of governance-imposed pauses and parameter changes.
cToken Architecture Quick Facts
Essential facts for teams maintaining or auditing integrations with the Compound II cToken contract interface.
| Area | What changes | Who is affected | Action |
|---|---|---|---|
Balance Tracking | Exchange rate increases per block; balanceOf is not static | Wallets, custodians, exchanges, data teams | Do not poll balanceOf for yield accrual. Use exchangeRateStored and internal accounting. |
Transaction Construction | Mint, redeem, borrow, repayBorrow functions with specific asset handling | Wallet providers, bot operators, aggregators | Verify function selectors and argument encoding against canonical cToken ABI. Test with mainnet fork. |
Event Monitoring | Mint, Redeem, Borrow, RepayBorrow, LiquidateBorrow events emitted | Subgraph indexers, back-end engineers, analytics teams | Confirm event signature hashes and parameter decoding logic. Handle reorgs by finalizing on block confirmations. |
Liquidation Mechanics | liquidateBorrow uses seizeTokens; close factor and incentive vary per market | Searchers, liquidation bot operators, risk teams | Validate collateral seizure logic and profit calculation against live Comptroller parameters. Monitor for parameter changes. |
Interest Rate Model | Utilization-based rate per market; model can change via governance | Risk dashboards, lending integrators, yield aggregators | Monitor governance proposals for interest rate model changes. Update off-chain APY calculations accordingly. |
Comptroller Dependency | All market entry, collateral factor, and pause state managed by Comptroller | All integrators | Do not assume market state is static. Query Comptroller for account liquidity and market status before transaction submission. |
Architectural Status | Compound II is deprecated in favor of Compound III (Comet) | All teams planning new integrations | New integrations should target Comet. Existing cToken integrations require a migration plan. Verify canonical source for deprecation timeline. |
Core Mechanics: Exchange Rate and Interest Accrual
The cToken exchange rate is the fundamental accounting primitive that separates principal from yield in Compound II, and it is the single most important concept for any integrator to model correctly.
Compound's cToken contract uses a non-rebasing ERC-20 wrapper to represent a user's share of a lending pool. When a user supplies an underlying asset, the cToken contract mints a quantity of cTokens determined by the current exchangeRate, which is the ratio of cTokens to the underlying asset. This rate starts at 0.020000 and increases with every state-changing transaction as interest accrues to the pool. The user's cToken balance remains static, but its value in the underlying asset grows over time. This design is the inverse of a rebasing token like stETH; integrators must multiply the static cToken balance by the dynamic exchange rate to display a user's current position, not simply query balanceOf.
The exchangeRate is calculated as (totalCash + totalBorrows - totalReserves) / totalSupply. Interest accrual is triggered by any interaction with the market, which calls accrueInterest to update borrowIndex and allocate reserves. The borrowIndex tracks the accumulated interest for all borrowers since market inception, and each borrower's debt is calculated as their stored accountBorrowIndex principal multiplied by the current borrowIndex. This means a user's debt grows automatically without any per-block updates to their account storage. For integrators, the critical operational implication is that a user's health factor can deteriorate silently between transactions, and accurate off-chain position tracking requires maintaining a local copy of the borrowIndex and exchangeRate to compute real-time values without making an RPC call for every block.
A common integration failure is treating cTokens as 1:1 wrappers or using balanceOf directly for portfolio valuation. Wallets, custodians, and aggregators that display a user's cToken balance without multiplying by the exchange rate will under-report positions, potentially by a significant margin for long-held deposits. Chainscore Labs can audit an existing integration's balance calculation and position-tracking logic to ensure it correctly models the non-rebasing exchange rate and interest accrual mechanics, preventing valuation errors that could lead to incorrect liquidations or financial reporting discrepancies.
Affected Integrators and Systems
Wallets and Custodians
Legacy cToken integrations require precise handling of the non-rebasing exchange rate model. A user's cToken balance remains static while the underlying value accrues through an increasing exchangeRateStored.
Critical actions:
- Do not treat cToken transfers as simple ERC-20 value transfers. The underlying value must be computed at the time of transaction.
- Ensure
balanceOfUnderlyingor manualexchangeRateStoredmultiplication is used for display, not raw token balance. - For custody reconciliation, track the
AccrueInterestevent to update the exchange rate off-chain without per-block RPC calls.
Risk: Displaying raw cToken balances as USD values will under-report user positions and lead to incorrect tax or statement reporting. Chainscore can audit your balance calculation engine for exchange rate accrual accuracy.
Key Integration Workflows
The cToken interface requires precise handling of non-rebasing exchange rates, interest accrual indexing, and ERC-20 wrapping mechanics. These workflows address the most common integration failure points.
Mint and Redeem Flow Construction
Integrators must correctly handle the mint and redeem (or redeemUnderlying) functions, which operate on cToken amounts, not underlying asset amounts. The exchange rate between cTokens and the underlying asset increases each block as interest accrues. A common failure is constructing transactions that attempt to redeem more underlying than the user's cToken balance represents at the current exchange rate. Wallets and custodians should simulate the transaction against the latest block to calculate the precise cToken amount required before submitting. Chainscore can audit transaction construction logic to prevent failed redemptions and user confusion.
Exchange Rate and Balance Tracking
The cToken balance of an address is static unless a transfer, mint, or redeem occurs. To display a user's current underlying balance, integrators must multiply the cToken balance by the current exchangeRateStored, which is updated on every accrueInterest call. Relying on raw cToken balances or stale exchange rates leads to incorrect position displays. Data providers and wallets must index all AccrueInterest events to maintain an accurate off-chain exchange rate history. Chainscore can validate off-chain position engines to ensure interest accrual is correctly factored into displayed balances.
Borrow and Repay with Account Health
Before allowing a borrow, integrators must check the user's shortfall via getAccountLiquidity. A zero shortfall means the action is permitted. Post-borrow, the system must recalculate health to warn users approaching the collateral factor limit. For repayments, integrators must distinguish between repayBorrow (repaying another account) and repayBorrowBehalf (repaying on behalf of an address). Incorrectly calling repayBorrow with the user's own address is a common mistake. Chainscore can review borrow/repay integration logic for correct liquidity checks and error handling.
Liquidation Monitoring and Bot Triggers
Liquidators must monitor getAccountLiquidity for underwater accounts where shortfall is greater than zero. The liquidateBorrow function requires precise calculation of the closeFactor to determine the maximum repayable amount. Bots must also account for the liquidation incentive (collateral discount) to ensure profitability after gas costs. Failing to simulate the state change from accrued interest before checking liquidity is a critical error that causes missed liquidation opportunities. Chainscore can audit liquidation bot logic for economic soundness and gas efficiency under volatile market conditions.
Event Indexing for Complete Position Ledgers
A reliable off-chain position ledger requires indexing canonical events: Mint, Redeem, Borrow, RepayBorrow, LiquidateBorrow, and Transfer. Each event must be decoded with the correct ABI and indexed by user address and market. The AccrueInterest event is critical for updating the exchange rate and borrow index, which are needed to calculate accrued interest without per-block RPC calls. Missing an AccrueInterest event causes compounding errors in displayed APY and user balances. Chainscore can validate indexing logic against mainnet event histories to ensure completeness.
Pause Guardian Integration Handling
Compound markets can be paused by the pause guardian for specific actions: mint, redeem, borrow, transfer, and liquidate. Integrators must monitor ActionPaused events for each market and gracefully disable the corresponding UI functionality. Attempting a paused action results in a revert with a specific error code. Front-ends that fail to check pause status before constructing transactions create a broken user experience and wasted gas. Chainscore can review pause-handling logic as part of an integration resilience assessment to ensure users are informed and transactions are blocked pre-submission.
Integration Risk Matrix
Operational risks and required actions for systems integrating with the legacy cToken contract interface.
| Area | What changes | Who is affected | Action |
|---|---|---|---|
Exchange Rate Mechanics | Non-rebasing balance tracking via exchangeRateStored. BalanceOf remains static while underlying value accrues. | Wallets, Custodians, Exchanges | Verify off-chain balance calculation multiplies cToken balance by exchange rate. Do not rely on balanceOf for underlying value. |
Interest Accrual | Interest indexes update only on state-changing transactions. Stale indexes cause incorrect borrow/supply displays. | Data Teams, Dashboards, Bots | Simulate accrueInterest before reading rates off-chain. Monitor for stale index warnings in position engines. |
Liquidation Interface | liquidateBorrow uses seizeTokens parameter. Incorrect calculation causes TX failure or unprofitable liquidations. | Liquidation Bots, Searchers | Validate close factor and seize token amount against live Comptroller state. Test profit calculation under volatile oracle updates. |
Oracle Dependency | Price oracle updates are external to the cToken contract. Stale or manipulated prices enable bad liquidations. | Risk Teams, Lending Protocols | Monitor oracle staleness and deviation thresholds. Do not assume price validity without secondary validation. |
Pause Guardian | Global or market-specific pauses can halt supply, borrow, or liquidation instantly via Comptroller. | Front-ends, Aggregators, Bots | Subscribe to ActionPaused events. Implement graceful UI degradation and halt bot operations on pause detection. |
Comptroller State | Collateral factors and supply caps are mutable via governance. Silent parameter changes alter risk profiles. | Risk Managers, Governance Participants | Monitor NewCollateralFactor and NewSupplyCap events. Update internal risk models on parameter change detection. |
Event Reorgs | Standard cToken events can be reorganized. Indexers relying on unconfirmed blocks may double-count or miss positions. | Data Engineers, Subgraph Maintainers | Index only from finalized blocks. Implement reorg handling logic for position reconciliation. |
Deprecated Standard | Compound II is feature-frozen. Future governance may deprecate markets or reduce incentives. | All Integrators | Plan migration path to Compound III (Comet). Audit existing cToken integration for compatibility with potential shutdown flows. |
Integration Validation Checklist
A structured checklist for engineering teams to validate the correctness, safety, and reliability of a new or existing integration with the legacy Compound II cToken architecture before production deployment.
What to check: Verify that the off-chain balance calculation correctly uses the exchangeRateStored method from the cToken contract, not the user's raw balanceOf.
Why it matters: cTokens are non-rebasing. The user's balance of cTokens remains static while the underlying value accrues through an increasing exchange rate. Displaying balanceOf directly will show a static number, misrepresenting the user's true position and accrued yield.
Signal of readiness: A unit test demonstrates that after a block is mined with a non-zero supply rate, the calculated underlying balance for a static cToken balance increases. The formula cTokenBalance * exchangeRate / 1e18 is used and matches the balanceOfUnderlying view function on the contract.
Canonical Resources
Use these primary Compound resources to validate cToken ABI behavior, risk controls, governance-driven changes, and live-market assumptions before maintaining or shipping a legacy Compound II integration.
Looking to build on a specific blockchain?
We build smart contracts, DeFi applications, wallets, tokenization platforms, and blockchain infrastructure across the major ecosystems teams choose today. That includes Ethereum, Arbitrum, Optimism, Polygon, Avalanche, Solana, Sui, Aptos, Hedera, Stellar, and NEAR, with support for additional EVM and non-EVM networks based on your product requirements.
EVM ecosystems
- Ethereum
- Arbitrum
- Optimism
- Polygon
- Avalanche
- Cronos

Non-EVM ecosystems
- Solana
- Sui
- Aptos
- Hedera
- Stellar
- NEAR
Additional ecosystems
- Polkadot
- Cosmos
- TON
- Cardano
- Algorand
- Tempo
Also available for Base, appchains, custom EVM networks, and cross-chain product architecture.
Frequently Asked Questions
Common questions from teams maintaining or auditing integrations with the legacy Compound II cToken architecture. Covers exchange rate mechanics, balance tracking, and operational edge cases.
The cToken contract uses a non-rebasing exchange rate model. A user's cToken balance remains static while the exchange rate increases with accrued interest.
Calculation:
underlyingBalance = cTokenBalance * exchangeRateStored() / 10^(18 + underlyingDecimals - 8)
Why it matters: Using balanceOfUnderlying() on-chain is gas-intensive. Off-chain systems must replicate this logic for accurate portfolio display.
Validation signal: Your calculated balance matches the on-chain balanceOfUnderlying() call for a sample address within 1 wei. Discrepancies indicate incorrect decimal handling or stale exchange rate usage.
Delivering blockchain solutions for 5+ years.
We have partnered with 50+ leading DeFi protocols, NFT ecosystems, and fintech innovators to build secure, scalable, and capital-efficient blockchain products.
Selected Partners & Clients
“I've been working with Chainscore Labs for last 3+ years, they've consistently delivered with strong ownership across multiple projects. The team is reliable and detail-oriented.”
How to get started?
If you're looking for blockchain integration, ChainScore Labs has 5+ years of experience helping teams build and integrate exchanges, wallets, smart contracts, tokenization solutions, and protocol-connected products, we can help you choose the right path, integrate securely, and get to production faster. Our team consists of experienced blockchain developers and architects who can help you with your blockchain integration needs.
Exploration & Strategy
Define your product goals and choose the right blockchain architecture for your use case.
Architecture & Design
Design the smart contracts, tokenomics, and security parameters of your system.
Development & Integration
Build and integrate with wallets, oracles, and front-end dApps for a seamless experience.
Security & Launch
Comprehensive audits followed by a risk-managed mainnet deployment to protect your users.
Discover our
blockchain development services.
We build production-grade blockchain solutions for top-tier projects across DeFi and Web3.
Need a blockchain engineering team?
Send the project context and we will respond with next steps, scope questions, and a practical path to delivery.


