Skip to main content
RiskRegistry holds every governance-writable parameter: tiers, books, per-book overrides, interest-rate curves, caps, fees, liquidation settings, the DEX router, and swap routes. Its owner is the Timelock, so every change waits out the delay. Stockline reads it on every action but never writes to it. The guardian has no access here. RiskRegistry lets you:
  • Read the effective LTV, liquidation threshold, and max discount of any book
  • Look up a book by id or by collateral token
  • Read interest-rate parameters, caps, and liquidation settings
  • Read the allowlisted swap routes used by Zap and FeeCollector
  • Let governance (through the timelock) create books and tune risk
Addresses per network. Every address is also on Addresses. The source code is src/core/RiskRegistry.sol on GitHub. The ABI is /abis/RiskRegistry.json.

Write methods

setTier

Creates or replaces a risk tier. Books on this tier pick up the new values at once. Owner only. Reverts with ZeroId for id 0, InvalidLtvLt unless ltv < lt < 1e18, and InvalidDiscount when maxLiqDiscount is 1e18 or more.
Owner (timelock) only.
Bounds: ltv < lt < 1e18 so a position always has a cushion before liquidation.
Input parameters

createBook

Opens a new isolated book against the shared USDG pool. Owner only. One book per collateral token. The book starts with borrowingEnabled false. Reverts with BookAlreadyExists, UnknownTier, ZeroId, or ZeroAddress on bad input.
Collateral, oracle, and issuer never change after creation. Governance must call setBorrowingEnabled before anyone can borrow.
Input parameters Return values

setBookOverride

Replaces the full override set for one book. Each setX flag chooses the override value or falls back to the tier. Owner only. The effective pair must still satisfy ltv < lt < 1e18 and discount < 1e18.
Owner (timelock) only.
Emits BookOverrideSet, not TierSet, so indexers can tell a one-off from a bucket change.
Input parameters

setBookTier

Moves a book to another tier. Existing overrides still apply on top. Owner only. Reverts with UnknownTier or ZeroId, or InvalidLtvLt if the combination is invalid.
Owner (timelock) only.
Input parameters

setBorrowCap

Sets the per-book USDG debt cap. A cap of 0 closes new borrowing rather than making it unlimited. Owner only.
Owner (timelock) only.
Input parameters

setBorrowingEnabled

Turns borrowing on or off for one book. Books start off so the pool can fill before anyone borrows. Owner only.
Owner (timelock) only. Turning this off does not block repay, supply, or liquidation.
Input parameters

setIrmParams

Sets the kinked interest-rate curve for one book. Owner only. Reverts with InvalidKink unless 0 < kink < 1e18.
Owner (timelock) only.
Input parameters

setIssuerCap

Sets the aggregate USDG debt cap across every book that shares an issuer id. Owner only. Reverts with ZeroId for issuer 0.
Owner (timelock) only.
Launch: one issuer owns all twelve stock tokens, so this is the protocol cap.
Input parameters

setReserveFactor

Sets the share of borrower interest that goes to the reserve instead of suppliers. Owner only. Reverts with InvalidWad above 1e18.
Owner (timelock) only.
Input parameters

setProtocolLiqFeeShare

Sets the protocol’s share of the liquidation discount, routed to FeeCollector as seized collateral. Owner only. Reverts with InvalidWad above 1e18.
Owner (timelock) only.
Input parameters

setLiquidationParams

Sets the Dutch auction window, the post-liquidation health target, and the dust threshold. Owner only. Reverts with InvalidAuctionWindow outside (0, 7 days], InvalidTargetHealth outside [1e18, 2e18], and InvalidDust for 0.
Owner (timelock) only.
SPEC: launch 2h / 1e18 / 10e18. Window 0 would jump the discount to max on first tick.
Input parameters

setDexRouter

Sets the ISwapRouter used by Zap, PositionRouter, FeeCollector, and CreatorFeeRouter. Core accounting never calls it. Owner only. Reverts with ZeroAddress for the zero address.
Owner (timelock) only.
Input parameters

setBuyAndBurn

Sets the route, slippage cap, per-call size, and TWAP window for treasury USDG to STK burns. Owner only. Reverts with InvalidRoute for fewer than two hops or a zero TWAP window, InvalidBps above 10000, and ZeroAddress for any zero hop.
Owner (timelock) only.
Input parameters

setZapRoute

Allowlists a token that Zap and the fee contracts can convert to or from USDG, or removes it with allowed false. Owner only. Reverts with ZeroAddress for a zero token and validates the route when allowed.
Owner (timelock) only.
Input parameters

Read methods

book

Returns the Book struct for an id. Unknown ids return a struct with exists false. Input parameters Return values

bookIdOf

Returns the book id for a collateral token, or 0 if none. Input parameters Return values

tier

Returns the Tier struct for an id. Unknown ids return exists false. Input parameters Return values

bookOverride

Returns the raw override struct for a book. Use ltv, lt, and maxLiqDiscount for effective values. Input parameters Return values

ltv

Returns the effective loan-to-value of a book: the override if set, else the tier value. Reverts with UnknownBook for an unknown id. Input parameters Return values

lt

Returns the effective liquidation threshold of a book. Reverts with UnknownBook for an unknown id. Input parameters Return values

maxLiqDiscount

Returns the effective maximum Dutch auction discount of a book. Reverts with UnknownBook for an unknown id. Input parameters Return values

liquidatorAllowlist

Returns the effective allowlist flag of a book. Reverts with UnknownBook for an unknown id.
This flag is stored for governance but LiquidationModule does not enforce it. Liquidations are permissionless.
Input parameters Return values

irmParams

Returns the interest-rate curve of a book. Reverts with UnknownBook for an unknown id. Input parameters Return values

issuerCap

Returns the aggregate debt cap for an issuer group. Input parameters Return values

buyAndBurn

Returns the current BuyAndBurnParams. Return values

zapRoute

Returns the ZapRoute for a token. Tokens that were never set return allowed false. Input parameters Return values

Events

TierSet

Fires when a tier is created or replaced.

BookCreated

Fires when a book is opened, with its immutable identity and initial cap.

BookOverrideSet

Fires when a book’s override set is replaced, with every flag and value.

BookTierSet

Fires when a book moves to another tier.

BookCapSet

Fires when a book’s borrow cap changes.

BookBorrowingEnabled

Fires when a book’s borrowing flag changes.

IrmParamsSet

Fires when a book’s interest curve changes.

IssuerCapSet

Fires when an issuer cap changes.

ReserveFactorSet

Fires when the reserve factor changes.

ProtocolLiqFeeShareSet

Fires when the protocol liquidation fee share changes.

LiquidationParamsSet

Fires when the auction window, target health, or dust debt change.

DexRouterSet

Fires when the DEX router changes.

BuyAndBurnSet

Fires when the buy-and-burn route or limits change.

ZapRouteSet

Fires when a zap route is allowed, updated, or removed.

Errors

NotOwner

The caller is not the timelock.

ZeroAddress

A required address was zero.

ZeroId

A tier, issuer, or book id was zero.

UnknownTier

The tier id does not exist.

UnknownBook

The book id does not exist.

BookAlreadyExists

A book already lists this collateral token.

InvalidLtvLt

The effective LTV and LT do not satisfy ltv < lt < 1e18.

InvalidDiscount

The max discount is 1e18 or more.

InvalidWad

A WAD share was above 1e18.

InvalidKink

The kink is 0 or 1e18 or more.

InvalidBps

A slippage value is above 10000 bps.

InvalidRoute

A route has fewer than two hops or the TWAP window is 0.

InvalidAuctionWindow

The auction window is 0 or longer than 7 days.

InvalidTargetHealth

The target health is below 1e18 or above 2e18.

InvalidDust

The dust threshold is 0.