hackquest logo

Egress

Egress protects people who lend money against tokenized stocks. It checks onchain how much of a stock could actually be sold in a crash. If loans grow bigger than the market can absorb, it automatically stops new lending on that stock before lenders are left with losses.

Video

Công nghệ sử dụng

Solidity
Rust
Arbitrum Stylus
Foundry
Morpho Vault V2
Uniswap V3

Sự miêu tả

Egress: liquidation-capacity guard for tokenized stock lending on Robinhood Chain

Robinhood Stock Tokens are now accepted in lending markets, but a loan only remains safe if the collateral can actually be sold when it has to be liquidated. Since the stock tokens trade around the clock but have thin liquidity, a lender may find themselves holding more stock collateral than the market is able to absorb. I carried out the measurement and found that altogether approximately $660,000 worth of stock tokens act as collateral across all the lending protocols on the Robinhood Chain. In the biggest AAPL market, around $301,000 of AAPL is posted, whereas the onchain pools are able to absorb only about $195,000 in the event of a 5% drop in price (both figures being taken from block 74,197,325).

I built Egress as a solution for that.

The depth engine (Arbitrum Stylus, Rust) goes through each tick of a Uniswap V3 pool just as an actual sale would and calculates the amount of USDG that a seller would get before the price drops by a predetermined amount. It aligns real Uniswap swaps with wei. The engine is live on the Robinhood Chain mainnet. The Guard (Solidity) functions as a sentinel for a Morpho Vault V2. It keeps a record of depth readings over time and, when it has five such readings, reduces the vault's lending cap for that stock to the median safe level. It has the ability to lower caps only and can never increase a cap, never move any funds, and never affect existing loans. Any action to raise a cap remains the concern of the curator and is held back by their timelock. Safety is built into the system. The figure used is the median of five readings, which means that a single altered reading cannot cause or prevent a cut. Each pool is allocated a fixed amount of gas, so a keeper cannot starve a reading. A more stringent haircut is applied on weekends since the stock markets are closed. Pools that are unreadable are treated as having zero depth. In the factory, any curator of a Vault V2 is able to set up their own guard in a single transaction. On a mainnet fork of the real NetNet Credit vault, Egress cut the AAPL cap from 600,000 to 75,695 USDG against 151,390 USDG of measured depth (block 78,321,955), and the curator restored it only through their timelock.

Live dashboard: https://egress-theta.vercel.app

Code: https://github.com/UEddy/egress

Depth engine: 0x276F4933f06B77912384D64291E062885C33E031 (Robinhood Chain)

Tiến độ hackathon

The code was composed during the Buildathon; the repository was set up on 27th September and its commit history is public. I checked to make sure the problem was valid before proceeding with work. For this purpose, I developed a measurement tool and compiled a list of all lending protocols that hold stock tokens on the Robinhood Chain (Morpho, Denar, Native, Gage, Ripe, TermMax, LayerBank, Arcadia, Turret). Although my initial focus was on Denar, it turned out that Denar had a very small amount of borrowing in relation to its depth, so I didn't present a problem that didn't actually exist. The chain-wide scan later identified the genuine gap: AAPL collateral in a standard Morpho market exceeding the amount that the pools are able to absorb by 5%, and this was supported by actual debt. I developed and verified the depth engine. This is a Rust Stylus contract which replays the Uniswap V3 swap calculations. It has been cross-checked against actual Uniswap v3-core swaps at the wei level (using 24 test cases) and also against 63 live mainnet readings from 21 stock/USDG pools. I resolved a floating-point dependency that was rejected by Stylus, increased the step limit based on data collected from the mainnet (since NVDA requires 194 steps at 20%), and then deployed it to the Robinhood Chain mainnet. I constructed the guard and the factory. 51 foundry tests were carried out using Morpho's actual Vault V2 code, the tests including fuzzing, scenarios involving manipulation (a single false low reading is not sufficient to cause a cut; two false high readings are not enough to block one), gas-starvation protection which had been calibrated using gas measurements taken from the mainnet, and tests based on the weekend calendar. A simulation of a mainnet fork was used to run the guard on the real NetNet Credit vault. Sent a public dashboard that displays stock lending in relation to sellable depth, including a live button which invokes the deployed engine against the mainnet. Lighthouse scores: 99 for performance and 100 for accessibility. Privacy and security are ensured by the fact that individual borrowers' addresses are never made public; the lender holdings are combined, and the repository history was cleaned before it was made available to the public. The deploy key is used solely for this project, and the frontend contains no secrets. The current limitations are that only Uniswap V3 pools are supported (V4 will come next) and US market holidays are not yet included in the calendar. The guard has been proven on a mainnet fork, with the actual deployment of the guard being planned once a curator chooses to opt in.

Trạng thái huy động vốn

Not raising. Solo founder, self-funded. Open to ecosystem grants to take Exitline from buildathon to production.
Trưởng nhóm
EEddy
Liên kết dự án
Ngành
RWADeFiInfra