GEB Docs
Search…
GEB Basics
Examples of querying the GEB contracts

SAFE Engine

Log the current global debt and the global debt ceiling:
1
>>> geb.safe_engine.global_debt()
2
Rad(5208615869764014400330809431631271622010234720384)
3
>>> geb.safe_engine.global_debt_ceiling()
4
Rad(10200000000000000000000000000000000000000000000000)
Copied!
Get the total debt available to generate:
1
>>> str(geb.safe_engine.global_debt_ceiling() - geb.safe_engine.global_debt())
2
'4991.375324317972058031697987632361257179694960552'
Copied!
Get a SAFE's status:
1
>>> from pyflex import Address
2
>>> collateral_type = geb.collaterals['ETH-A'].collateral_type
3
>>> safe = geb.safe_engine.safe(collateral_type, Address('0xdD1693BD8E307eCfDbe51D246562fc4109f871f8'))
4
>>> safe.locked_collateral
5
Wad(550000000000000000)
6
>>> safe.generated_debt
7
Wad(85000000000000000000)
Copied!
Get updated CollateralType info:
1
>>> collateral_type = geb.safe_engine.collateral_type('ETH-A')
2
>>> print(collateral_type)
3
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]
4
>>> collateral_type.liquidation_price
5
Ray(157366296298604006512381213706)
Copied!

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:
1
>>> geb.oracle_relayer.redemption_price()
2
Ray(2026411234986175268208847109)
3
>>> geb.oracle_relayer.redemption_rate()
4
Ray(999999954662032624407551326)
Copied!

Tax Collector

Get the per-second stability fee applied to SAFEs :
1
>>> geb.tax_collector.stability_fee(geb.safe_engine.collateral_type('ETH-A'))
2
Ray(1000000000472114805215157978)
Copied!

Liquidation Engine

Check if a SAFEcan be liquidated:
1
>>> from pyflex import Address
2
>>> collateral_type = geb.collaterals['ETH-A'].collateral_type
3
>>> safe = geb.safe_engine.safe(collateral_type, Address('0xdD1693BD8E307eCfDbe51D246562fc4109f871f8'))
4
>>> geb.liquidation_engine.can_liquidate(collateral_type, safe)
5
False
Copied!
If the SAFE is underwater, you can also liquidate it:
1
>>> geb.liquidation_engine.liquidate_safe(collateral_type, safe).transact()
Copied!
These are just a few examples. To see all supported functions, view the source code:
pyflex/gf.py at master · reflexer-labs/pyflex
GitHub
Last modified 1yr ago