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

# Pricing

Tokenized Vaults and Single Asset Vaults require accurate pricing to function correctly. Subscription and redemption flow require a precise calculation of Assets Under Management (AUM) in order to issue or burn vault shares. To determine AUM, GLAM prices each individual asset (token or DeFi position) held by the vault and sums them up:

<br />

$$
\text{AUM} = \sum_{t \in \text{Tokens}} v_t + \sum_{j \in \text{KaminoLending}} v_j + \cdots
$$

Where:

* $v_t$ is the value of each individual token held by the vault
* $v_j$ is the value of each individual position in Kamino Lending

Vaults are priced in their base asset. Tokenized Vaults depend on a curated set of oracles to be priced. Single Asset Vaults do not need any external oracle as they only hold one asset (i.e., the base asset), so AUM is derived directly from the balance of that asset.

## How Pricing Works Onchain

<Frame>
  <img className="block dark:hidden" src="https://res.cloudinary.com/devbkdecu/image/upload/v1759855525/GLAM_-_Pricing_-_Light_ixl6ej.jpg" />

  <img className="hidden dark:block" src="https://res.cloudinary.com/devbkdecu/image/upload/v1759855524/GLAM_-_Pricing_-_Dark_-_Transparent_h7g8yq.png" />
</Frame>

For integrated protocols like Kamino, we implement the protocol's native calculation, including underlying fees.

The pricing process involves the following steps:

* Any transaction that requires AUM must include price instructions for all enabled protocols. These instructions save per-protocol price data to the GLAM State Account's `PricedProtocols` field.
* AUM is calculated by summing the valuations in `PricedProtocols`. Validations ensure all vault assets and positions use fresh oracle data.
* NAV (Net Asset Value) is calculated as AUM divided by the total share supply.
  * For subscriptions, the number of shares to issue is calculated from NAV and the subscription amount, subject to applicable fees.
  * For redemptions, the payout amount is calculated from NAV and the number of shares being redeemed, subject to applicable fees.

### Consuming Pricing Data

The `PricedProtocols` field provides the source of truth for current AUM. To get a fresh valuation onchain, a transaction must include the `price` instructions to cover all enabled protocols, optionally followed by the `validate_aum` instruction that validates the correctness.

Do not use `FeeParams` as the source of truth for current AUM or NAV. `FeeParams`'s `last_aum`, `pa_last_nav`, and high-water-mark fields are fee-accounting checkpoints from fee crystallization, not live valuation fields.

## Functional Pricing for LSTs

For liquid staking tokens (LSTs), GLAM uses functional pricing whenever possible. Each LST (like mSOL, jitoSOL, bSOL, etc.) represents a claim on staked SOL plus staking rewards, therefore they have an intrinsic value backed by SOL in the pool. The conversion rate is derived onchain from the LST's pool state account:

$$
\text{ConversionRate} = \frac{\text{Stake Pool SOL Balance}}{\text{LST Token Supply}}
$$

With the conversion rate, GLAM derives the functional price of the LST as:

$$
\text{FuncPrice} = \text{SOL Price (USD)} \times \text{ConversionRate}
$$

### Benefits of Functional Pricing

* **Depeg Protection**: Protects users from temporary market depegging events where LST spot prices may trade below their intrinsic value
* **Accurate Valuation**: Reflects the true underlying value based on staked SOL and accrued rewards, not market sentiment
* **Reduced Manipulation Risk**: Eliminates the risk of oracle manipulation or flash loan attacks on LST spot prices
* **Consistent Pricing**: Provides stable, predictable pricing that follows the actual staking yield mechanics
* **Fair Entry/Exit**: Ensures users receive fair value when subscribing to or redeeming from vaults holding LSTs
