| name | kriya |
| description | This skill should be used when the user asks about Kriya DEX, Kriya AMM, Kriya CLMM, Kriya spot DEX, Kriya oracle-driven pools, or wants to integrate with Kriya on Sui. Covers AMM swaps, stable/uncorrelated pool liquidity management, and oracle-driven PMM trading. |
Kriya DEX on Sui
Kriya is a DEX protocol on Sui with two main components:
- Spot DEX (AMM) -- Classic AMM with both stable and uncorrelated pool types
- Oracle-Driven Pools (PMM) -- Proactive Market Maker pools using Pyth oracle price feeds
Package Addresses
| Package | Address |
|---|
| Spot DEX (AMM) | 0xa0eba10b173538c8fecca1dff298e488402cc9ff374f8a12ca7758eebe830b66 |
| Oracle-Driven Pools | 0xa0e3b011012b80af4957afa30e556486eb3da0a7d96eeb733cf16ccd3aec32e0 |
Source Files
- AMM:
packages/mainnet_most_used/0xa0/eba10b173538c8fecca1dff298e488402cc9ff374f8a12ca7758eebe830b66/decompiled_modules/
- PMM:
packages/mainnet_most_used/0xa0/e3b011012b80af4957afa30e556486eb3da0a7d96eeb733cf16ccd3aec32e0/decompiled_modules/
Architecture
Spot DEX (AMM)
- Uncorrelated pools (
is_stable: false): Constant-product (x*y=k)
- Stable pools (
is_stable: true): Curve-style x*y*(x^2+y^2) = k
- Key types:
Pool<T0, T1>, KriyaLPToken<T0, T1>, ProtocolConfigs
- Fee model: Uses 1,000,000 base (millionths)
Oracle-Driven Pools (PMM)
- Uses Pyth price oracle feeds for pricing
- Separate base and quote reserves with target amounts
- Key types:
oracle_driven_pool::Pool<T0, T1>, BasePoolLiquidityCoin, QuotePoolLiquidityCoin
Common Patterns
AMM Swap
// Swap T0 for T1
let coin_out = spot_dex::swap_token_x<T0, T1>(
pool, coin_in, amount_in, min_amount_out, ctx
);
// Swap T1 for T0
let coin_out = spot_dex::swap_token_y<T0, T1>(
pool, coin_in, amount_in, min_amount_out, ctx
);
AMM Add/Remove Liquidity
let lp_token = spot_dex::add_liquidity<T0, T1>(
pool, coin_y, coin_x, amount_x, amount_y, min_x, min_y, ctx
);
let (coin_y, coin_x) = spot_dex::remove_liquidity<T0, T1>(
pool, lp_token, lsp_amount, ctx
);
Oracle-Driven Trading
// Sell base, receive quote (requires Pyth PriceInfoObjects)
let quote = trader::sell_base_coin<T0, T1>(
pool, clock, base_price_info, quote_price_info, base_coin, amount, min_receive, ctx
);
// Buy base, pay quote
let base = trader::buy_base_coin<T0, T1>(
pool, clock, base_price_info, quote_price_info, quote_coin, amount, max_pay, ctx
);
Read-Only Queries
let (reserve_y, reserve_x, lsp_supply) = spot_dex::get_reserves<T0, T1>(pool);
let mid_price = trader::get_mid_price<T0, T1>(pool, clock, base_price, quote_price);
Related Skills
pyth -- Oracle prices used by PMM pools
sui-framework -- Core Coin, Balance types
cetus / turbos -- Alternative DEX protocols