Core instruction surface
Find actual entrypoints, argument contracts, and the operations each hook observes.

Source: programs/grapl-amm/src/lib.rs. The Pool 6 source increment defines 19 instructions and four Anchor account types. Generate clients from the matching hook ABI 4 / Pool 6 build; this overview is not a substitute for the Anchor account order. See current validation status.
Issuance and market creation
| Entrypoint | Arguments | Behavior |
|---|---|---|
create_token | CreateTokenArgs | Issues an independent classic SPL token; no implicit pool or metadata |
initialize_pool | InitializePoolArgs | Creates a direct CLMM, directory, vaults, and optional hook binding |
initialize_curve | InitializePoolArgs, CurveConfiguration | Creates curve mode and deposits real base inventory |
initialize_tick_array | InitializeTickArrayArgs | Creates a canonical fixed or compact tick page |
reserve_tick_array | capacity: u8 | Funds rent and grows an existing compact page |
InitializePoolArgs contains pool_id: u64, sqrt_price_x64: u128, configuration: PoolConfiguration, hook_payload: Vec<u8>, and hook_accounts: Vec<HookAccountAccess>. Curve initialization derives the initial price from the virtual-reserve configuration.
See token factory and bonding curve for their parameter tables and authority decisions.
Positions and fees
| Entrypoint | Arguments | Behavior |
|---|---|---|
open_position | OpenPositionArgs | Creates an owner-bound empty position with a valid range |
close_position | None | Closes only when liquidity and both owed fee amounts are zero |
modify_liquidity | ModifyLiquidityArgs | Adds/removes signed liquidity and settles principal |
collect_position_fees | None | Crystallizes and transfers LP fees without changing liquidity |
collect_beneficiary_fees | beneficiary_index: u8 | Pays the selected beneficiary's accrued A/B debt to that signer |
initialize_protocol_treasury | recipient: Pubkey | Initializes the immutable global recipient through the program's upgrade authority |
collect_protocol_fees | None | Pays one pool's protocol A/B debt to the treasury recipient; preserves fractional carry |
donate | DonateArgs | Adds to active LP fee growth without minting liquidity |
OpenPositionArgs contains position_id: u64, tick_lower: i32, and tick_upper: i32. Opening is not a deposit.
ModifyLiquidityArgs contains liquidity_delta: i128, limit_a: u64, limit_b: u64, hook_payload, and hook_accounts. Positive deltas add principal subject to maximum deposits; negative deltas withdraw principal subject to minimum outputs. Public liquidity deposits are unavailable while the pool remains in curve mode.
DonateArgs contains amount_a: u64, amount_b: u64, hook_payload, and hook_accounts. At least one amount must be nonzero; LP accrual needs active liquidity.
Swaps and composition
| Entrypoint | Arguments | Behavior |
|---|---|---|
swap | SwapArgs | ExactIn; reports consumed input, net output, and unspent budget |
swap_exact_out | ExactOutArgs | Exact net output with a maximum gross input |
zap_in | ZapInArgs | Swaps a caller-selected amount, then funds the owned CLMM position |
zap_out | ZapOutArgs | Removes principal, then converts the withdrawn side into one asset |
graduate_curve | GraduateCurveArgs | Converts the eligible curve into a full-range CLMM in one atomic instruction |
collect_curve_remainder | None | Lets the creator collect recorded leftover assets after graduation |
SwapArgs contains amount_in: u64, minimum_out: u64, sqrt_price_limit_x64: u128, a_to_b: bool, hook_payload, and hook_accounts. Reaching a CLMM price limit may leave input unspent. Metis rejects incomplete ExactIn quotes.
ExactOutArgs replaces the amount fields with maximum_in: u64 and amount_out: u64; the target is net of a hook output fee. The direction, price limit, payload, and descriptors remain explicit. An incomplete ExactOut fails.
See swap semantics and zaps for user limits and callback order. Graduation uses add-liquidity callbacks, preserves the market identity, and creates a position owned by the stored creator. It is separate from the last curve swap.
Pool configuration
| Field | Validation or meaning |
|---|---|
mode | 0: CLMM; 1: virtual-reserve curve through initialize_curve |
tick_spacing | 1..=32768 |
trade_fee_ppm | At most the immutable max_fee_ppm |
max_fee_ppm | At most 990000 ppm, or 99% |
lp_share_bps + beneficiary shares | Exactly 10000 basis points of the remainder after mandatory protocol retention |
beneficiaries | Four slots; nonzero recipient iff nonzero share; recipients unique |
hook_capabilities | Supported lifecycle bits/profile and bounded account permissions |
max_output_fee_ppm in hook permissions | Separate output-deduction cap; defaults to zero |
These are validation bounds, not recommended economic settings. Share weights use basis points; swap fee rates use parts per million.
The fixed 1,000 bps protocol share is enforced before the configured remainder split and is not a PoolConfiguration opt-out. Per-pool, per-mint carry preserves fractional protocol allocations. Donations and hook output deductions follow separate paths. Read fee accounting.
Remaining accounts
Swap and modify-liquidity use ascending signed tick-page indices first, then hook extras in descriptor order. Each page is validated against the pool and canonical address. Collect-position-fees receives endpoint pages. Other hookable operations receive their corresponding extras.
A zap partitions remaining accounts into its two legs using an explicit count. Supply each leg's pages and hook extras under that leg's descriptors. Neither leg silently inherits the other's permissions.
For all methods, the Anchor Accounts structs define signer, owner, mint, mutability, and PDA constraints. General custom hook deltas, automatic compounding, and position transfer are not part of the instruction surface.