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
  • SAFE Engine
  • Oracle Relayer
  • Tax Collector
  • Liquidation Engine

Was this helpful?

  1. Pyflex
  2. Getting Started

GEB Basics

Examples of querying the GEB contracts

SAFE Engine

Log the current global debt and the global debt ceiling:

>>> geb.safe_engine.global_debt()
Rad(5208615869764014400330809431631271622010234720384)
>>> geb.safe_engine.global_debt_ceiling()
Rad(10200000000000000000000000000000000000000000000000)

Get the total debt available to generate:

>>> str(geb.safe_engine.global_debt_ceiling() - geb.safe_engine.global_debt())
'4991.375324317972058031697987632361257179694960552'

Get a SAFE's status:

>>> from pyflex import Address
>>> collateral_type = geb.collaterals['ETH-A'].collateral_type
>>> safe = geb.safe_engine.safe(collateral_type, Address('0xdD1693BD8E307eCfDbe51D246562fc4109f871f8'))
>>> safe.locked_collateral
Wad(550000000000000000)
>>> safe.generated_debt
Wad(85000000000000000000)

Get updated CollateralType info:

>>> collateral_type = geb.safe_engine.collateral_type('ETH-A')
>>> print(collateral_type)
CollateralType('ETH-A')[accumulated_rate=1.001032213690254860731418088 safe_collateral=0.000000000000000000 safe_debt=5203.253805869738490471 safety_price=157.366296298604006512381213706 liquidation_price=157.366296298604006512381213706 debt_ceiling=10200.000000000000000000000000000000000000000000000 debt_floor=85.000000000000000000000000000000000000000000000]
>>> collateral_type.liquidation_price
Ray(157366296298604006512381213706)

Oracle Relayer

Get the redemption_price and theredemption_rate . Note that fetching the latest redemption price requires you to first update it and then return the value:

>>> geb.oracle_relayer.redemption_price()
Ray(2026411234986175268208847109)
>>> geb.oracle_relayer.redemption_rate()
Ray(999999954662032624407551326)

Tax Collector

Get the per-second stability fee applied to SAFEs :

>>> geb.tax_collector.stability_fee(geb.safe_engine.collateral_type('ETH-A'))
Ray(1000000000472114805215157978)

Liquidation Engine

Check if a SAFEcan be liquidated:

>>> from pyflex import Address
>>> collateral_type = geb.collaterals['ETH-A'].collateral_type
>>> safe = geb.safe_engine.safe(collateral_type, Address('0xdD1693BD8E307eCfDbe51D246562fc4109f871f8'))
>>> geb.liquidation_engine.can_liquidate(collateral_type, safe)
False

If the SAFE is underwater, you can also liquidate it:

>>> geb.liquidation_engine.liquidate_safe(collateral_type, safe).transact()

These are just a few examples. To see all supported functions, view the source code:

PreviousConfigurationNextSAFE Management

Last updated 4 years ago

Was this helpful?

pyflex/gf.py at master · reflexer-labs/pyflexGitHub
Logo