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. DSM Variations

Was this helpful?

  1. System Contracts
  2. Oracle Module
  3. FSM

Dampened Security Module

An OSM-like contract that bounds price feed changes between consecutive updates

1. Summary

The DSM (Dampened Security Module) is an OSM-like contract that, apart from emposing a delay between prices coming from a medianizer and them being added into the system, it bounds the maximum price change between the currentFeed and the nextFeed. This ensures that in case of an oracle attack or extreme market volatility, governance has more time to react and defend the system.

2. Contract Variables & Functions

Variables

  • authorizedAccounts[usr: address] - addresses allowed to call authed functions.

  • stopped - flag that disables price feed updates if non-zero

  • priceSource - address of the medianizer that the OSM will read from

  • ONE_HOUR - 3600 seconds

  • updateDelay - time delay between updateResult calls; defaults to ONE_HOUR

  • lastUpdateTime - time of last update (rounded down to nearest multiple of updateDelay)

  • newPriceDeviation - max deviation accepted between the current and the next feed

  • currentFeed - Feed struct that holds the current price value

  • nextFeed - Feed struct that holds the next price value

Modifiers

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

Functions

  • addAuthorization/removeAuthorization - add or remove authorized users (via modifications to the authorizedAccounts mapping)

  • stop/start - toggle whether the OSM price feed can be updated (by changing the value of stopped)

  • changePriceSource(source: address) - change data source for prices (by setting priceSource)

  • changeDelay(delay: uint16) - change interval between price updates (by setting updateDelay)

  • changeNextPriceDeviation(deviation: uint256) - change the newPriceDeviation

  • restartValue - similar to stop, except it also sets currentFeedand nextFeed to a Feed struct with zero values

  • getResultWithValidity - returns the current feed value and a boolean indicating whether it is valid

  • getNextResultWithValidity - returns the next feed value (i.e. the one that will become the current value upon the next updateResult call), and a boolean indicating whether it is valid

  • getNextBoundedPrice - get the next currentFeed price according to the current newPriceDeviation

  • getNextPriceLowerBound - get the lower bound of the next currentFeed update

  • getNextPriceUpperBound - get the upper bound of the next currentFeed update

  • read - returns the current feed value; reverts if it was not set by some valid mechanism

  • updateResult - updates the current feed value and reads the next one

Data Structures

  • Feed - struct used to store price feed data. Contains:

    • value - the feed value

    • isValid - whether the price feed value is valid

3. Walkthrough

In order for the DSM to work properly, an external actor must regularly call updateResult() to update the current price and read the next one. The contract stores the timestamp of the last updateResult() and will not allow another update until block.timestamp is at least lastUpdateTime + updateDelay. Values are read from the priceSource. The next price accepted in the DSM can be at max newPriceDeviation deviated from the current price stored in the contract. In case of an oracle attack, governance can call stop() orrestartValue()

4. DSM Variations

SelfFundedDSM

ExternallyFundedDSM

PreviousOracle Security ModuleNextFSM Governance Interface

Last updated 4 years ago

Was this helpful?

This contract pulls funds from the so it can reward addresses for callingupdateResult.

This contract calls an in order to reward addresses that call updateResult.

StabilityFeeTreasury
FSMWrapper