Section 6 of 15
ActivePool + DefaultPool: ETH and Debt Accounting
Key takeaway: Liquity splits its ETH and LUSD-debt accounting across two near-identical pool contracts and one empty placeholder.
ActivePoolholds the ETH backing every active Trove and tracks the system-wide LUSD debt for those Troves.DefaultPoolholds redistributed ETH (and the matching debt) that has been "assigned" to remaining Troves but not yet claimed back into their per-Trove storage.GasPoolis a literal three-line contract that exists only to hold the per-Trove 200 LUSD gas-compensation deposit at a deterministic address. Each pool has a hand-rolledETHbalance tracker that decouples the protocol's bookkeeping from the contract's actual ETH balance — a defense against unsolicited transfers viaselfdestructthat would otherwise corrupt accounting.
What You Are Building
Three contracts. All small. All boring on the surface. All load-bearing.
ActivePool and DefaultPool are nearly identical in shape: a few immutable role addresses, two internal accounting trackers (ETH and LUSDDebt), and a handful of allowlisted setters. The difference is which contracts can talk to them and where the ETH flows from there.
GasPool exists at a deterministic deployed address and holds the LUSD that pays liquidators their 200 LUSD reward. It doesn't need any code — the LUSDToken allowlist enforces that only BorrowerOperations (mint into GasPool on Trove open) and TroveManager (return from GasPool on liquidation/close) can move the LUSD in or out.
Your Code
Requirements
Sign up free — keep reading + earn 15 Lynx
Zealynx Academy is free. Track your progress, earn Lynx, and climb the leaderboard.
Sign up free to continueAlready have an account? Log in