Under the hood
How HarvestFi works
HarvestFi is an on-chain perpetual-futures exchange for real-world farm commodities. You trade with leverage against a shared liquidity pool, prices come from a signed oracle, and each market's trading fees flow to the holder of its license NFT. Here is the whole machine.
The contracts
Six non-upgradeable contracts on Robinhood Chain, each with one job:
- CommodityRegistry
- The market catalog — symbol, unit, leverage cap, fees, and open-interest cap per commodity.
- PushPriceOracle
- Holds the latest signed USD price per market, with a max-age staleness rule and a price-deviation circuit breaker.
- LiquidityPool
- The ETH pool that is the counterparty to every trade. LP shares appreciate as the pool grows; dead-shares block the first-deposit inflation edge.
- PerpEngine
- Opens, closes, and liquidates positions; computes PnL, funding, and the borrow fee; settles everything against the pool.
- FeeManager
- Splits each trading fee 70% to the market's license holder, 30% to the protocol.
- MarketLicenseNFT
- One transferable NFT per market. The holder earns that market's 70% fee share.
How prices reach the chain
A keeper reads a real commodity feed, normalizes every quote to a common 1e8 USD format, signs it, and posts it on-chain. The engine reads only that on-chain price.
If a market's price goes stale — the feed pauses on a weekend or overnight — the oracle marks it stale and the app auto-disables trading on it until a fresh price arrives. A new price that jumps too far from the last one is rejected by the circuit breaker.
The pool is the counterparty
There is no order book and no matched taker. When you open a position, the liquidity pool takes the other side. Your profit is paid from the pool; your loss is paid into it. LPs therefore profit when traders lose in aggregate — and they also earn the borrow fee.
Funding keeps the market balanced: when one side is heavier, it pays the lighter side, which pulls open interest back toward neutral. The borrow fee is paid by the heavier side and scales with how much of the pool is in use, so crowded trades cost more to hold.
Because the pool backs every payout, a market can only support as much open interest as the pool can cover. That is why open-interest caps start conservative and widen as liquidity grows.
Fees and the 70/30 split
Each trade pays a small fee on open and on close — 5 bps each, about 0.10% round-trip on notional. Every fee is split the same way:
Fees accrue into a per-market bucket that the current license holder can claim at any time. When a license is sold, the seller's earned fees settle to them and the buyer earns cleanly from the sale forward. Fees also accrue before a market is minted — so the first person to mint that license can claim the whole backlog.
Browse market licenses →Safety systems
- Insurance fund
- Backstops bad debt so a losing position that blows through its margin does not drain the pool.
- Flat liquidation fee
- A liquidator is paid a fixed reward from collateral, keeping under-margined positions closed promptly.
- Guardian pause
- A guardian can pause trading in an emergency without being able to touch user funds.
- Circuit breaker
- The oracle rejects a price that deviates too far from the previous one, blocking a single bad print.
- Non-upgradeable
- The contracts cannot be changed after deploy — no admin key can rewrite the logic under you.
Risk
Leverage can lose your entire margin. Prices come from a single signed oracle today; decentralizing it is planned. The pool's depth caps position size. Leveraged commodity derivatives are regulated in many places, so availability may be geo-restricted. Trade only what you can afford to lose.