Skip to main content
Source: packages/contracts/src/yield/Treasury.sol The Treasury is deliberately generic — not coupled to PredictionMarket — so the same implementation can serve any future market type. One Treasury per principal; the principal address is immutable and the only address allowed to call recallToPrincipal.

Roles

Reserve floor

Every deployIdle(adapter, amount) enforces:
So at most half the float can be in adapters at any time. Owner-tunable.

Adapter lifecycle

enableAdapter checks the adapter reports this Treasury as its principal and uses native asset only (asset() == address(0)). Subsequent disableAdapter requires deployedTo == 0 && totalAssets() == 0 && pendingClaim() == 0 — strand-prevention so funds never silently drop out of accounting.

Reentrancy + gates

All native-sending paths (deployIdle, requestUnstake, claimFrom, recallToPrincipal) carry an explicit nonReentrant modifier. State writes happen before the external call in every case; the guard is belt-and-suspenders.