u64 account holds supply and borrow positions keyed by HubAssetKey. Every
account is bound to a spoke id >= 1; the spoke defines which assets the account
can use and with which risk parameters.
Read first: Markets.
Storage
Account state is split across three controller records:| Record | Holds |
|---|---|
AccountMeta(account_id) | Owner, active spoke id, and position mode. |
SupplyPositions(account_id) | Map<HubAssetKey, AccountPositionRaw>. |
BorrowPositions(account_id) | Map<HubAssetKey, DebtPositionRaw>. |
Positions
Supply and debt positions store scaled RAY balances. The live token amount is reconstructed from the current pool index:Spoke Risk
The account’s spoke providesSpokeAsset(spoke_id, HubAssetKey) configuration:
- collateral and borrow flags;
- paused and frozen flags;
- LTV;
- liquidation threshold;
- liquidation bonus and protocol fee;
- spoke-level supply and borrow caps;
- optional oracle override.
Position Limits
An account can hold a bounded number of supply and borrow positions. Governance updates those limits through timelock. Exceeding either side reverts#109 PositionLimitExceeded.
Risk Gates
| Gate | When | Rule |
|---|---|---|
| LTV | Borrow and indebted withdrawal | Weighted collateral must cover total debt. |
| Health factor | Borrow, indebted withdrawal, liquidation | HF = weighted_collateral / total_debt; HF < 1e18 is liquidatable. |
| Minimum borrow collateral | Any account with debt | LTV-weighted collateral must stay above the configured USD floor. |
Position Modes
PositionMode gates strategy entrypoints:
| Mode | Meaning |
|---|---|
Normal | Standard supply and borrow. |
Multiply | Leveraged collateral/debt loop. |
Long | Directional long strategy. |
Short | Directional short strategy. |
Next
Risk parameters
Units, ranges, and configured values for market and spoke risk parameters.
Health factor
Health-factor formula and WAD examples.
Liquidations
Liquidation rules after health factor drops below one.
Strategies
Strategy modes and route-driven account flows.

