@xoxno/sdk-js/stellar-lending/read. The integrator API
returns display amounts and APYs, rather than the raw contract shares below.
Numeric scales
Read token decimals from
MarketParamsRaw.asset_decimals or the token contract.
Timestamp units are specified per field.
HubAssetKey
Account model
There is no singleAccount struct on the wire. Account state is split across
four controller records plus the position-NFT contract:
The
account_id is the position NFT’s
token_id. The NFT contract supplies ownership for authorization checks.
Controller ids use u64, but mintable NFT ids fit u32. Preserve account ids as
decimal strings in JavaScript. The SDK’s accountNonce refers to the lending
id; sourceSequence refers to the Stellar source account sequence.
AccountAttributes is the view projection of AccountMeta:
{ spoke_id: u32, mode: PositionMode }. Accounts bind to a spoke id >= 1, and
the binding never changes.
PositionMode
#[repr(u32)], so it is a plain u32 on the wire.
Fixed at account creation and enforced on every later
multiply or
flash_position call against that account (#25 AccountModeMismatch).
AccountPositionRaw
DebtPositionRaw
SpokeConfig
SpokeAssetConfig
The three halt flags are independent. Their operation-specific effects are
described in Risk parameters.
SpokeAssetArgs is the write-side input shape. It uses different field names for
the same values: can_collateral, can_borrow, ltv, threshold, bonus,
plus hub_id, asset, spoke_id, the three flags, liquidation_fees,
supply_cap, and borrow_cap.
EditAssetInSpoke cannot clear a halt flag. Governance uses
RelaxSpokeAssetFlagsArgs for that operation:
A subsequent flag change invalidates the scheduled epoch. Read the current
epoch and propose again instead of reusing an obsolete payload.
SpokeUsageRaw
MarketParamsRaw
Defines a pool market. The field names do not include _ray or _bps
suffixes; use the scales below. Supply and borrow caps belong to
SpokeAssetConfig.
InterestRateModel is the same set minus asset_id and asset_decimals; it is
what upgrade_liquidity_pool_params takes.
Markets below 3 decimals cannot enable borrowing or flash loans. Their spoke
liquidation fee is zero, and their collateral must occupy the account’s only
supply slot. Debt-bearing risk checks require at least 2 token base units in
that leg: 2 tokens at 0 decimals, 0.2 at 1 decimal, or 0.02 at 2 decimals.
PoolStateRaw
Liquidation types
SeizeMode
Credit(0) creates the receiving account, owned by the liquidator and bound to
the liquidated account’s spoke.
A non-zero id must already satisfy all five of these:
- it exists;
- it is not the liquidated account itself (
#133); - the liquidator owns it, or is a delegate on it;
- it sits in the liquidated account’s spoke;
- it is in
PositionMode::Normal.
LiquidationEstimate
seized_collaterals and protocol_fees use native collateral units for
Transfer, RAY-scaled supply shares for Credit. refunds always uses
native debt-token units.
PaymentTuple is { asset: Address, amount: i128 }.
MarketIndexView
Returned by get_market_indexes_detailed.
Treat
valid: false as unusable and inspect error_code for the cause.
A resolution error can zero both stale and deviation; false flags alone do
not prove a successful price read.
Oracle types
Oracle configuration is stored on the price aggregator, keyed byPriceKey:
AssetOracle
PriceSource
FeedSource { provider: ProviderRef, decimals: u32, max_stale_seconds: u64 },
where ProviderRef is Reflector(ReflectorFeedRef), RedStone(MultiFeedRef),
or Xoxno(MultiFeedRef). Reflector references carry an OracleReadMode of
Spot or Twap(records); RedStone and Xoxno references carry a FeedNature of
Market or Fundamental.
See Oracles for how these compose.
