GEB Docs
  • Introduction to GEB
  • Community Resources
  • FLX Mechanics
  • FAQ
  • RAI
    • RAI Use-Cases
    • Multi-chain RAI
    • RAI Integrations
  • The Money God League
    • Intro to The League
  • Ungovernance
    • Governance Minimization Guide
  • Risk
    • GEB Risks
    • PID Failure Modes & Responses
  • Incentives
    • RAI Uniswap V2 Mint + LP Incentives Program
    • RAI Uniswap V3 Mint + LP Incentives Program (Inactive)
    • FLX Staking
    • RAI / ETH Uniswap V3 Oracle LP Incentives Program
  • Contract Variables Translation
    • Core Contracts Naming Transition
    • Governance Contracts Naming Transition
    • SAFE Management Contract Naming Transition
  • System Contracts
    • Core Module
      • SAFE Engine
      • Liquidation Engine
      • Accounting Engine
    • Auction Module
      • English Collateral Auction House
      • Fixed Discount Collateral Auction House
      • Increasing Discount Collateral Auction House
      • Debt Auction House
      • Surplus Auction House
    • Oracle Module
      • Oracle Relayer
      • Medianizer
        • DSValue
        • Governance Led Median
        • Chainlink Median
        • Uniswap V2 Median
      • FSM
        • Oracle Security Module
        • Dampened Security Module
        • FSM Governance Interface
    • Token Module
      • Token Adapters
      • System Coin
      • Protocol Token
      • Protocol Token Authority
      • Protocol Token Printing Permissions
    • Money Market Module
      • Tax Collector
    • Sustainability Module
      • Stability Fee Treasury
      • FSM Wrapper
      • Increasing Treasury Reimbursement
      • Mandatory Fixed Treasury Reimbursement
      • Increasing Reward Relayer
    • Automation Module
      • Collateral Auction Throttler
      • Single Spot Debt Ceiling Setter
      • ESM Threshold Setter
    • Governance Module
      • DSPause
    • Shutdown Module
      • Global Settlement
      • ESM
  • Proxy Infrastructure
    • DSProxy
    • Proxy Registry
  • Helper Contracts
    • SAFE Manager
  • GEB.js
    • Getting Started
    • Global Settlement Guide
    • API Reference
      • Geb
      • Safe
      • Proxy Actions
      • Geb Admin
  • APIs
    • API Endpoints
  • Pyflex
    • Getting Started
      • Configuration
      • GEB Basics
    • SAFE Management
      • Opening a SAFE
      • Closing a SAFE
    • Numerics
  • Keepers
    • Keeper Overview
    • Collateral Auction Keeper
      • Running in Docker
      • Running on a Host
      • Liquidations & Collateral Auctions
      • Collateral Auction Flash Swaps
    • Debt Auction Keeper
      • Running in Docker
      • Running on a Host
    • Staked Token Auction Keeper
      • Running in Docker
      • Running on a Host
    • Surplus Auction Keeper
      • Running in Docker
      • Running on a Host
    • Bidding Models
  • Liquidation Protection
    • SAFE Protection
    • Liquidation Protection Guide
    • Uni-V2 RAI/ETH Savior Details
    • Curve V1 Savior Details
Powered by GitBook
On this page
  • 1. Summary
  • 2. Contract Variables & Functions
  • 3. Walkthrough
  • 4. Gotchas
  • 5. Failure Modes (Bounds on Operating Conditions & External Risk Factors)

Was this helpful?

  1. System Contracts
  2. Oracle Module
  3. Medianizer

Chainlink Median

Chainlink integrated medianizer

PreviousGovernance Led MedianNextUniswap V2 Median

Last updated 2 years ago

Was this helpful?

1. Summary

The ChainlinkPriceFeedMedianizer has a similar interface to the although, instead of relying on governance whitelisted oracles, it simply keeps a reference to a (price aggregator).

2. Contract Variables & Functions

Variables

  • authorizedAccounts [usr: address] - addAuthorization/removeAuthorization/isAuthorized - auth mechanisms

  • staleThreshold - time since linkAggregatorTimestamp after which the median value is considered stale

  • chainlinkAggregator - address of the Chainlink price reference contract

  • rewardRelayer - address of the contract that rewards addresses that call updateResult

  • medianPrice - latest fetched price

  • lastUpdateTime - latest timestamp when the contract pulled a price update from Chainlink

  • multiplier - scaling factor for the Chainlink result (e.g if the price has 8 decimals and we want it to be scaled to 18 decimals, multiplier = 10 and medianPrice = fetchedPrice * 10 ^ multiplier)

  • symbol - the price oracle type (ex: ETHUSD)

  • periodSize - the minimum delay between two consecutive updates after which the reward for updating again starts to increase

  • linkAggregatorTimestamp - the timestamp of the Chainlink aggregator's latest price update

Modifiers

  • isAuthorized **** - checks whether an address is part of authorizedAddresses (and thus can call authed functions).

Functions

  • modifyParameters - allows governance to change contract parameters

  • read() public view returns (uint256) - gets a non-zero price or fails

  • getResultWithValidity() public view returns (uint256,bool) - gets the price and its validity

  • updateResult(feeReceiver: address) - updates the price stored in the contract by calling the Chainlink aggregator

Events

  • AddAuthorization - emitted when a new address becomes authorized. Contains:

    • account - the new authorized account

  • RemoveAuthorization - emitted when an address is de-authorized. Contains:

    • account - the address that was de-authorized

  • ModifyParameters **** - emitted when a parameter is updated

  • UpdateResult - emitted when updateResult is called. Contains:

    • medianPrice - the latest median price

    • lastUpdateTime - timestamp of the call

3. Walkthrough

When reading the latest price feed, the contract also stores the timestamp when the price coming from Chainlink was posted on-chain. The system can incentivize anyone to call updateResult and update the median price regularly using a rewardRelayer.

4. Gotchas

This oracle is entirely dependent on Chainlink. If the Chainlink relayer contract is deprecated the Oracle needs to be updated accordingly.

5. Failure Modes (Bounds on Operating Conditions & External Risk Factors)

If the Chainlink contract is not updated the price will become stale, other contracts reading from it will revert on state changing transactions, effectively freezing the system.

If the price reported by Chainlink is wrong the system will take it as it is, possibily causing unfair liquidations, or preventing liquidations in case of higher prices reported.

Governance Led Median
Chainlink price reference contract