Chuyển đến nội dung chính

Documentation Index

Fetch the complete documentation index at: https://docs.raydium.io/llms.txt

Use this file to discover all available pages before exploring further.

Trang này được dịch tự động bằng AI. Phiên bản tiếng Anh là bản chính thức.Xem bản tiếng Anh →
Trang này mô tả cấu trúc và vai trò của từng tài khoản. Các seed chuẩn được liệt kê tại reference/program-addresses. Một pool CLMM sử dụng nhiều tài khoản hơn pool CPMM vì thanh khoản được lưu trữ thưa thớt trên toàn bộ phạm vi tick — hiểu được sự thưa thớt đó là trọng tâm của trang này.

Danh sách tài khoản

Một pool CLMM đang hoạt động được mô tả bởi các nhóm tài khoản sau. Tất cả đều thuộc sở hữu của chương trình CLMM, ngoại trừ hai mint và các vault tương ứng.
Tài khoảnMục đíchSố lượng mỗi pool
AmmConfigMức phí: tỷ lệ phí giao dịch, phần protocol, phần quỹ, tick-spacing mặc định. Dùng chung cho tất cả các pool trong tier này.1 (dùng chung)
PoolStatesqrt_price_x64 hiện tại, tick hiện tại, tổng thanh khoản, phí tăng trưởng toàn cục, thông tin reward, con trỏ observation.1
TickArrayStateMột khối gồm TICK_ARRAY_SIZE tick liền kề. Chỉ được khởi tạo khi cần.0 ≤ N ≤ phạm vi
TickArrayBitmapExtensionBitmap tràn theo dõi các tick array tồn tại ngoài bitmap nội tuyến trong PoolState.0 hoặc 1
PersonalPositionStateMột tài khoản cho mỗi vị thế LP. Lưu phạm vi, thanh khoản và mức phí/reward tăng trưởng lần cuối. Authority = chủ sở hữu NFT.1 mỗi vị thế
NFT mint của vị thếMint với supply bằng 1, liên kết với PersonalPositionState. Chuyển NFT đồng nghĩa với chuyển vị thế.1 mỗi vị thế
ObservationStateRing buffer lưu các quan sát giá cho TWAP.1
token_0_vault, token_1_vaultCác tài khoản token giữ số dư của pool. Thuộc sở hữu của pool authority.2
DynamicFeeConfigBộ tham số có thể tái sử dụng cho cơ chế phí động. Các pool tạo qua create_customizable_pool có thể đăng ký sử dụng. Do admin quản lý.dùng chung (theo index)
LimitOrderStateMột tài khoản cho mỗi lệnh giới hạn đang mở. Ghi lại owner, tick, chiều giao dịch, tổng số lượng, snapshot output đã thanh toán.1 mỗi lệnh
LimitOrderNonceBộ đếm theo (wallet, nonce_index) để tạo ra các PDA lệnh duy nhất.1 mỗi (wallet, index)

PoolState

Trạng thái trực tiếp của pool, được đọc trong mọi lần swap và mọi thay đổi vị thế.
// programs/amm/src/states/pool.rs
pub struct PoolState {
    pub bump:           [u8; 1],
    pub amm_config:     Pubkey,            // fee tier binding
    pub owner:          Pubkey,            // admin (multisig)
    pub token_mint_0:   Pubkey,
    pub token_mint_1:   Pubkey,
    pub token_vault_0:  Pubkey,
    pub token_vault_1:  Pubkey,
    pub observation_key: Pubkey,

    pub mint_decimals_0: u8,
    pub mint_decimals_1: u8,
    pub tick_spacing:   u16,               // inherited from amm_config at init

    pub liquidity:      u128,              // total active (in-range) liquidity
    pub sqrt_price_x64: u128,              // Q64.64 of sqrt(price)
    pub tick_current:   i32,               // current tick index

    pub padding3:       u16,
    pub padding4:       u16,

    // Global fee growth per unit of liquidity, Q64.64.
    pub fee_growth_global_0_x64: u128,
    pub fee_growth_global_1_x64: u128,

    // Accrued-but-not-swept protocol fees (per mint).
    pub protocol_fees_token_0: u64,
    pub protocol_fees_token_1: u64,

    // Reserved padding for future upgrades.
    pub padding5: [u128; 4],

    // Status bitmask. Bits 0-5: open-position, decrease-liquidity,
    // collect-fee, collect-reward, swap, limit-order. A set bit disables
    // the corresponding operation.
    pub status:  u8,

    // Fee-collection mode (CollectFeeOn).
    //   0 = FromInput (deduct fee from the swap input — Uniswap-V3 default)
    //   1 = Token0Only (always deduct fee from token0 vault)
    //   2 = Token1Only (always deduct fee from token1 vault)
    pub fee_on: u8,
    pub padding: [u8; 6],

    // Live reward streams (up to REWARD_NUM = 3).
    pub reward_infos: [RewardInfo; 3],

    // Inline bitmap tracking initialized tick-arrays in the primary range.
    pub tick_array_bitmap: [u64; 16],

    // Reserved padding for future upgrades.
    pub padding6: [u64; 4],

    pub fund_fees_token_0: u64,
    pub fund_fees_token_1: u64,

    pub open_time:    u64,                 // currently disabled by the program
    pub recent_epoch: u64,

    // Per-pool dynamic-fee state. Zero-valued unless the pool was
    // created with `enable_dynamic_fee = true` via create_customizable_pool.
    pub dynamic_fee_info: DynamicFeeInfo,

    // Reserved for future upgrades.
    pub padding1: [u64; 14],
    pub padding2: [u64; 32],
}
Các trường bạn sẽ thực sự cần đến:
  • sqrt_price_x64tick_current là trạng thái giá của pool. Cả hai được cập nhật đồng thời sau mỗi lần swap. tick_current là phần nguyên của log_{1.0001}(price).
  • liquidity là thanh khoản đang hoạt động — tổng giá trị L của tất cả các vị thế có phạm vi chứa tick_current. Giá trị này thay đổi mỗi khi swap vượt qua một tick và mỗi khi một vị thế được mở/đóng/thay đổi kích thước.
  • fee_growth_global_{0,1}_x64 là phí tích lũy thu được trên mỗi đơn vị thanh khoản trong toàn bộ lịch sử pool. Các vị thế đọc giá trị này để tính toán phí mà họ được nhận.
  • tick_spacing được khóa theo AmmConfig khi khởi tạo và không bao giờ thay đổi. Nó xác định những chỉ số tick nào được phép là điểm đầu/cuối của vị thế.
  • tick_array_bitmap là bitmap nội tuyến bao phủ phạm vi tick thường dùng quanh giá spot. Với các pool có vị thế trải dài ra xa, việc theo dõi tràn được thực hiện trong TickArrayBitmapExtension riêng biệt.
  • fee_on được cố định khi tạo pool. Giá trị 0 (FromInput) tái hiện hành vi Uniswap-V3 cổ điển. Giá trị 12 định tuyến phí swap về một phía duy nhất của sổ lệnh — xem products/clmm/fees để biết các đánh đổi.
  • dynamic_fee_info lưu trạng thái biến động cho phần phụ phí động. Khi được bật, mỗi lần swap sẽ tính toán lại dynamic_fee_component cộng thêm vào AmmConfig.trade_fee_rate. Cấu trúc được tài liệu hóa trong phần DynamicFeeInfo bên dưới; các pool không dùng phí động sẽ để toàn bộ struct này bằng không.

AmmConfig

pub struct AmmConfig {
    pub bump: u8,
    pub index: u16,                       // uses "amm_config"+u16 seed

    pub owner:             Pubkey,        // admin
    pub protocol_fee_rate: u32,           // fraction of trade fee to protocol, denom 1e6
    pub trade_fee_rate:    u32,           // trade fee in 1e6ths of volume
    pub tick_spacing:      u16,           // default spacing for pools using this config
    pub fund_fee_rate:     u32,           // fraction of trade fee to fund, denom 1e6
    pub padding_u32: u32,

    pub fund_owner: Pubkey,
    pub padding: [u64; 3],
}
Bộ fee tier CLMM tiêu biểu đã được công bố (xác nhận lại tại GET https://api-v3.raydium.io/main/clmm-config):
Indextrade_fee_rateTick spacingTrường hợp dùng
0100 (0,01%)1Cặp stablecoin, USDC/USDT
1500 (0,05%)10Blue-chip tương quan
22_500 (0,25%)60Cặp tiêu chuẩn
310_000 (1,00%)120Token biến động mạnh hoặc long-tail
protocol_fee_ratefund_fee_rate là phần trăm của phí giao dịch; quy ước giống CPMM. Xem products/clmm/fees.

TickArrayState

CLMM không lưu một bản ghi riêng cho mỗi tick — làm vậy sẽ tạo ra hàng tỷ tài khoản. Thay vào đó, nó nhóm TICK_ARRAY_SIZE tick liền kề (thường là 60 hoặc 88 tùy phiên bản chương trình) vào một TickArrayState được tạo lười khi lần đầu sử dụng.
pub const TICK_ARRAY_SIZE: usize = 60;
pub const TICK_ARRAY_SIZE_USIZE: usize = 60;

pub struct TickArrayState {
    pub pool_id:                Pubkey,
    pub start_tick_index:       i32,                            // lowest tick in this array
    pub ticks:                  [TickState; TICK_ARRAY_SIZE],   // 60 entries
    pub initialized_tick_count: u8,
    pub recent_epoch:           u64,
    pub padding:                [u8; 107],
}

pub struct TickState {
    pub tick:                       i32,
    pub liquidity_net:              i128,                       // ΔL when crossing this tick upward
    pub liquidity_gross:            u128,                       // total L referencing this tick
    pub fee_growth_outside_0_x64:   u128,                       // see math.mdx
    pub fee_growth_outside_1_x64:   u128,
    pub reward_growths_outside_x64: [u128; 3],

    // Limit-order bookkeeping. All zero for ticks that have never carried
    // a limit order. See products/clmm/math for the matching algorithm.
    pub order_phase:                  u64,                      // monotonic FIFO cohort id
    pub orders_amount:                u64,                      // unfilled tokens in current cohort
    pub part_filled_orders_remaining: u64,                      // remaining tokens of partially-filled cohort
    pub unfilled_ratio_x64:           u128,                     // Q64.64; starts at 1.0 and shrinks as fills occur

    pub padding:                    [u32; 3],
}
Bốn trường limit-order đều bằng không trên bất kỳ tick nào chưa từng được dùng cho lệnh giới hạn. Khi các lệnh được mở trên một tick, chương trình theo dõi chúng theo chuỗi cohort:
  • order_phase là id của cohort. Nó tăng lên mỗi khi một cohort chuyển từ trạng thái “chưa khớp lệnh nào” sang “đã khớp một phần.”
  • orders_amount là tổng token đầu vào của cohort hiện tại (mới nhất).
  • part_filled_orders_remaining theo dõi cohort trước đó đang được các swap tiếp theo lấp đầy dần.
  • unfilled_ratio_x64 là hệ số nhân Q64.64 gắn với cohort: khi một swap lấp đầy X% cohort, tỷ lệ này được nhân với (1 − X). Mỗi lệnh mở lưu snapshot (order_phase, unfilled_ratio_x64) của riêng mình tại thời điểm mở, nên toán học thanh toán chỉ đơn giản là so sánh các snapshot.
Các quy tắc:
  • Tick điểm đầu/cuối t của một vị thế phải thỏa mãn t % tick_spacing == 0. Chương trình từ chối các vị thế có tick không đúng khoảng cách.
  • Mảng chứa tick được xác định tại floor(t / (TICK_ARRAY_SIZE * tick_spacing)) * (TICK_ARRAY_SIZE * tick_spacing).
  • Tick array được khởi tạo lười: vị thế hoặc swap đầu tiên chạm vào một mảng chưa khởi tạo sẽ tạo ra nó và trả tiền thuê.
  • Tick array không bao giờ bị đóng bởi chương trình. Sau khi được phân bổ, nó tồn tại suốt vòng đời của pool, ngay cả khi mọi tick bên trong đã về lại liquidity_gross == 0. Các vị thế và swap sau này tái sử dụng tài khoản đã có mà không mất thêm tiền thuê. Không có luồng dọn dẹp nào cho tick array liên kết với ClosePosition.

TickArrayBitmapExtension

PoolState.tick_array_bitmap (nội tuyến) bao phủ phạm vi “gần giá spot” — ±1.024 tick array. Ngoài phạm vi đó (với các giá trị tick cực đoan), chương trình duy trì một tài khoản mở rộng:
pub struct TickArrayBitmapExtension {
    pub pool_id: Pubkey,
    pub positive_tick_array_bitmap: [[u64; 8]; 14],
    pub negative_tick_array_bitmap: [[u64; 8]; 14],
}
Nếu phạm vi vị thế của bạn là “bình thường”, bạn không cần quan tâm đến tài khoản mở rộng này. Các vị thế full-range (ví dụ (MIN_TICK, MAX_TICK)) yêu cầu nó; SDK sẽ tự xử lý cho bạn.

Vị thế

Một vị thế CLMM là một bộ gồm ba tài khoản cộng với một mint:

NFT mint của vị thế

Một SPL Token mint với supply bằng 1. Địa chỉ mint là một PDA xác định; NFT vị thế trong ví của chủ sở hữu chỉ là một ATA giữ token duy nhất đó. Việc chuyển NFT là cách một vị thế đổi chủ — chương trình ủy quyền cho người đang nắm giữ số dư ATA của NFT, không phải Pubkey lưu trong state.

PersonalPositionState

Một tài khoản cho mỗi vị thế đang mở. Được lập chỉ mục theo NFT mint.
pub struct PersonalPositionState {
    pub bump: [u8; 1],
    pub nft_mint: Pubkey,                 // this position's NFT mint
    pub pool_id:  Pubkey,

    pub tick_lower_index: i32,
    pub tick_upper_index: i32,

    pub liquidity: u128,                  // this position's L

    // Fee-growth snapshots at last time the position was touched.
    pub fee_growth_inside_0_last_x64: u128,
    pub fee_growth_inside_1_last_x64: u128,
    pub token_fees_owed_0: u64,           // accrued since last collect
    pub token_fees_owed_1: u64,

    pub reward_infos: [PositionRewardInfo; 3],
    pub recent_epoch: u64,
    pub padding: [u64; 7],
}

pub struct PositionRewardInfo {
    pub growth_inside_last_x64: u128,
    pub reward_amount_owed: u64,
}

ProtocolPositionState (đã lỗi thời)

Các phiên bản CLMM cũ lưu dữ liệu tổng hợp theo (pool, tick_lower, tick_upper) trong một PDA ProtocolPositionState. Các phiên bản mới hơn không còn tạo hay đọc tài khoản này nữa. Slot vẫn xuất hiện trong danh sách tài khoản của OpenPosition / IncreaseLiquidity / DecreaseLiquidity dưới dạng UncheckedAccount để tương thích ABI, nhưng chương trình không ghi vào đó. Các tài khoản tồn tại sẵn on-chain chỉ là di vật; admin có thể gọi CloseProtocolPosition để thu hồi tiền thuê.Dữ liệu tổng hợp theo phạm vi hiện được suy ra trực tiếp từ hai tick điểm đầu/cuối (liquidity_gross, liquidity_netfee_growth_outside_* / reward_growths_outside_x64 theo từng tick) trong TickArrayState. Công thức fee-growth-inside fee_growth_inside = global − outside_lower − outside_upper vẫn hoạt động đúng mà không cần tài khoản vị thế tổng hợp.

Observation

pub const OBSERVATION_NUM: usize = 100;

pub struct Observation {
    pub block_timestamp: u32,
    pub tick_cumulative: i64,                            // Σ tick_current × Δt
    pub padding:         [u64; 4],
}

pub struct ObservationState {
    pub initialized:       bool,
    pub recent_epoch:      u64,
    pub observation_index: u16,
    pub pool_id:           Pubkey,
    pub observations:      [Observation; OBSERVATION_NUM], // 100 entries
    pub padding:           [u64; 4],
}
Buffer observation của CLMM lưu tick tích lũy, không phải giá tích lũy. Các ứng dụng bên ngoài tính giá trung bình hình học trong một khoảng thời gian từ (tick_cumulative[t1] − tick_cumulative[t0]) / (t1 − t0) rồi price = 1.0001 ** tick. Xem algorithms/clmm-math.

DynamicFeeConfigDynamicFeeInfo

Tham số phí động được lưu ở hai nơi. Template có thể tái sử dụng — DynamicFeeConfig — do admin quản lý và dùng chung cho các pool đăng ký. Trạng thái runtime theo từng pool — DynamicFeeInfo — được nhúng trong PoolState và cập nhật sau mỗi lần swap.

DynamicFeeConfig

// programs/amm/src/states/pool_fee.rs
pub struct DynamicFeeConfig {
    pub index:                       u16,    // identifier; PDA seed component
    pub filter_period:               u16,    // seconds — within this window the volatility reference is held
    pub decay_period:                u16,    // seconds — beyond this window the reference fully decays
    pub reduction_factor:            u16,    // fixed-point in [1, 10_000); applied at decay
    pub dynamic_fee_control:         u32,    // fixed-point in (0, 100_000); fee-rate gain
    pub max_volatility_accumulator:  u32,    // ceiling on the volatility accumulator
    pub padding:                     [u64; 8],
}
PDA seed: ["dynamic_fee_config", index.to_be_bytes()]. Được tạo qua create_dynamic_fee_config (chỉ admin) và sửa đổi qua update_dynamic_fee_config. Một pool tạo với enable_dynamic_fee = true sẽ sao chép năm tham số hiệu chỉnh của config (filter_period, decay_period, reduction_factor, dynamic_fee_control, max_volatility_accumulator) vào DynamicFeeInfo của chính nó tại thời điểm tạo; các chỉnh sửa sau đó đối với DynamicFeeConfig không ảnh hưởng đến các pool đã có.

DynamicFeeInfo (nhúng trong PoolState)

pub struct DynamicFeeInfo {
    pub filter_period:                u16,
    pub decay_period:                 u16,
    pub reduction_factor:             u16,
    pub dynamic_fee_control:          u32,
    pub max_volatility_accumulator:   u32,
    pub tick_spacing_index_reference: i32,    // tick-spacing-units; reference for next swap
    pub volatility_reference:         u32,    // running floor for the accumulator
    pub volatility_accumulator:       u32,    // current cumulative volatility (capped)
    pub last_update_timestamp:        u64,
    pub padding:                      [u8; 46],
}
Bốn trường cuối là state; năm trường đầu là tham số hiệu chỉnh sao chép từ DynamicFeeConfig. Toán học phí và quy tắc decay được tài liệu hóa tại products/clmm/mathproducts/clmm/fees. Các hằng số sử dụng trong công thức:
Hằng sốGiá trịÝ nghĩa
VOLATILITY_ACCUMULATOR_SCALE10_000Độ phân giải của bộ tích lũy biến động
REDUCTION_FACTOR_DENOMINATOR10_000Mẫu số cho reduction_factor
DYNAMIC_FEE_CONTROL_DENOMINATOR100_000Mẫu số cho dynamic_fee_control
MAX_FEE_RATE_NUMERATOR100_000Giới hạn cứng 10% cho tỷ lệ phí kết quả

LimitOrderState

Một tài khoản cho mỗi lệnh giới hạn đang mở.
// programs/amm/src/states/limit_order.rs
pub struct LimitOrderState {
    pub pool_id:            Pubkey,
    pub owner:              Pubkey,
    pub tick_index:         i32,
    pub zero_for_one:       bool,    // direction: true sells token0 for token1
    pub order_phase:        u64,     // snapshot of TickState.order_phase at open time
    pub total_amount:       u64,     // input-token amount placed
    pub filled_amount:      u64,     // informational; computed precisely on settle
    pub settle_base:        u64,     // unfilled remainder at last settle/decrease
    pub settled_output:     u64,     // cumulative output-token paid to owner
    pub open_time:          u64,
    pub unfilled_ratio_x64: u128,    // Q64.64 snapshot of TickState.unfilled_ratio_x64 at open
    pub padding:            [u64; 4],
}
Vòng đời:
  1. Mở — người dùng gọi open_limit_order, nạp total_amount token đầu vào, lệnh được gắn với một cohort TickState.
  2. (Tùy chọn) Tăng / Giảmincrease_limit_order tăng thêm vào total_amount; decrease_limit_order trả lại các token chưa khớp (và bất kỳ output đã thanh toán nào đến thời điểm đó).
  3. Thanh toán — khi cohort được lấp đầy toàn bộ hoặc một phần, chủ sở hữu hoặc keeper vận hành gọi settle_limit_order để đẩy token output vào ATA của chủ sở hữu.
  4. Đóng — khi unfilled_amount == 0, tài khoản có thể đóng. Tiền thuê luôn trả về cho owner.
PDA seed: [owner.as_ref(), limit_order_nonce.key().as_ref(), limit_order_nonce.order_nonce.to_be_bytes().as_ref()]. PDA lệnh do đó là duy nhất theo (owner, nonce_index, order_nonce).

LimitOrderNonce

Bộ đếm theo (wallet, nonce_index) cho phép một người dùng chạy nhiều pipeline lệnh giới hạn song song mà không bị xung đột PDA.
pub struct LimitOrderNonce {
    pub user_wallet: Pubkey,
    pub nonce_index: u8,             // user-chosen, 0..255
    pub order_nonce: u64,            // monotonic, incremented every time a new order is opened
    pub padding:     [u64; 4],
}
PDA seed: [user_wallet.as_ref(), &[nonce_index]]. Hầu hết các client dùng nonce_index = 0 và để order_nonce đảm nhận vai trò đếm số lượng.

Suy ra các tài khoản chính

import { PublicKey } from "@solana/web3.js";

const CLMM_PROGRAM_ID = new PublicKey(
  "CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK"
); // see reference/program-addresses

function i32ToBytes(n: number): Buffer {
  const b = Buffer.alloc(4);
  b.writeInt32BE(n);
  return b;
}

export function deriveClmmAccounts(
  ammConfig: PublicKey,
  token0Mint: PublicKey,           // must already be sorted
  token1Mint: PublicKey,
) {
  const [poolState] = PublicKey.findProgramAddressSync(
    [Buffer.from("pool"), ammConfig.toBuffer(),
     token0Mint.toBuffer(), token1Mint.toBuffer()],
    CLMM_PROGRAM_ID,
  );
  const [observation] = PublicKey.findProgramAddressSync(
    [Buffer.from("observation"), poolState.toBuffer()],
    CLMM_PROGRAM_ID,
  );
  const [tickArrayBitmapExtension] = PublicKey.findProgramAddressSync(
    [Buffer.from("pool_tick_array_bitmap_extension"), poolState.toBuffer()],
    CLMM_PROGRAM_ID,
  );
  return { poolState, observation, tickArrayBitmapExtension };
}

export function deriveTickArray(
  pool: PublicKey,
  startTickIndex: number,
) {
  const [tickArray] = PublicKey.findProgramAddressSync(
    [Buffer.from("tick_array"), pool.toBuffer(), i32ToBytes(startTickIndex)],
    CLMM_PROGRAM_ID,
  );
  return tickArray;
}

export function deriveDynamicFeeConfig(index: number) {
  const idx = Buffer.alloc(2);
  idx.writeUInt16BE(index);
  const [pda] = PublicKey.findProgramAddressSync(
    [Buffer.from("dynamic_fee_config"), idx],
    CLMM_PROGRAM_ID,
  );
  return pda;
}

export function deriveLimitOrderNonce(
  wallet: PublicKey,
  nonceIndex: number,
) {
  const [pda] = PublicKey.findProgramAddressSync(
    [wallet.toBuffer(), Buffer.from([nonceIndex & 0xff])],
    CLMM_PROGRAM_ID,
  );
  return pda;
}

export function deriveLimitOrder(
  wallet: PublicKey,
  nonceAccount: PublicKey,
  orderNonce: bigint,
) {
  const nonceBytes = Buffer.alloc(8);
  nonceBytes.writeBigUInt64BE(orderNonce);
  const [pda] = PublicKey.findProgramAddressSync(
    [wallet.toBuffer(), nonceAccount.toBuffer(), nonceBytes],
    CLMM_PROGRAM_ID,
  );
  return pda;
}

export function derivePersonalPosition(nftMint: PublicKey) {
  const [personalPosition] = PublicKey.findProgramAddressSync(
    [Buffer.from("position"), nftMint.toBuffer()],
    CLMM_PROGRAM_ID,
  );
  return personalPosition;
}
Các chuỗi seed chính xác nên luôn được kiểm tra lại với IDL on-chain và reference/program-addresses.

Tham chiếu nhanh vòng đời

Sự kiệnTài khoản được tạoTài khoản bị hủy
CreatePoolpoolState, observation, token_0_vault, token_1_vault
OpenPosition[WithToken22Nft]NFT mint + ATA, personalPosition, có thể thêm tickArrayState(s) mới, tickArrayBitmapExtension nếu chưa có
IncreaseLiquidityCó thể thêm tickArrayState(s) mới
DecreaseLiquidityCó thể xóa các mục tick (nhưng tickArrayState không bị đóng)
ClosePositionNFT mint, personalPosition
SwapV2Có thể thêm tickArrayState mới
OpenLimitOrderlimitOrderState, có thể limitOrderNonce (init-if-needed), có thể thêm tickArrayState mới
IncreaseLimitOrder
DecreaseLimitOrderĐóng limitOrderState nếu lệnh đã được thực hiện hết
SettleLimitOrder
CloseLimitOrderlimitOrderState (tiền thuê → owner)
CreateDynamicFeeConfigdynamicFeeConfig
CreateCustomizablePoolpoolState, observation, các vault — giống CreatePool. Sao chép dynamicFeeConfig nếu enable_dynamic_fee = true.
CollectRewards
UpdateRewardInfos
CloseProtocolPosition (admin)protocolPositionState di vật (tiền thuê → admin)
Các tài khoản TickArrayState không bao giờ bị đóng bởi chương trình — chúng tồn tại suốt vòng đời của pool. Sau khi một tick array đã được khởi tạo, nó vẫn ở trên chain ngay cả khi mọi tick bên trong đã về lại liquidity_gross == 0. Tái sử dụng tick array đã có là miễn phí; chỉ vị thế đầu tiên chạm vào một mảng chưa khởi tạo mới phải trả tiền thuê.

Đọc thêm ở đâu

Nguồn tham khảo: