[WOOF!] Correlated-Assets Price Oracle (CAPO)

Correlated-Assets Price Oracle (CAPO)

co-authors: @bryancolligan @Gauntlet @AlphaGrowth

Problem

Compound aims to remain a leading choice among crypto lending and borrowing protocols. A significant portion of TVL revolves around LST/LRT tokens. These assets have the potential to significantly enhance protocol liquidity and generate higher fees. However, Compound cannot compete effectively in the high-leverage space due to inherent risks and limitations.

A major concern lies in pricing these correlated assets accurately. Currently, Compound uses an exchange rate price feed for some collateral assets like weETH, fetching prices directly from the token contracts. This method poses risks as the exchange rate can be manipulated, either intentionally or unintentionally, leading to inaccurate valuations. In a worst-case scenario, an inflated exchange rate could enable borrowing against unprofitable liquidation positions, jeopardizing protocol security. This issue was highlighted in a Gauntlet forum discussion.

Solution

To address these risks, we propose implementing a Correlated-Assets Price Oracle (CAPO) for LST and LRT assets. CAPO introduces flexibility to set and enforce limits on the maximum permissible growth of these assets’ yields. By leveraging CAPO, Compound can ensure secure and accurate pricing for correlated assets.

How CAPO Works

Existing Price Feed Flow:

  • Compound Market → Price Feed Wrapper → Underlying Price Feeds (Exchange Rate/Market Rate).

New Price Feed Flow with CAPO:

  • Compound Market → Price Feed Wrapper → CAPO → Underlying Price Feeds (Exchange Rate/Market Rate).

CAPO enhances the price feed flow by introducing safeguards that cap the maximum exchange rate growth, based on predefined parameters:

  1. Snapshot Timestamp: The reference time for the initial exchange rate.
  2. Snapshot Ratio: The initial value of the asset’s exchange rate.
  3. Max Yearly Ratio Growth Percent: The maximum allowable yearly growth rate for the exchange rate.

CAPO Logic

  1. Fetch Asset Price: Retrieve the current exchange rate for the asset.
  2. Compare with Maximum Rate: Check if the exchange rate exceeds the preconfigured maximum rate, calculated dynamically based on the snapshot ratio and allowable growth.
  3. Return Adjusted Price:
    • If the exchange rate exceeds the cap, return the maximum preconfigured rate.
    • Otherwise, return the current exchange rate.

Example Flow

Day 1

  • Snapshot Timestamp: Day 1
  • weETH Ratio: 1.1
  • Max Yearly Ratio Growth Percent: 12%

Day 30

Calculate the maximum permissible rate:

  • Max Monthly Growth: 1% (12% / 12 months)
  • Maximum Preconfigured Rate: 1.1 + (1.1 * 1%) = 1.111

Compare with Current Exchange Rate:

  • If the exchange rate is greater than 1.111, return 1.111.
  • Otherwise, return the current exchange rate.

Parameter Updates

CAPO contracts will be governed by the Compound DAO. Updates to parameters such as the snapshot timestamp, ratio, or growth percent will require an on-chain governance proposal.

Scope

To implement CAPO, we propose the following deliverables:

  1. CAPO Contracts:
    • Develop CAPO implementations for various ETH and stable markets.
    • Supported assets include ezETH, wstETH, weETH, rsETH, osETH, rETH, rswETH, ETHx, sFRAX, wUSDM, and mETH.
    • Start with the Mainnet, but also cover all other networks LSTs/LRTs
  2. Price Feed Wrappers:
    • Integrate CAPO with price feed wrappers to replace existing feeds.
  3. On-Chain Proposal:
    • Submit a governance proposal to update the price feeds in the protocol.

Benefits of CAPO

  1. Mitigates Risks: Protects against misconfigured or manipulated exchange rates.
  2. Improves Flexibility: Enables governance to set dynamic and precise growth limits.
  3. Enhances Security: Ensures liquidations remain profitable, maintaining protocol integrity.
  4. Supports Growth: Safely integrates correlated assets to increase TVL and protocol fees.

By adopting CAPO, Compound can address current limitations while securely expanding support for LST and LRT assets, strengthening its position as a leading DeFi protocol.

5 Likes

@dmitriywoofsoftware Thank you for putting this together. This should help Compound be more competitive with Higher Collateral Factors with less risk after implementation.

5 Likes

Thanks a lot for sharing the solution @dmitriywoofsoftware ! Eager to collaborate and help in implementing higher collateral factors as a competitive edge for Compound.

2 Likes

CAPO: Development Update

Executive Summary

Following our comprehensive positive community engagement, we’re excited to announce that CAPO implementation is entering its final phase.

Overview

We strongly believe that the OEV discussion will be closed shortly with a chosen direction. OEV update will require updates to the price feed. To make OEV and CAPO integrations efficient, we suggest combining the integration and governance processes.

Scope
Full CAPO implementation across 4626-assets; LST and LRT assets will be supported in CAPO v2 scope.

What CAPO Delivers
CAPO addresses a critical gap in securecollateral utilization by implementing sophisticated rate growth controls that protect against exchange rate manipulation while preserving organic yield growth:

Core Protection Mechanisms:

  • Snapshot-Based Rate Capping: Implements PriceCapSnapshot structure with configurable snapshot ratios, timestamps, and maximum yearly growth percentages expressed in basis points
  • Dynamic Maximum Ratio Calculation: Real-time computation using snapshotRatio + (maxRatioGrowthPerSecond * elapsed_time) / GROWTH_RATIO_SCALE with linear growth approximation
  • ERC4626 Integration: Native support through IERC4626.convertToAssets() calls for accurate share-to-asset ratio retrieval
  • Manager-Controlled Governance: Timelock-compatible manager role enabling DAO control over snapshot updates and growth parameters
  • Chainlink Compatibility: Seamless integration maintaining AggregatorV3Interface standard with latestRoundData() implementation

Supported Assets: all 4626 assets

Implementation Benefits

Enhanced Protocol Security:

  • Eliminates exchange rate manipulation vectors that could compromise liquidation profitability
  • Protects against flash loan attacks targeting correlated asset pricing
  • Maintains protocol solvency during market volatility

Improved Market Competitiveness:

  • Enables higher leverage ratios for 4626-assets markets through reduced risk exposure
  • Supports protocol TVL growth by safely integrating high-demand correlated assets
  • Provides governance with precise tools for risk parameter optimization

Technical Robustness:

  • Professional Security Review: The first implementation underwent comprehensive security audit by OpenZeppelin with identified findings addressed and remediation completed. Re-audit requested for final validation of the current version.
  • Precision Engineering: Advanced decimal scaling mechanisms through rescaleFactor calculations ensuring accurate price computations across varying token decimal configurations
  • Overflow Protection: Built-in mathematical safeguards preventing overflow conditions with three-year growth validation limits
  • Growth Rate Controls: BASIS_POINTS (1e4) precision for yearly growth percentages with GROWTH_RATIO_SCALE (1e10) for per-second calculations
  • Parameter Validation: Comprehensive input validation including zero-address checks, ratio validation, and timestamp constraints

Example Protection Scenarios

Scenario 1: Legitimate Growth Tracking

  • Asset experiences 8% annual growth over 120 days (~2.63% growth)
  • CAPO correctly allows rate progression: 1.000 → 1.025

Scenario 2: Spike Prevention

  • Manipulated rate attempts 8% spike in 10 days (20% annual equivalent)
  • CAPO caps rate at legitimate growth level: 1.080 → 1.0055

Next Steps

  • Security Audit Completion: OpenZeppelin security audit report.
  • Final integration testing and parameter validation across supported networks
  • Governance proposal preparation for parameter initialization and price feed activation (Will be done during OEV on-boarding)
  • Providing risk recommendations by Gauntlet
  • On-chain infrastructure preparations in the most efficient way by WOOF!
  • Analytics tool & with notification for new price feeds monitoring

Community Engagement

We encourage community members to review the original CAPO proposal and prepare for the upcoming governance discussions regarding initial parameter settings. Your feedback continues to be invaluable as we strengthen Compound’s position.
For technical inquiries or implementation feedback, please engage through this community discussion.

2 Likes