Reference

Reference

Addresses, accounts, instructions, constants, errors and events of the Proglet program, as the SDK exposes them.

PDAs

configPda()["config"]Global config: admin, crank authority, treasury, borrow_paused.
poolPda(mint)["pool", mint]The coin's pool. Its lamports are the SOL reserve.
poolTokenVault(mint)ATA(pool, mint)Token-2022 account holding the pool's tokens, collateral and set-aside tokens.
teamFeeVaultPda(pool)["team_fee", pool]The pool's share of fees for the team, swept to the treasury.
creatorPda(mint)["creator", mint]The coin's pump.fun creator: collects its creator fees for buybacks.
positionPda(pool, owner)["position", pool, owner]A wallet's loan on one coin.

Accounts

Decode raw account data with decodePool, decodePosition and decodeGlobalConfig, or fetch with the client.

Pool

mint, tokenProgramPublicKeyThe coin and its token program (Token-2022).
solReserve, tokenReservebigintThe AMM reserves. Counters kept by the program, never read from balances.
crankBufferSol, crankBufferTokenbigintLiquidity waiting to join the reserves at the pool's ratio.
totalDebt, totalCollateral, totalLoanReserveTokenbigintLending totals.
createdSlot, lastSwapSlotbigintWhen the pool got its first liquidity, and its last swap.
observations, oracleHeadObservation[]The price oracle: one pre-swap price per active slot (16 slots).
lendingOpenbooleanDerived: SOL reserve >= 0.1 SOL.

Position

owner, poolPublicKeyWho borrowed, from which pool.
collateralbigintTokens locked.
debtbigintLamports owed. Never grows: no interest.
loanReserveTokenbigintTokens the pool set aside with the loan; they return on repay.
openedSlotbigintSlot of the last borrow; repay opens MIN_LOAN_SLOTS later.

Instructions

swap(is_buy, amount_in, min_out)anyoneBuilder: swapInstructions.
quote_swap(is_buy, amount_in)read-onlySimulate for an on-chain quote: quoteSwapInstruction.
create_token(name, symbol, uri)anyoneLaunch a coin: createTokenInstruction.
borrow(collateral, debt, max_fee_bps)ownerOpen or add to a loan: borrowInstruction.
repay()ownerRepay all: repayInstruction.
repay_partial(amount)ownerRepay part: repayPartialInstruction.
liquidate()anyoneClose an unhealthy loan for a bonus: liquidateInstruction.
absorb()anyoneClose an underwater loan: absorbInstruction.
sweep()anyoneMove team fees to the treasury: sweepInstruction.
seed_liquidity, crank_buyback, crank_buyback_ammcrankBuybacks and first liquidity; only the crank authority.
initialize_config, update_configadminSet the crank authority, treasury and the new-loan pause.

Any instruction can be built from the bundled IDL with buildInstruction(name, accounts, args).

Constants

SWAP_FEE_BPS100nSwap fee: 1%.
TEAM_SHARE_BPS2000nTeam share of the swap fee: 20%.
MIN_POOL_SOL_FOR_LENDING100000000nPool depth for lending: 0.1 SOL.
MAX_LTV_BPS4000nMax loan: 40% of collateral value.
LIQUIDATION_RATIO_BPS15000nLiquidatable when collateral < 1.5x debt.
BORROW_CAP_BPS1500nA pool lends at most 15% of its SOL.
MIN_DEBT_LAMPORTS10000000nMinimum loan: 0.01 SOL.
LENDING_COOLDOWN_SLOTS150nNew pools wait this long before lending.
SAFE_PRICE_MIN_AGE_SLOTS10nHow old a price must be to count as safe.
MIN_LOAN_SLOTS2nA loan is repayable this many slots after it changes.
FEE_MIN_BPS / FEE_KINK_BPS / FEE_MAX_BPS100n / 300n / 1000nBorrow fee at empty, 80% used and full cap.
BONUS_MIN_BPS / BONUS_MAX_BPS250n / 1500nLiquidation bonus range.

Errors

Anchor numbers errors from 6000. A failed transaction shows them as custom program error: 0x... or by name in the logs.

NotAdmin6000Signer is not the config admin
NotCrankAuthority6001Signer is not the crank authority
EmptyPool6002Pool has no liquidity yet
InvalidSwapAmount6003Swap amount too small or exceeds the pool
SlippageExceeded6004Output is below min_out
ZeroLiquidity6005Liquidity amount is zero after keeping the pool ratio
NothingToSweep6006Nothing to sweep
TransferAmountMismatch6007Token amount received by the vault differs from the amount sent
InvalidBuybackAmount6008Buyback spend is zero or above the hard cap
InsufficientCreatorFunds6009Creator PDA does not hold enough SOL
NoTokensBought6010Buyback received no tokens
BuybackPriceDeviation6011pump.fun buyback price deviates too far from the pool's safe price
NotCanonicalPool6012Not the coin's canonical PumpSwap pool
BorrowPaused6013New loans are paused
LendingClosed6014Pool is below the minimum depth for lending
LendingCooldown6015Pool is too new for lending
DebtTooSmall6016Loan is below the minimum size
LtvExceeded6017Loan exceeds the max loan-to-value
BorrowCapExceeded6018Loan would exceed the pool's borrow cap
FeeAboveMax6019Fee is above the caller's max_fee_bps
RepayTooEarly6020Loan is too new to repay
NotLiquidatable6021Position is healthy
NotUnderwater6022Collateral still covers the debt
MathOverflow6023Math overflow
NothingToBorrow6024Nothing to add: collateral and debt are both zero
InvalidRepayAmount6025Partial repay must be above zero and below the debt; repay in full instead

Events

The program emits Anchor events (base64 Program data: log lines). The Data API decodes them for you.

rust
TokenCreated     { mint, pool, creator, user }
LiquidityAdded   { pool, sol_amount, token_amount, sol_reserve, token_reserve }
Swapped          { pool, user, is_buy, amount_in, amount_out, fee, team_fee, sol_reserve, token_reserve }
BuybackExecuted  { pool, sol_spent, tokens_bought }
Swept            { pool, amount }
Borrowed         { pool, owner, collateral, debt, fee, fee_bps, loan_reserve_token }
Repaid           { pool, owner, debt, collateral }
PartiallyRepaid  { pool, owner, amount, collateral, remaining_debt, remaining_collateral }
Liquidated       { pool, owner, liquidator, debt, tokens_to_liquidator, bonus_bps }
Absorbed         { pool, owner, bad_debt, tokens_to_pool }