Structs§
- Guard
Params - Guarded
Quote - Oracle
Payload - Price
- Prices
- Quote
- Single
Side Liquidity - Transfer
FeeConfig - Two-rate fee schedule.
- Transfer
FeeRate - Per-epoch fee rate parameters.
Enums§
Constants§
- AMOUNT_
EXCEEDS_ MAX_ I32 - AMOUNT_
EXCEEDS_ MAX_ U32 - AMOUNT_
EXCEEDS_ MAX_ U64 - AMOUNT_
EXCEEDS_ MAX_ U128 - ARITHMETIC_
OVERFLOW - BPS_
DENOMINATOR - BPS_
EXCEEDS_ MAX_ U16 - INVALID_
ORACLE_ DATA - INVENTORY_
A_ SIDE_ EXCEEDED - INVENTORY_
B_ SIDE_ EXCEEDED - INVENTORY_
IMBALANCE - ORACLE_
DATA_ LEN - ORACLE_
EXPIRED - ORACLE_
PAYLOAD_ LEN - ORACLE_
PRICE_ ABOVE_ MAX - ORACLE_
PRICE_ BELOW_ MIN - PER_
CENT_ DENOMINATOR - PER_
M_ DENOMINATOR - SKEW_
LEN - SKEW_
OFFSET - SPREAD_
BELOW_ MIN
Functions§
- a_to_b
- Convert an amount in token A to an amount in token B
- ask_
liquidity - ask_
price - b_to_a
- Convert an amount in token B to an amount in token A
- bid_
liquidity - bid_
price - calculate_
fee_ for_ rate - Fee that the Token-2022 program will withhold for a single rate.
- calculate_
pre_ fee_ amount_ for_ rate - Smallest pre-fee amount whose post-fee value is at least
post_fee_amount, for a single rate. - check_
guards - check_
oracle_ validity - deviation_
per_ m - Computes deviation_per_m from inventory ratio. 0 = balanced (50/50), +1_000_000 = 100% token_a, -1_000_000 = 100% token_b. inventory_ratio = value_a / (value_a + value_b) where values are in q64.64.
- invert_
price - Invert a price from A/B to B/A, works for both Q64.64 and SqrtPrice
- quote_
exact_ in - quote_
exact_ in_ with_ guards - quote_
exact_ out - quote_
exact_ out_ with_ guards