Bonding Curve Research Group Library ๐Ÿ“š
  • About the BCRG
  • About this Library
  • โ™ป๏ธFrom Static to Dynamic Supply Tokens
  • โžฐWhat are Bonding Curves?
  • ๐Ÿ—ƒ๏ธDifferentiating Primary & Secondary AMMs
  • ๐Ÿค–Modeling & Simulating Bonding Curves
  • ๐ŸŽ›๏ธBonding Curve Parameter Matrix & Trade-Off Decisions
    • Initial Supply
    • Initial Reserve
    • Initial Price
    • Reserve Ratio
    • Mint Fee
    • Burn Fee
    • Max Supply
  • โ˜ ๏ธAttack Vectors
    • Liquidations
    • Sandwich trading
    • Front Running
    • Backrunning
    • Solutions
  • ๐Ÿ““Case Studies
    • ๐Ÿค–Aavegotchi
      • Bonding Curve Design
      • Pricing Algorithm
      • Governance and Tokenomics
        • Avegotchi DAO Evoution
    • ๐Ÿ‘ฃCarbon
      • Asymmetric Liquidity
      • Adjustable Bonding Curves
      • Matching, Routing & Arbitrage in AMMs
      • MEV Resistance
    • ๐Ÿ“ˆContinuous Organization (cOrg)
      • cOrg Token Bonding Curve Model
        • The Decentralized Autonomous Trust
        • Bonding Curve Contract Dynamics in Investment and Sale Operations
    • ๐ŸฎCoW Protocol
      • Loss Versus Rebalancing (LVR)
        • Deep dive into Loss-Versus-Rebalancing (LVR)
      • Batch Trading & Function-Maximizing AMMs
      • Implementation - COW AMM
    • โš™๏ธDXDao
      • DXdao Bonding Curve
    • โš“Gyroscope
      • The Gyro Bonding Curve
      • Elliptic Concentrated Liquidity Pools (E-CLP)
      • Gyro Consolidated Price Feeds
        • Consolidated Price Feed Approach
    • ๐Ÿ•‰๏ธOlympus DAO
      • Range Bound Stability
    • ๐Ÿ’ธ Public Goods Token Performance Analysis
  • ๐Ÿ„ Engineering for Resilience with Primary Issuance Markets
  • ๐Ÿ’ปBCRG Github Repos
  • ๐Ÿ“ฝ๏ธBCRG Video Library
  • ๐Ÿ“–Glossary
  • ๐Ÿ”ŽToken Engineering Courses & Resources
Powered by GitBook
On this page
  • Consolidation Mechanism
  • Circuit Breakers
  1. Case Studies
  2. Gyroscope
  3. Gyro Consolidated Price Feeds

Consolidated Price Feed Approach

PreviousGyro Consolidated Price FeedsNextOlympus DAO

Last updated 9 months ago

Gyroscope's oracle system prioritizes trust minimization and failure tolerance. Traditional oracles struggle with verifying off-chain price accuracy on-chain. CPF offers a novel solution by consolidating data from various sources (on-chain and off-chain) and assessing its integrity directly on the blockchain. CPF aims to achieve Chainlink's speed (known for its off-chain medianizing process) while offering fallback mechanisms if Chainlink prices deviate. By evaluating data integrity on-chain, CPF empowers Gyroscope to move away from a singular trusted price feed. CPF's ability to detect potential pricing failures automatically strengthens Gyroscope's existing risk mitigation mechanisms. It offers guardrails against known and unknown oracle vulnerabilities, further solidifying the protocol's security posture.

This oracle design was developed for Gyroscopeโ€™s use case in the Dynamic Stability Mechanism (DSM), which facilitates the minting and redemption capability of Gyroscope stablecoins. Other types of applications may have different oracle design aims, in particular around liveness vs security prioritization.

Data Sources and Security Risks

Let S be a set of on-chain assets referenced by a DeFi protocol. Consider that ETH is an asset in S and that it is has high market liquidity among all assets in S. Denote the true market prices as pi/jp_{i/j}pi/jโ€‹ for the price of asset iโˆˆSiโˆˆS iโˆˆS in terms of asset jโ‰ iโˆˆSโ‹ƒ(USD)j \neq i\in S \bigcup (USD)j๎€ =iโˆˆSโ‹ƒ(USD).

The CPF uses data from the following sources, which provide either estimates of true prices or other information that can indicate if price estimates are wrong

  1. Chainlink Prices:

  • Representation: Denoted as p^i/USDpฬ‚_{i/USD}p^โ€‹i/USDโ€‹ , these are the prices provided by Chainlink for asset iโˆˆSiโˆˆSiโˆˆS

  • Mechanism: Chainlink prices are aggregated off-chain . The relay is verified using signed data from off-chain providers.

  • Security Model:

    • Multisig Trust: Chainlink relies on a trusted multisig (multiple signatures) model where a consensus among several nodes determines the price.

    • Reputation and Incentives: Includes a node reputation system with potential slashing incentives to align nodes with accurate reporting.

  • Risks: The system is robust but still relies on a centralized model of trust through the multisig setup, potentially introducing vulnerabilities if the multisig is compromised.

  1. AMM TWAPs (Time-Weighted Average Prices):

  • Representation: Denoted as โ€‹pi/USDp_{i/USD}pi/USDโ€‹- for assets jโ‰ iโˆˆSj \neq i \in S j๎€ =iโˆˆS.

  • Mechanism: TWAPs provide on-chain price averages over specific durations from AMMs like Uniswap, Balancer, or Curve.

    • Security Model:

      • On-Chain Calculation: TWAPs are calculated on-chain, reducing the need for trusted relays.

      • Manipulability: TWAPs can be manipulated since they are derived from trading volumes over time, and they reflect off-chain prices slowly.

  • Risks: TWAPs can be manipulated through large trades and do not inherently provide USD prices without relying on trusted anchors, such as stablecoins.

  1. Exchange-Signed Prices:

  • Representation: Denoted as โ€‹pห‰i/USDโ€‹\bar{p}_{i/USD}โ€‹pห‰โ€‹i/USDโ€‹- for assets jโ‰ iโˆˆSj\neq i โˆˆ S j๎€ =iโˆˆS.

  • Mechanism: TWAPs provide on-chain price averages over specific durations from AMMs like Uniswap, Balancer, or Curve.\

  • Security Model:

    • On-Chain Calculation: TWAPs are calculated on-chain, reducing the need for trusted relays.

    • Manipulability: TWAPs can be manipulated since they are derived from trading volumes over time, and they reflect off-chain prices slowly.

  • Risks: TWAPs can be manipulated through large trades and do not inherently provide USD prices without relying on trusted anchors, such as stablecoins.

  1. Exchange-Signed Prices:

  • Representation: Denoted as pETH/USDkp^k_{ETH/USD}pETH/USDkโ€‹where kkk represents different exchanges.

  • Security Model:

    • Verified Signatures: Prices are relayed on-chain and verified via signatures from exchanges, avoiding the need for trusted relays.

    • Trusted Counterparties: Relies on exchanges as trusted data providers.

  • Risks: The trust is shifted to the data providers (exchanges), so if they are compromised or act maliciously, the price data can be incorrect.

Consolidation Mechanism

The CPF consolidation mechanism combines two types of checks that cross-reference asset prices:

  • Relative price checks: compares information about the price of one asset in S relative to another asset in S. Observing DEX markets is well-suited for this as these pairs can trade on DEXs.

  • Absolute price checks: In the absolute price check, the price of an asset iโˆˆSi โˆˆ SiโˆˆS in terms of an external asset (e.g., USD) is checked for consistency with several independent data sources. This effectively โ€˜groundsโ€™ the mesh of relative price checks. DEXs alone are not well-suited for this as these pairs cannot trade on DEXs.

Circuit Breakers

The CPF system incorporates a series of circuit breakers designed to safeguard the protocol from faulty oracle data and broader risks, such as smart contract vulnerabilities. These circuit breakers act as automatic safety mechanisms to ensure the systemโ€™s integrity.

Flash Crash Circuit Breaker

The flash crash circuit breaker activates the protocol's safety mode if there are sudden, significant changes in the reported oracle prices. This feature is crucial for preventing abrupt market movements from causing instability within the protocol.

  • Mechanism: The circuit breaker monitors the price of an asset px,tp_{x,t}px,tโ€‹ as reported by Chainlink at time ttt. It compares the current price to the price at a previous time.

  • Trigger Condition: The circuit breaker triggers if the price change exceeds a predetermined threshold ฮธx,flash\theta _{x, flash}ฮธx,flashโ€‹ .

Excessive flow rate circuit breaker

In addition to the flash crash circuit breaker, the CPF system includes an excessive flow rate circuit breaker to further safeguard the protocol against extreme anomalies. This mechanism initiates a safety mode, effectively pausing protocol operations over a designated period to protect against both oracle exploits and potential smart contract bugs.

  • Mechanism: The Gyroscope protocol's Excessive Flow Rate Circuit Breaker watches for abnormally fast asset movements. It tracks recent flows using an exponential moving sum and triggers a block or safety mode if thresholds are crossed. This

  • Safeguards against exploits and bugs by pausing operations during suspicious activity.

  • Trigger Conditions: The circuit breaker triggers when asset flows exceed a preset limit, blocking the transaction to prevent large losses. If flows are less severe but still above another threshold, the transaction is allowed but the system enters safety mode to mitigate risks by pausing certain operations. This protects the Gyroscope protocol from exploits and bugs by reacting to abnormal minting and redemption activity of its stablecoins.

Oracle guardian mechanism

The Gyroscope protocol prioritizes security with a robust safety mode. This two-layered defense system safeguards against exploits and bugs by pausing operations when necessary.

  • Mechanism: The Gyroscope protocol implements a safety mode mechanism with two layers of defense. A DAO-elected whitelist of oracle guardians can initiate safety mode for a defined period, offering a manual pause function in case of emergencies like oracle failures or suspected smart contract bugs. The DAO has the authority to update the guardian list at any time.

  • Trigger Conditions: The trigger condition for safety mode is two-fold. Ideally, a vigilant oracle guardian would identify a potential issue and initiate safety mode before an exploit occurs. However, if an exploit happens first, the excessive flow rate circuit breaker, which is an automated system monitoring asset movements, will automatically trigger safety mode to prevent further damage. Once safety mode is activated, regardless of the trigger, the oracle guardians have the ability to extend the duration of the pause to allow for further investigation and mitigation efforts.

Mechanism: Prices are like Coinbase or Binance and verified on-chain.

The CPF consolidation mechanism cross-references different types of price information from different sources to determine a likelihood that a set of prices is correct. It takes as input the prices p^i/USDpฬ‚_{i/USD}p^โ€‹i/USDโ€‹ , โ€‹pห‰i/USDโ€‹\bar{p}_{i/USD}โ€‹pห‰โ€‹i/USDโ€‹ & pETH/USDkkp^k_{ETH/USD_k}pETH/USDkโ€‹kโ€‹ for jโ‰ iโˆˆSj\neq i โˆˆ Sj๎€ =iโˆˆS and flags whether the set of prices p^i/USDpฬ‚_{i/USD}p^โ€‹i/USDโ€‹ โˆฃ|โˆฃ iโˆˆSi โˆˆ SiโˆˆSis likely to be correct or not given the consistency of the information available. The mechanism can be calibrated to have high manipulation costs and high Denial of Service (DoS) costs.The consolidation mechanism draws inspiration from the design of the which incorporates a UniswapAnchoredView, while adding a new structure to consolidating information. In the Open Price Feed, the USD price of an asset is reported by an external oracle and, as a sanity check, is not allowed to deviate too far from the USDC price of that asset reported by a TWAP on Uniswap.

High level consolidation structure of CPF vs Uniswap Anchored View
Calculating USD Prices with Relative and Absolute Values
๐Ÿ““
โš“
using a medianizer, then relayed on-chain
signed by off-chain exchanges
Compound Open Price Feed