Medium
engineering

Building Liquity V1

Build the cleanest stablecoin protocol in DeFi from scratch. Open a Trove, borrow LUSD against ETH collateral, absorb liquidations into the Stability Pool, redeem at face value to enforce the peg. No governance, no interest, no oracle wrappers. Every function, every invariant. Modernized to Solidity 0.8.x.

What you are building

You will write the actual Liquity V1 protocol: TroveManager, BorrowerOperations, StabilityPool with P/S decay accounting, ActivePool, DefaultPool, CollSurplusPool, GasPool, LUSDToken with EIP-2612 permit and minting allowlist, SortedTroves linked list, and LQTYStaking with F_LUSD/F_ETH fee distribution. CDP mechanics at 110% MCR, 150% CCR, redemption-driven peg, Recovery Mode liquidations with capped collateral payout. Eight contracts, fifteen sections, modernized to Solidity 0.8.x.

License: MITSource: liquity/devSolidity: ^0.8.20
15 sections
Lynx300 Lynx
~360 min