> ## Documentation Index
> Fetch the complete documentation index at: https://xoxno.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Stellar lending data types

> Current core data types used by the Stellar Lending controller and pool.

This page summarizes the main on-chain types. Source definitions live in
`common/src/types`.

## HubAssetKey

```rust theme={"system"}
HubAssetKey {
  hub_id: u32,
  asset: Address,
}
```

`HubAssetKey` is the market coordinate used by controller flows, pool storage,
keeper config, views, events, and strategy inputs.

## Account

```rust theme={"system"}
Account {
  owner: Address,
  spoke_id: u32,
  mode: PositionMode,
  supply_positions: Map<HubAssetKey, AccountPositionRaw>,
  borrow_positions: Map<HubAssetKey, DebtPositionRaw>,
}
```

Accounts bind to a spoke id `>= 1`.

## PositionMode

| Variant    | Meaning                         |
| ---------- | ------------------------------- |
| `Normal`   | Standard supply and borrow.     |
| `Multiply` | Leveraged collateral/debt loop. |
| `Long`     | Directional long strategy.      |
| `Short`    | Directional short strategy.     |

## AccountPositionRaw

| Field                       | Meaning                                   |
| --------------------------- | ----------------------------------------- |
| `scaled_amount_ray`         | RAY-scaled supply shares.                 |
| `liquidation_threshold_bps` | Snapshot threshold used by health factor. |
| `liquidation_bonus_bps`     | Snapshot liquidation bonus.               |
| `loan_to_value_bps`         | Snapshot LTV.                             |

## DebtPositionRaw

| Field               | Meaning                 |
| ------------------- | ----------------------- |
| `scaled_amount_ray` | RAY-scaled debt shares. |

## SpokeAssetConfig

| Field                   | Meaning                                        |
| ----------------------- | ---------------------------------------------- |
| `is_collateralizable`   | Whether supply counts as collateral.           |
| `is_borrowable`         | Whether accounts can borrow it.                |
| `paused`                | Blocks risk-increasing use.                    |
| `frozen`                | Blocks new supply/borrow while allowing exits. |
| `loan_to_value`         | LTV in BPS.                                    |
| `liquidation_threshold` | Health-factor collateral weight in BPS.        |
| `liquidation_bonus`     | Liquidator bonus in BPS.                       |
| `liquidation_fees`      | Protocol fee in BPS.                           |
| `supply_cap`            | Spoke supply cap in token units.               |
| `borrow_cap`            | Spoke borrow cap in token units.               |
| `oracle_override`       | Optional per-spoke oracle config.              |

## MarketParamsRaw

| Field                     | Meaning                                      |
| ------------------------- | -------------------------------------------- |
| `base_borrow_rate_ray`    | Borrow rate at zero utilization.             |
| `slope1_ray`              | Slope below first kink.                      |
| `slope2_ray`              | Slope between first and optimal utilization. |
| `slope3_ray`              | Slope above optimal utilization.             |
| `max_borrow_rate_ray`     | Borrow-rate cap.                             |
| `mid_utilization_ray`     | First utilization kink.                      |
| `optimal_utilization_ray` | Target utilization.                          |
| `max_utilization_ray`     | Hard utilization cap.                        |
| `reserve_factor_bps`      | Protocol share of borrower interest.         |
| `supply_cap`              | Hub supply cap.                              |
| `borrow_cap`              | Hub borrow cap.                              |
| `is_flashloanable`        | Flash-loan eligibility.                      |
| `flashloan_fee`           | Flash-loan fee in BPS.                       |
| `asset_id`                | Token address.                               |
| `asset_decimals`          | Token decimals.                              |

## Oracle Types

Oracle config is token-rooted under `AssetOracle(asset)` and can be overridden
per spoke asset. It supports Reflector and RedStone sources, primary/anchor
composition, tolerance bands, staleness bounds, resolution, decimals, and sanity
bounds.
