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.
- A user sends a deposit to GedhoQueue, which collects requests and settles them in hourly rounds.
- 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.
- LighterCodec writes the vault's commands in the format of Lighter. It holds nothing and has no permission.
- Two reporters send reports to ReportOracle, which checks them before the vault uses them.
- GedhoSeries splits FV into Fix and Yield, joins them back and settles each series. Yield trades against USDG in a Uniswap v3 pool.
- GedhoMarket holds the fixed settings of the market. GedhoControl holds the roles, the pause, the protocol fee and the treasury for every market.
- GedhoZap combines several of these steps in one transaction.
The contracts
| Contract | What it does |
|---|---|
| GedhoVault | Holds 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. |
| GedhoQueue | Collects requests to enter and to leave, and settles them in hourly rounds. |
| GedhoSeries | Opens each series, splits FV into Fix and Yield, joins them back, and settles the series at maturity. |
| Series tokens | The Fix and Yield tokens of each series. They cannot be upgraded. |
| GedhoMarket | Holds the fixed settings of a market. Every other contract of the market reads them. |
| ReportOracle | Takes the hourly reports of the two reporters and checks them before the vault uses them. |
| LighterCodec | Writes the vault's commands in the format of Lighter. It holds nothing and has no permission. |
| GedhoControl | Holds the roles, the pause, the protocol fee and the treasury, once for every market. |
| GedhoZap | Combines 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.