HubAssetKey.
Prices are all-or-nothing. If any asset on the account cannot produce a trusted
price, the whole call reverts — there is no lenient mode for one leg.
Read first: Accounts and risk,
Markets, and
Health factor.
Supply
account_id = 0 creates a new account owned by caller and bound to
spoke_id. Existing accounts keep their stored spoke; the supplied spoke_id
must match that account.
Preconditions
callerauthorizes the call and token transfers.- Each
HubAssetKeynames an existing market on an active hub. - A caller who is neither owner nor delegate may only add to hub assets the account already holds a supply position in. New accounts skip that check, because the caller becomes the owner.
- The account’s spoke lists the hub asset.
- The spoke asset is collateralizable and not blocked for increases.
- Supply caps and position limits leave enough headroom.
Example
Common errors
Borrow
account_id. Tokens go to to when set, otherwise to
caller.
Preconditions
callerholds the account’s position NFT, or is an active delegate on it.- Each borrowed hub asset is listed by the account’s spoke and borrowable.
- Borrow caps, liquidity, and utilization caps leave enough headroom.
- Post-borrow LTV and health factor pass.
- Every priced asset on the account resolves a valid price. One stale or disagreeing feed reverts the whole call.
Example
Common errors
Verification
A successful supply or borrow emitsUpdatePositionBatchEvent from the
controller (["position", "batch_update"]) and PoolMarketStateBatchEvent from
the pool (["market", "batch_state_update"]). Read back state through
get_account_positions, get_collateral_amount(account_id, hub_asset),
get_borrow_amount(account_id, hub_asset), and get_health_factor.
Next
Withdraw and repay
Exit collateral and repay debt.
Flash loans
Borrow and repay inside one callback.

