Docs · Get started
Architecture
The v4 pool, the hook that holds the book, and what each contract owns.
A market is fully described by its parameter tuple. Deployment is deterministic via CREATE2: the same tuple always resolves to the same address, so a given market can exist exactly once and its address can be computed off-chain before it exists.
struct MarketParams {
address base; // collateral asset (what borrowers pledge)
address quote; // lend-side asset (what lenders commit)
uint32 term; // loan tenor: 30d | 90d | 180d
uint32 pending; // persistence window: 24h .. 7d
uint16 skimBps; // upward-move skim: 400 .. 2000 bps
Ladder ladder; // initial tick grid below the mark
}
market = CREATE2(keccak256(abi.encode(params)))
// one deterministic address per spec — a market can only exist once
| Component | Role |
|---|---|
| Uniswap v4 pool | The trading venue. Spot execution and the prices it prints are the only price input the system has. |
| Lending hook | Holds the book of committed bids, originates loans, runs the skim, tracks marks, and executes liquidation, recovery, and settlement. |
| The book | Per-market storage of ticks: price levels with committed quote-side depth, ordered best (highest) first. |
| Marks | On-chain record of persistent prices — the settlement reference. See Sec. 07. |