Skip to main content

Architecture

Each Gedho market is a set of contracts on Robinhood Chain. They hold the money and the asset, keep the books, run the queue, split FV into Fix and Yield, and send commands to Lighter, where the short is held. One control contract serves every market. The examples use BTC.

GedhoMarketsettings of the marketGedhoControlroles, pause, feeUserUSDG or BTCGedhoQueuerequests and roundsGedhoVaultFV, books, Lighter accountLighterthe shortReportersevery hourReportOraclechecks reportsLighterCodecwrites commandsGedhoZapone transactionGedhoSeriessplit, Join, settleFix and Yieldone pair per seriesUniswap poolYield/USDG
The contracts of one market, with BTC as the example. Each market has its own set; GedhoControl serves every market.
  1. A user sends a deposit to GedhoQueue, which collects requests and settles them in hourly rounds.
  2. GedhoVault holds the money and the BTC, keeps the books, is the FV token, and owns the account on Lighter, where it holds the short. Its code is two contracts at one address.
  3. LighterCodec writes the vault's commands in the format of Lighter. It holds nothing and has no permission.
  4. Two reporters send reports to ReportOracle, which checks them before the vault uses them.
  5. GedhoSeries splits FV into Fix and Yield, joins them back and settles each series. Yield trades against USDG in a Uniswap v3 pool.
  6. GedhoMarket holds the fixed settings of the market. GedhoControl holds the roles, the pause, the protocol fee and the treasury for every market.
  7. GedhoZap combines several of these steps in one transaction.

The contracts​

ContractWhat it does
GedhoVaultHolds the USDG and the asset, keeps the books, is the FV token, and owns the account on Lighter. Its code is two contracts at one address, and one interface describes both.
GedhoQueueCollects requests to enter and to leave, and settles them in hourly rounds.
GedhoSeriesOpens each series, splits FV into Fix and Yield, joins them back, and settles the series at maturity.
Series tokensThe Fix and Yield tokens of each series. They cannot be upgraded.
GedhoMarketHolds the fixed settings of a market. Every other contract of the market reads them.
ReportOracleTakes the hourly reports of the two reporters and checks them before the vault uses them.
LighterCodecWrites the vault's commands in the format of Lighter. It holds nothing and has no permission.
GedhoControlHolds the roles, the pause, the protocol fee and the treasury, once for every market.
GedhoZapCombines several steps, such as buying FV and selling Yield, in one transaction, and creates the FV and Yield pools. It has no permission and keeps no funds.

Upgrades​

GedhoVault, GedhoQueue, GedhoSeries, ReportOracle, LighterCodec and GedhoControl sit behind proxies and can be upgraded through the 72-hour time delay. GedhoMarket and the series tokens cannot be upgraded. Only the 72-hour time delay can call upgradeToAndCall, the upgrade function of the UUPS standard, and the new code must carry a higher version() and the same fingerprint(), described on the Upgradeable base page. See Upgrades and pause.

Callers​

On every contract page, functions are grouped by who can call them: anyone, the owner of a request, the operator, a reporter, the Admin, the guardian, a time delay, or another Gedho contract. Read functions come last. The Types page lists the structs and enums they use.

Contract addresses are on the Addresses page Coming soon, and an API Coming soon will follow.