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, tokenProgram | PublicKey | The coin and its token program (Token-2022). |
| solReserve, tokenReserve | bigint | The AMM reserves. Counters kept by the program, never read from balances. |
| crankBufferSol, crankBufferToken | bigint | Liquidity waiting to join the reserves at the pool's ratio. |
| totalDebt, totalCollateral, totalLoanReserveToken | bigint | Lending totals. |
| createdSlot, lastSwapSlot | bigint | When the pool got its first liquidity, and its last swap. |
| observations, oracleHead | Observation[] | The price oracle: one pre-swap price per active slot (16 slots). |
| lendingOpen | boolean | Derived: SOL reserve >= 0.1 SOL. |
Position
| owner, pool | PublicKey | Who borrowed, from which pool. |
| collateral | bigint | Tokens locked. |
| debt | bigint | Lamports owed. Never grows: no interest. |
| loanReserveToken | bigint | Tokens the pool set aside with the loan; they return on repay. |
| openedSlot | bigint | Slot of the last borrow; repay opens MIN_LOAN_SLOTS later. |
Instructions
| swap(is_buy, amount_in, min_out) | anyone | Builder: swapInstructions. |
| quote_swap(is_buy, amount_in) | read-only | Simulate for an on-chain quote: quoteSwapInstruction. |
| create_token(name, symbol, uri) | anyone | Launch a coin: createTokenInstruction. |
| borrow(collateral, debt, max_fee_bps) | owner | Open or add to a loan: borrowInstruction. |
| repay() | owner | Repay all: repayInstruction. |
| repay_partial(amount) | owner | Repay part: repayPartialInstruction. |
| liquidate() | anyone | Close an unhealthy loan for a bonus: liquidateInstruction. |
| absorb() | anyone | Close an underwater loan: absorbInstruction. |
| sweep() | anyone | Move team fees to the treasury: sweepInstruction. |
| seed_liquidity, crank_buyback, crank_buyback_amm | crank | Buybacks and first liquidity; only the crank authority. |
| initialize_config, update_config | admin | Set 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_BPS | 100n | Swap fee: 1%. |
| TEAM_SHARE_BPS | 2000n | Team share of the swap fee: 20%. |
| MIN_POOL_SOL_FOR_LENDING | 100000000n | Pool depth for lending: 0.1 SOL. |
| MAX_LTV_BPS | 4000n | Max loan: 40% of collateral value. |
| LIQUIDATION_RATIO_BPS | 15000n | Liquidatable when collateral < 1.5x debt. |
| BORROW_CAP_BPS | 1500n | A pool lends at most 15% of its SOL. |
| MIN_DEBT_LAMPORTS | 10000000n | Minimum loan: 0.01 SOL. |
| LENDING_COOLDOWN_SLOTS | 150n | New pools wait this long before lending. |
| SAFE_PRICE_MIN_AGE_SLOTS | 10n | How old a price must be to count as safe. |
| MIN_LOAN_SLOTS | 2n | A loan is repayable this many slots after it changes. |
| FEE_MIN_BPS / FEE_KINK_BPS / FEE_MAX_BPS | 100n / 300n / 1000n | Borrow fee at empty, 80% used and full cap. |
| BONUS_MIN_BPS / BONUS_MAX_BPS | 250n / 1500n | Liquidation bonus range. |
Errors
Anchor numbers errors from 6000. A failed transaction shows them as custom program error: 0x... or by name in the logs.
| NotAdmin | 6000 | Signer is not the config admin |
| NotCrankAuthority | 6001 | Signer is not the crank authority |
| EmptyPool | 6002 | Pool has no liquidity yet |
| InvalidSwapAmount | 6003 | Swap amount too small or exceeds the pool |
| SlippageExceeded | 6004 | Output is below min_out |
| ZeroLiquidity | 6005 | Liquidity amount is zero after keeping the pool ratio |
| NothingToSweep | 6006 | Nothing to sweep |
| TransferAmountMismatch | 6007 | Token amount received by the vault differs from the amount sent |
| InvalidBuybackAmount | 6008 | Buyback spend is zero or above the hard cap |
| InsufficientCreatorFunds | 6009 | Creator PDA does not hold enough SOL |
| NoTokensBought | 6010 | Buyback received no tokens |
| BuybackPriceDeviation | 6011 | pump.fun buyback price deviates too far from the pool's safe price |
| NotCanonicalPool | 6012 | Not the coin's canonical PumpSwap pool |
| BorrowPaused | 6013 | New loans are paused |
| LendingClosed | 6014 | Pool is below the minimum depth for lending |
| LendingCooldown | 6015 | Pool is too new for lending |
| DebtTooSmall | 6016 | Loan is below the minimum size |
| LtvExceeded | 6017 | Loan exceeds the max loan-to-value |
| BorrowCapExceeded | 6018 | Loan would exceed the pool's borrow cap |
| FeeAboveMax | 6019 | Fee is above the caller's max_fee_bps |
| RepayTooEarly | 6020 | Loan is too new to repay |
| NotLiquidatable | 6021 | Position is healthy |
| NotUnderwater | 6022 | Collateral still covers the debt |
| MathOverflow | 6023 | Math overflow |
| NothingToBorrow | 6024 | Nothing to add: collateral and debt are both zero |
| InvalidRepayAmount | 6025 | Partial 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 }