Documentation Index
Fetch the complete documentation index at: https://docs.multiliquid.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Price sources (NavData) provide USD-denominated pricing for all assets in the Multiliquid Program. Each asset can have 1-5 pricing sources, which are aggregated and validated during swap execution.NAV Data Types
The program supports three types of NAV pricing sources:U64FixedAddress
Read price from a fixed byte offset in an on-chain account.- Read account data at
nav_account_address - Read u64 at byte offset
nav_price_offset - Interpret value with
price_decimalsdecimal places
- Custom price oracle accounts
- RWA issuer-published NAV accounts
- Any account storing price as u64 at known offset
Hardcoded
Static price value for stable-value assets.- Return
hardcoded_pricedirectly - Interpret with
price_decimalsdecimal places
- Dollar-pegged stablecoins (USDC, USDT)
- Assets with contractually fixed prices
- Testing and development environments
Hardcoded prices are ideal for dollar-pegged stablecoins that maintain a 1:1 USD value. They have zero external dependencies and minimal gas costs.
PythPush
Pyth Network oracle integration for market prices.- Deserialize the configured Pyth receiver
PriceUpdateV2account - Verify the account’s feed id matches
feed_id - Require the update to be no older than
max_age_secs - Require confidence to be within
max_conf_bps - Normalize the Pyth price and exponent into the program’s 9-decimal NAV format
- Market-priced assets with Pyth feeds
- Real-time price updates
- Cross-chain price consistency
Price Aggregation
When multiple NAV sources are configured for an asset, the program performs price aggregation:Aggregation Process
Divergence Validation
Theprice_difference_bps setting controls maximum allowed price divergence:
- If
divergence_bps > price_difference_bps: Return 0 (block swaps) - If within threshold: Return average price
Decimal Normalization
All prices are normalized to 9 decimal places internally:| Source Decimals | Raw Value | Normalized (9 decimals) | USD Value |
|---|---|---|---|
| 6 | 1_050000 | 1_050_000_000 | $1.05 |
| 8 | 105_000000 | 1_050_000_000 | $1.05 |
| 9 | 1_050000000 | 1_050_000_000 | $1.05 |
Configuration Examples
Single Source: Dollar-Pegged Stablecoin
Single Source: RWA with Custom Oracle
Multiple Sources: RWA with Redundancy
Reading NAV Accounts in Swaps
When executing swaps, NAV source accounts must be passed as remaining accounts:Hardcoded NAV sources don’t require external accounts. Only
U64FixedAddress and PythPush sources need their accounts passed.Best Practices
Choosing NAV Sources
| Asset Type | Recommended Source | Rationale |
|---|---|---|
| Dollar-pegged stablecoin | Hardcoded | No oracle dependency, fixed $1.00 |
| NAV-accruing RWA | U64FixedAddress | Issuer publishes official NAV |
| Market-priced asset | PythPush | Real-time market data |
| Critical assets | Multiple sources | Redundancy and validation |
Divergence Thresholds
| Scenario | Recommended BPS | Notes |
|---|---|---|
| Single source | 0 | No divergence possible |
| Similar sources (same feed) | 10-50 | Account for timing |
| Different feeds | 100-200 | Allow for feed differences |
| Volatile assets | 200-500 | Wider tolerance needed |
Monitoring
- Track NAV source health and availability
- Alert on divergence events (swaps blocked)
- Monitor Pyth oracle staleness
- Verify issuer oracle updates regularly
Error Handling
| Error | Cause | Solution |
|---|---|---|
InvalidFeedId | Pyth feed id is zeroed | Provide the expected 32-byte feed id |
InvalidMaxAge / MaxAgeTooLarge | Pyth max age is invalid | Use a value from 1 second through 24 hours |
ConfBpsTooLarge | Pyth max confidence setting exceeds the ceiling | Use 1000 bps or lower |
MissingPythAccount / FeedIdMismatch | Pyth receiver account is missing or for the wrong feed | Pass the configured Pyth account in remaining accounts |
ConfidenceTooLow | Pyth confidence ratio exceeds max_conf_bps | Investigate oracle health or widen the configured threshold |
| Price returns 0 | Divergence exceeded | Check price_difference_bps |
InvalidAccountPublicKey | Required NAV source account was not passed | Include each non-hardcoded source account in remaining accounts |
Next: Architecture Overview
Explore the program’s modular design and account structure