import * as _solana_web3_js from '@solana/web3.js'; import { PublicKey, AccountMeta as AccountMeta$1, Connection, AddressLookupTableAccount, TransactionInstruction, Transaction, Commitment, AccountInfo, Signer } from '@solana/web3.js'; import BigNumber$1 from 'bignumber.js'; import { Buffer as Buffer$1 } from 'buffer'; import { E as ExponentVault, a as ExponentCpiInterfaceContext, b as ExponentMarketTwo, R as ResolveExponentTradePtContextParams, c as ExponentTradePtContext, d as ExponentTradePtAccounts, G as GammaLpVaultRaw, e as GammaWithdrawReceiptRaw } from './types-BmLq23LD.cjs'; export { f as CrossbarSimulatePayload, C as CurrentResult, i as ExponentMarketTwoCpiAccounts, F as FeedResponse, O as OracleSubmission, P as PullFeedAccountData, S as SWITCHBOARD_ONDEMANDE_PRICE_PRECISION, h as decodeSwitchboardPullFeedData, g as getSwitchboardProgram, s as switchboardAccountCoder } from './types-BmLq23LD.cjs'; import { Program, BorshCoder, Address } from '@coral-xyz/anchor'; import { H as HistoricalOracleData, t as HistoricalIndexData, P as PoolBalance, I as InsuranceFund, F as FeeStructureJSON, O as OracleGuardRailsJSON, u as FeeStructure, v as OracleGuardRails, S as SpotPosition, e as DriftUserStats, o as DriftUserStatsJSON, c as DriftUser, m as DriftUserJSON, D as DriftSpotMarket, l as DriftSpotMarketJSON, d as DriftRewards, n as DriftRewardsJSON, w as DriftSpotBalanceType, J as JupLendingState, p as JupLendingStateJSON, f as JupTokenReserve, q as JupTokenReserveJSON, g as JupLendingRewardsRateModel, r as JupLendingRewardsRateModelJSON, h as JupRateModel, s as JupRateModelJSON, K as KaminoReserve, a as KaminoObligation, j as KaminoObligationJSON, i as KaminoReserveJSON, x as KaminoInterestRateBasis, y as KaminoBorrowRateCurvePoint, z as KaminoFarmRewardInfo, b as KaminoFarmState, k as KaminoFarmStateJSON } from './dto-farm.types-BAA9xrey.cjs'; export { ac as FeeTier, ad as FeeTierJSON, al as HistoricalIndexDataJSON, ak as HistoricalOracleDataJSON, an as InsuranceFundJSON, E as KaminoBorrowRateCurve, U as KaminoBorrowRateCurveJSON, V as KaminoBorrowRateCurvePointJSON, a6 as KaminoFarmRewardInfoJSON, a2 as KaminoFarmTokenInfo, a5 as KaminoFarmTokenInfoJSON, _ as KaminoObligationCollateral, a0 as KaminoObligationCollateralJSON, $ as KaminoObligationLiquidity, a1 as KaminoObligationLiquidityJSON, N as KaminoPythConfiguration, Z as KaminoPythConfigurationJSON, B as KaminoReserveCollateral, R as KaminoReserveCollateralJSON, C as KaminoReserveConfig, T as KaminoReserveConfigJSON, A as KaminoReserveLiquidity, Q as KaminoReserveLiquidityJSON, G as KaminoReserveTokenInfo, W as KaminoReserveTokenInfoJSON, a4 as KaminoRewardCurvePoint, a8 as KaminoRewardCurvePointJSON, a3 as KaminoRewardScheduleCurve, a7 as KaminoRewardScheduleCurveJSON, L as KaminoScopeConfiguration, X as KaminoScopeConfigurationJSON, M as KaminoSwitchboardConfiguration, Y as KaminoSwitchboardConfigurationJSON, ae as OrderFillerRewardStructure, af as OrderFillerRewardStructureJSON, am as PoolBalanceJSON, ag as PriceDivergenceGuardRails, ah as PriceDivergenceGuardRailsJSON, ao as SpotBalanceType, ap as SpotPositionJSON, aa as UserFeesFields, a9 as UserFeesJSON, ai as ValidityGuardRails, aj as ValidityGuardRailsJSON, ab as isSpotBalanceTypeVariant } from './dto-farm.types-BAA9xrey.cjs'; import BN from 'bn.js'; import Decimal from 'decimal.js'; import * as _solana_buffer_layout from '@solana/buffer-layout'; /** * Accounts required by `merge`. Most are read off the maturity's `Vault` account * (`mintYt`, `mintPt`, `escrowSy`, `syProgram`, `addressLookupTable`, `yieldPosition`, * `authority`); the `*Ata` accounts are the owner's token accounts. * * After maturity, `merge` burns PT only (the YT burn is skipped because the vault is * inactive) — but the YT accounts are still required by the instruction, so `ytSrcAta` * must be a valid (possibly empty, freshly-created) YT token account. */ interface ExponentMergeAccounts { /** Position owner / signer (the marginfi account authority). */ owner: PublicKey; /** Vault signer authority (`Vault.authority`). */ authority: PublicKey; /** The maturity vault address. */ vault: PublicKey; /** Owner's SY token account (destination of the redeemed SY). */ sySrcDstAta: PublicKey; /** `Vault.escrow_sy`. */ escrowSy: PublicKey; /** Owner's YT token account (source; empty/0 after maturity). */ ytSrcAta: PublicKey; /** Owner's PT token account (source; holds the withdrawn PT). */ ptSrcAta: PublicKey; /** `Vault.mint_yt`. */ mintYt: PublicKey; /** `Vault.mint_pt`. */ mintPt: PublicKey; /** `Vault.sy_program`. */ syProgram: PublicKey; /** `Vault.address_lookup_table`. */ addressLookupTable: PublicKey; /** `Vault.yield_position`. */ yieldPosition: PublicKey; /** SPL token program for PT/YT/SY mints (defaults to the classic token program). */ tokenProgram?: PublicKey; /** * SY-program CPI accounts (`get_sy_state` ++ `withdraw_sy`), pubkeys already resolved * from the vault's address lookup table. Appended after the 15 fixed accounts. */ remainingAccounts?: AccountMeta$1[]; } interface ResolveExponentMergeContextParams { connection: Connection; /** Position owner / signer (the marginfi account authority). */ owner: PublicKey; /** The maturity vault, or… */ vault?: PublicKey; /** …the `MarketTwo` address (its `vault` will be read). One of `vault`/`market` is required. */ market?: PublicKey; /** Token program for the PT/YT mints (Exponent's `merge` uses the classic Token program). */ ptYtTokenProgram?: PublicKey; /** Token program for the SY mint (may be token-2022). Defaults to classic Token. */ syTokenProgram?: PublicKey; } /** * Resolved inputs for `makeRollPtTx`, derived from the maturity `Vault`: the `merge` * accounts, the SY (underlying) token the swap leg consumes, and a helper to size the * redeemed SY amount from the vault's PT redemption rate. */ interface ExponentMergeContext { vaultAddress: PublicKey; vault: ExponentVault; mergeAccounts: ExponentMergeAccounts; /** * The vault's address lookup table — `merge`'s SY-CPI remaining accounts are referenced * by ALT index, so adding it to the transaction's lookup tables keeps the tx within size * limits. Add it to `MakeRollPtTxParams.addressLookupTableAccounts`. */ addressLookupTable: AddressLookupTableAccount; underlying: { mint: PublicKey; decimals: number; tokenProgram: PublicKey; }; /** * Native SY that `merge` yields for a given native PT amount, mirroring Exponent's * on-chain math: `floor(ptAmountNative × sy_for_pt / pt_supply)` * (`Vault::pt_redemption_rate`). Feed its result into `MakeRollPtTxParams.redeemedAmountNative`. */ computeRedeemedAmountNative(ptAmountNative: bigint): bigint; } /** * Accounts required by `strip` (SY → PT + YT). The first 15 are the fixed * `#[derive(Accounts)]` accounts; `remainingAccounts` are the flavor's `deposit_sy` CPI * accounts (resolved from the vault ALT by {@link ResolveExponentStripContextParams}). */ interface ExponentStripAccounts { /** Depositor / signer (the marginfi account authority). */ depositor: PublicKey; /** Vault signer authority (`Vault.authority`). */ authority: PublicKey; /** The vault address. */ vault: PublicKey; /** Owner's SY token account (source of the SY being stripped). */ sySrc: PublicKey; /** `Vault.escrow_sy`. */ escrowSy: PublicKey; /** Owner's YT token account (destination of the minted YT). */ ytDst: PublicKey; /** Owner's PT token account (destination of the minted PT). */ ptDst: PublicKey; /** `Vault.mint_yt`. */ mintYt: PublicKey; /** `Vault.mint_pt`. */ mintPt: PublicKey; /** `Vault.sy_program`. */ syProgram: PublicKey; /** `Vault.address_lookup_table`. */ addressLookupTable: PublicKey; /** `Vault.yield_position`. */ yieldPosition: PublicKey; /** SPL token program for PT/YT/SY mints (defaults to the classic Token program). */ tokenProgram?: PublicKey; /** SY-program CPI accounts (`deposit_sy`), pubkeys already resolved from the vault ALT. */ remainingAccounts?: AccountMeta$1[]; } interface ResolveExponentStripContextParams { connection: Connection; /** Depositor / signer (the marginfi account authority). */ owner: PublicKey; /** The (active, successor) vault to strip into, or… */ vault?: PublicKey; /** …its `MarketTwo` address (its `vault` will be read). One of `vault`/`market` is required. */ market?: PublicKey; /** Token program for the PT/YT mints (Exponent uses the classic Token program). */ ptYtTokenProgram?: PublicKey; /** Token program for the SY mint. Defaults to classic Token. */ syTokenProgram?: PublicKey; } /** * Resolved inputs for `strip` (SY → PT + YT) on an Exponent vault: the strip accounts * (incl. the ALT-derived `deposit_sy` remaining accounts), the vault ALT to add to the * transaction's lookup tables, the SY/PT/YT token info, and a helper to size the minted PT. */ interface ExponentStripContext { vaultAddress: PublicKey; vault: ExponentVault; stripAccounts: ExponentStripAccounts; /** The vault's address lookup table — must be carried by the transaction. */ addressLookupTable: AddressLookupTableAccount; sy: { mint: PublicKey; decimals: number; tokenProgram: PublicKey; }; pt: { mint: PublicKey; decimals: number; tokenProgram: PublicKey; }; yt: { mint: PublicKey; tokenProgram: PublicKey; }; /** Last-seen SY exchange rate (underlying per SY), from `Vault.last_seen_sy_exchange_rate`. */ syExchangeRate: number; /** * Native PT `strip` mints for a given native SY in: `floor(syIn × last_seen_sy_exchange_rate)`. * The last-seen rate can lag the live rate slightly, so apply a small safety buffer (the * minted PT is also the YT amount). Use the result as `MakeRollPtTxParams.ptOutNative`. */ computeStrippedPtNative(syInNative: bigint): bigint; } /** * Accounts required by `wrapper_merge` — the core instruction that merges PT **and** * redeems the resulting SY into the underlying **base** token in one go (so the buy leg can * swap a normal token, not the un-swappable SY). The 16 fixed accounts mirror the IDL's * `WrapperMerge` struct (same vault-side fields as `merge`, minus the SY destination order); * `remainingAccounts` is the assembled `[...redeem, ...cpi]` list and `redeemSyAccountsUntil` * marks the boundary between them. */ interface ExponentWrapperMergeAccounts { /** Position owner / signer (the marginfi account authority). */ owner: PublicKey; /** Owner's SY token account (intermediate; the redeem consumes it). */ syAta: PublicKey; /** The maturity vault address. */ vault: PublicKey; /** `Vault.escrow_sy`. */ escrowSy: PublicKey; /** Owner's YT token account (source; empty/0 after maturity). */ ytAta: PublicKey; /** Owner's PT token account (source; holds the withdrawn PT). */ ptAta: PublicKey; /** `Vault.mint_yt`. */ mintYt: PublicKey; /** `Vault.mint_pt`. */ mintPt: PublicKey; /** `Vault.authority`. */ authority: PublicKey; /** `Vault.address_lookup_table`. */ addressLookupTable: PublicKey; /** `Vault.yield_position` (the vault robot yield position). */ yieldPosition: PublicKey; /** `Vault.sy_program`. */ syProgram: PublicKey; /** SPL token program for the PT/YT/SY mints (defaults to classic Token). */ tokenProgram?: PublicKey; /** * Assembled SY-program remaining accounts: the flavor's `redeem_sy` accounts first * (count = `redeemSyAccountsUntil`), then the vault's deduped `withdraw_sy ++ get_sy_state` * CPI accounts. The redeem's first account is the owner and keeps its signer flag. */ remainingAccounts: AccountMeta$1[]; /** Number of leading `remainingAccounts` that are the flavor redeem accounts. */ redeemSyAccountsUntil: number; } interface ResolveExponentWrapperMergeContextParams { connection: Connection; /** Position owner / signer (the marginfi account authority). */ owner: PublicKey; /** The maturity vault, or… */ vault?: PublicKey; /** …the `MarketTwo` address (its `vault` is read). One of `vault`/`market` is required. */ market?: PublicKey; /** * The flavor's underlying **base** token (e.g. bulkSOL). Required — it isn't on the * vault; the caller supplies it (config). The redeem unwraps SY into this token. */ baseMint: PublicKey; /** Token program for the base mint (defaults to classic Token). */ baseTokenProgram?: PublicKey; /** Token program for the PT/YT mints (Exponent uses classic Token). */ ptYtTokenProgram?: PublicKey; /** Token program for the SY mint (may be token-2022). Defaults to classic Token. */ syTokenProgram?: PublicKey; } /** * Resolved inputs for the roll's redeem leg: the `wrapper_merge` accounts, the SPL * stake-pool refresh that must run before it (so the SY↔base rate is current), the base * token the swap leg consumes, and a helper to size the redeemed base from the vault rates. */ interface ExponentWrapperMergeContext { vaultAddress: PublicKey; vault: ExponentVault; wrapperMergeAccounts: ExponentWrapperMergeAccounts; /** * Instruction(s) the flavor requires *before* `wrapper_merge` (for an SPL-stake-pool LST * like bulkSOL, the stake pool's `UpdateStakePoolBalance` refresh). Empty for flavors that * need none. */ preInstructions: TransactionInstruction[]; /** The vault's address lookup table — add it to the transaction's lookup tables. */ addressLookupTable: AddressLookupTableAccount; /** The redeemed underlying base token (swap-leg input). */ baseToken: { mint: PublicKey; decimals: number; tokenProgram: PublicKey; }; /** ATAs the bundle touches and must create idempotently (sy, pt, yt, base). */ setupMints: { mint: PublicKey; tokenProgram: PublicKey; }[]; /** * Native base the wrapper yields for a native PT amount: `merge` gives * `sy = floor(pt × sy_for_pt / pt_supply)`, then the redeem gives * `base = floor(sy × sy_exchange_rate)`. Feed into the swap-engine input sizing. */ computeRedeemedBaseNative(ptAmountNative: bigint): bigint; } /** * The SY-program CPI account lists a CLMM `trade_pt` appends as remaining accounts. * Order (from the SDK's `ixTradePt`): `getSyState` ++ `getPositionState` ++ `depositSy` * ++ `withdrawSy`, then de-duplicated. Each is referenced by an index into the market's * address lookup table. */ interface ExponentMarketThreeCpiAccounts { getSyState: ExponentCpiInterfaceContext[]; getPositionState: ExponentCpiInterfaceContext[]; depositSy: ExponentCpiInterfaceContext[]; withdrawSy: ExponentCpiInterfaceContext[]; } /** The subset of an Exponent `MarketThree` (CLMM) pool account that `trade_pt` needs. */ interface ExponentMarketThree { /** The pool's own address (`self_address` / the account key). */ selfAddress: PublicKey; mintPt: PublicKey; mintSy: PublicKey; vault: PublicKey; /** The single `ticks` account holding the pool's tick tree (not per-tick-array accounts). */ ticks: PublicKey; /** Pool PT liquidity escrow (`token_pt_escrow`). */ tokenPtEscrow: PublicKey; /** Pool SY liquidity escrow (`token_sy_escrow`). */ tokenSyEscrow: PublicKey; /** SY account holding treasury fees (`token_fee_treasury_sy`). */ tokenFeeTreasurySy: PublicKey; /** PT account holding treasury fees (`token_fee_treasury_pt`). */ tokenFeeTreasuryPt: PublicKey; addressLookupTable: PublicKey; syProgram: PublicKey; statusFlags: number; /** SY-program CPI account lists, referenced by ALT index. */ cpiAccounts: ExponentMarketThreeCpiAccounts; } /** * `SwapDirection` arg of the CLMM `trade_pt` instruction (a `u8`). `SyToPt` buys PT with * SY (the roll's buy leg); `PtToSy` sells PT for SY. */ declare enum ExponentSwapDirection { PtToSy = 0, SyToPt = 1 } /** * Accounts required by the CLMM `trade_pt`. The first 14 are the fixed * `#[derive(Accounts)]` accounts; `remainingAccounts` are the SY-program CPI accounts * (already resolved from the market ALT and de-duplicated). */ interface ExponentClmmTradePtAccounts { /** Trader / signer (the marginfi account authority). */ trader: PublicKey; /** The `MarketThree` (CLMM pool) address. */ market: PublicKey; /** The pool's `ticks` account. */ ticks: PublicKey; /** Trader's SY token account (source of the SY spent buying PT). */ tokenSyTrader: PublicKey; /** Trader's PT token account (destination of the bought PT). */ tokenPtTrader: PublicKey; /** `MarketThree.token_sy_escrow`. */ tokenSyEscrow: PublicKey; /** `MarketThree.token_pt_escrow`. */ tokenPtEscrow: PublicKey; /** `MarketThree.address_lookup_table`. */ addressLookupTable: PublicKey; /** `MarketThree.sy_program`. */ syProgram: PublicKey; /** `MarketThree.token_fee_treasury_sy`. */ tokenFeeTreasurySy: PublicKey; /** `MarketThree.token_fee_treasury_pt`. */ tokenFeeTreasuryPt: PublicKey; /** SPL token program for the PT/SY mints (defaults to the classic Token program). */ tokenProgram?: PublicKey; /** * SY-program CPI accounts (`getSyState` ++ `getPositionState` ++ `depositSy` ++ * `withdrawSy`, de-duplicated), pubkeys already resolved from the market ALT. Appended * after the 14 fixed accounts. */ remainingAccounts: AccountMeta$1[]; } interface ResolveExponentClmmTradePtContextParams { connection: Connection; /** Trader / signer (the marginfi account authority). */ owner: PublicKey; /** The successor maturity's `MarketThree` (CLMM pool) where the new PT trades. */ market: PublicKey; /** Token program for the PT mint (Exponent uses the classic Token program). */ ptTokenProgram?: PublicKey; /** Token program for the SY mint. Defaults to classic Token. */ syTokenProgram?: PublicKey; } /** * Resolved inputs for a native CLMM `trade_pt` (SY → PT) on an Exponent `MarketThree`: * the fully-resolved `trade_pt` accounts (including the ALT-derived SY-CPI remaining * accounts), the market ALT to add to the transaction's lookup tables, and the SY/PT * token info. Feed `tradePtAccounts` + `addressLookupTable` into the roll's buy leg. */ interface ExponentClmmTradePtContext { marketAddress: PublicKey; market: ExponentMarketThree; tradePtAccounts: ExponentClmmTradePtAccounts; /** The market's address lookup table account — must be carried by the transaction. */ addressLookupTable: AddressLookupTableAccount; sy: { mint: PublicKey; decimals: number; tokenProgram: PublicKey; }; pt: { mint: PublicKey; decimals: number; tokenProgram: PublicKey; }; } /** * Exponent Finance program IDs (mainnet), taken from the official SDK's * `@exponent-labs/exponent-sdk` `environment.js`. * * The **core** program owns the `Vault` / `MarketTwo` accounts and runs the PT * instructions (`merge`, `strip`, `trade_pt`, …). It is `ExponentnaRg…` — the same key as * the repo's `declare_id!`. (An earlier version of this file mislabelled `declare_id!` as a * localnet-only key and used the **generic SY** program `XP1BRLn8…` as "core"; that is * wrong — `XP1BRLn8…` is one of the per-flavor SY programs, and a `merge`/`trade_pt` sent * to it fails because it does not own the core-owned `Vault`/`MarketTwo` accounts. Verified * on mainnet: vault `78MLjM…` is owned by `ExponentnaRg…`.) * * Instruction encoding/accounts come from the committed IDL (`idl/exponent_core.json`). */ declare const EXPONENT_CORE_PROGRAM_ID: PublicKey; /** CLMM (`MarketThree`) program — concentrated-liquidity PT/YT trading. */ declare const EXPONENT_CLMM_PROGRAM_ID: PublicKey; /** Orderbook program — limit-order PT/YT trading. */ declare const EXPONENT_ORDERBOOK_PROGRAM_ID: PublicKey; /** Strategy-vaults program. */ declare const EXPONENT_VAULTS_PROGRAM_ID: PublicKey; /** * Per-flavor SY programs. A `Vault.sy_program` is one of these; `merge`/`trade_pt` carry it * as the `sy_program` account (and CPI into it to value SY). bulkSOL uses the **generic** * flavor (`XP1BRLn8…`). */ declare const EXPONENT_GENERIC_SY_PROGRAM_ID: PublicKey; declare const EXPONENT_MARGINFI_SY_PROGRAM_ID: PublicKey; declare const EXPONENT_KAMINO_SY_PROGRAM_ID: PublicKey; declare const EXPONENT_JITO_RESTAKING_SY_PROGRAM_ID: PublicKey; declare const EXPONENT_PERENA_SY_PROGRAM_ID: PublicKey; /** Anchor event-CPI authority seed. */ declare const EXPONENT_EVENT_AUTHORITY_SEED = "__event_authority"; /** * Raw Exponent core IDL (as committed in github.com/exponent-finance/exponent-core). * Kept for reference / future codegen. NOTE: its `address` field is the IDL-declared * program id, which differs from the live deployment — see `../constants.ts`. */ declare const EXPONENT_CORE_IDL: { address: string; metadata: { name: string; version: string; spec: string; description: string; }; instructions: ({ name: string; discriminator: number[]; accounts: ({ name: string; signer: boolean; writable?: undefined; docs?: undefined; } | { name: string; writable: boolean; signer: boolean; docs?: undefined; } | { name: string; writable: boolean; signer?: undefined; docs?: undefined; } | { name: string; signer?: undefined; writable?: undefined; docs?: undefined; } | { name: string; docs: string[]; signer?: undefined; writable?: undefined; } | { name: string; docs: string[]; writable: boolean; signer?: undefined; })[]; args: ({ name: string; type: { defined: { name: string; }; }; } | { name: string; type: string; })[]; returns?: undefined; docs?: undefined; } | { name: string; discriminator: number[]; accounts: ({ name: string; writable: boolean; signer: boolean; } | { name: string; writable: boolean; signer?: undefined; } | { name: string; writable?: undefined; signer?: undefined; })[]; args: ({ name: string; type: string; } | { name: string; type: { defined: { name: string; }; }; })[]; returns: { defined: { name: string; }; }; docs?: undefined; } | { name: string; discriminator: number[]; accounts: ({ name: string; docs: string[]; writable: boolean; signer: boolean; } | { name: string; docs: string[]; writable: boolean; signer?: undefined; } | { name: string; writable: boolean; docs?: undefined; signer?: undefined; } | { name: string; docs?: undefined; writable?: undefined; signer?: undefined; })[]; args: { name: string; type: { defined: { name: string; }; }; }[]; returns: { defined: { name: string; }; }; docs?: undefined; } | { name: string; docs: string[]; discriminator: number[]; accounts: ({ name: string; docs: string[]; writable: boolean; signer: boolean; } | { name: string; docs: string[]; writable: boolean; signer?: undefined; } | { name: string; docs?: undefined; writable?: undefined; signer?: undefined; } | { name: string; docs: string[]; writable?: undefined; signer?: undefined; })[]; args: { name: string; type: string; }[]; returns: { defined: { name: string; }; }; } | { name: string; docs: string[]; discriminator: number[]; accounts: ({ name: string; writable: boolean; signer: boolean; docs?: undefined; } | { name: string; writable?: undefined; signer?: undefined; docs?: undefined; } | { name: string; docs: string[]; writable?: undefined; signer?: undefined; } | { name: string; writable: boolean; signer?: undefined; docs?: undefined; })[]; args: ({ name: string; type: string; } | { name: string; type: { defined: { name: string; }; }; })[]; returns?: undefined; } | { name: string; discriminator: number[]; accounts: ({ name: string; writable: boolean; signer: boolean; docs?: undefined; } | { name: string; writable: boolean; signer?: undefined; docs?: undefined; } | { name: string; docs: string[]; writable: boolean; signer?: undefined; } | { name: string; docs: string[]; writable?: undefined; signer?: undefined; } | { name: string; writable?: undefined; signer?: undefined; docs?: undefined; })[]; args: { name: string; type: string; }[]; returns: { defined: { name: string; }; }; docs?: undefined; } | { name: string; docs: string[]; discriminator: number[]; accounts: ({ name: string; writable: boolean; signer: boolean; docs?: undefined; } | { name: string; writable: boolean; signer?: undefined; docs?: undefined; } | { name: string; docs: string[]; writable: boolean; signer?: undefined; } | { name: string; writable?: undefined; signer?: undefined; docs?: undefined; } | { name: string; docs: string[]; writable?: undefined; signer?: undefined; })[]; args: { name: string; type: string; }[]; returns: { defined: { name: string; }; }; } | { name: string; docs: string[]; discriminator: number[]; accounts: ({ name: string; writable: boolean; signer: boolean; docs?: undefined; } | { name: string; docs: string[]; writable?: undefined; signer?: undefined; } | { name: string; writable: boolean; signer?: undefined; docs?: undefined; } | { name: string; docs: string[]; writable: boolean; signer?: undefined; } | { name: string; writable?: undefined; signer?: undefined; docs?: undefined; })[]; args: { name: string; type: string; }[]; returns?: undefined; })[]; accounts: { name: string; discriminator: number[]; }[]; events: { name: string; discriminator: number[]; }[]; errors: { code: number; name: string; msg: string; }[]; types: ({ name: string; type: { kind: string; fields: ({ name: string; type: string; } | { name: string; type: { option: string; defined?: undefined; }; } | { name: string; type: { defined: { name: string; }; option?: undefined; }; })[]; variants?: undefined; }; docs?: undefined; } | { name: string; type: { kind: string; variants: ({ name: string; fields: string[]; } | { name: string; fields: { name: string; type: string; }[]; } | { name: string; fields: { name: string; type: { defined: { name: string; }; }; }[]; })[]; fields?: undefined; }; docs?: undefined; } | { name: string; type: { kind: string; variants: ({ name: string; fields?: undefined; } | { name: string; fields: string[]; })[]; fields?: undefined; }; docs?: undefined; } | { name: string; docs: string[]; type: { kind: string; fields: ({ name: string; docs: string[]; type: { vec: { defined: { name: string; }; vec?: undefined; }; }; } | { name: string; docs: string[]; type: { vec: { vec: { defined: { name: string; }; }; defined?: undefined; }; }; })[]; variants?: undefined; }; } | { name: string; docs: string[]; type: { kind: string; fields: { array: (string | number)[]; }[]; variants?: undefined; }; } | { name: string; docs: string[]; type: { kind: string; fields: ({ name: string; docs: string[]; type: { defined: { name: string; }; }; } | { name: string; docs: string[]; type: string; })[]; variants?: undefined; }; } | { name: string; type: { kind: string; fields: ({ name: string; type: string; } | { name: string; type: { defined: { name: string; }; vec?: undefined; }; } | { name: string; type: { vec: string; defined?: undefined; }; })[]; variants?: undefined; }; docs?: undefined; } | { name: string; type: { kind: string; fields: ({ name: string; docs: string[]; type: string; } | { name: string; docs: string[]; type: { array: (string | number)[]; defined?: undefined; vec?: undefined; }; } | { name: string; docs: string[]; type: { defined: { name: string; }; array?: undefined; vec?: undefined; }; } | { name: string; type: string; docs?: undefined; } | { name: string; type: { vec: { defined: { name: string; }; }; array?: undefined; defined?: undefined; }; docs?: undefined; } | { name: string; type: { defined: { name: string; }; array?: undefined; vec?: undefined; }; docs?: undefined; })[]; variants?: undefined; }; docs?: undefined; } | { name: string; type: { kind: string; fields: ({ name: string; docs: string[]; type: string; } | { name: string; docs: string[]; type: { defined: { name: string; }; vec?: undefined; }; } | { name: string; docs: string[]; type: { vec: { defined: { name: string; }; }; defined?: undefined; }; })[]; variants?: undefined; }; docs?: undefined; })[]; }; /** * Raw Exponent CLMM IDL (`@exponent-labs/exponent-clmm-idl`, program `XPC1MM…` / * "MarketThree"). Used to Borsh-decode the `MarketThree` pool account; its `address` * field is the live CLMM program id. The matured-PT roll buys the successor PT directly * on this PT/SY CLMM via `trade_pt` (SY → PT), with no base round-trip or aggregator. */ declare const EXPONENT_CLMM_IDL: { address: string; metadata: { name: string; version: string; spec: string; description: string; }; instructions: ({ name: string; discriminator: number[]; accounts: ({ name: string; writable: boolean; signer?: undefined; } | { name: string; signer: boolean; writable?: undefined; } | { name: string; writable: boolean; signer: boolean; } | { name: string; writable?: undefined; signer?: undefined; })[]; args: { name: string; type: string; }[]; returns: { defined: { name: string; }; }; docs?: undefined; } | { name: string; discriminator: number[]; accounts: ({ name: string; writable: boolean; signer: boolean; docs?: undefined; } | { name: string; writable: boolean; signer?: undefined; docs?: undefined; } | { name: string; docs: string[]; writable?: undefined; signer?: undefined; } | { name: string; writable?: undefined; signer?: undefined; docs?: undefined; })[]; args: ({ name: string; type: string; } | { name: string; type: { option: string; }; })[]; returns: { defined: { name: string; }; }; docs?: undefined; } | { name: string; discriminator: number[]; accounts: ({ name: string; writable: boolean; signer?: undefined; } | { name: string; signer: boolean; writable?: undefined; } | { name: string; writable: boolean; signer: boolean; } | { name: string; writable?: undefined; signer?: undefined; })[]; args: { name: string; type: { defined: { name: string; }; }; }[]; returns?: undefined; docs?: undefined; } | { name: string; discriminator: number[]; accounts: ({ name: string; writable: boolean; signer: boolean; } | { name: string; writable: boolean; signer?: undefined; } | { name: string; writable?: undefined; signer?: undefined; })[]; args: ({ name: string; type: string; } | { name: string; type: { option: string; }; })[]; returns?: undefined; docs?: undefined; } | { name: string; docs: string[]; discriminator: number[]; accounts: ({ name: string; writable: boolean; signer: boolean; docs?: undefined; } | { name: string; signer: boolean; writable?: undefined; docs?: undefined; } | { name: string; writable?: undefined; signer?: undefined; docs?: undefined; } | { name: string; docs: string[]; writable: boolean; signer?: undefined; } | { name: string; writable: boolean; signer?: undefined; docs?: undefined; } | { name: string; docs: string[]; writable?: undefined; signer?: undefined; })[]; args: ({ name: string; type: string; } | { name: string; type: { defined: { name: string; }; }; })[]; returns: { defined: { name: string; }; }; } | { name: string; discriminator: number[]; accounts: ({ name: string; writable: boolean; signer: boolean; docs?: undefined; } | { name: string; writable: boolean; signer?: undefined; docs?: undefined; } | { name: string; docs: string[]; writable: boolean; signer?: undefined; } | { name: string; writable?: undefined; signer?: undefined; docs?: undefined; })[]; args: ({ name: string; type: string; } | { name: string; type: { defined: { name: string; }; option?: undefined; }; } | { name: string; type: { option: string; defined?: undefined; }; })[]; returns: { defined: { name: string; }; }; docs?: undefined; } | { name: string; discriminator: number[]; accounts: ({ name: string; writable: boolean; signer: boolean; docs?: undefined; } | { name: string; writable: boolean; signer?: undefined; docs?: undefined; } | { name: string; docs: string[]; writable: boolean; signer?: undefined; } | { name: string; docs: string[]; writable?: undefined; signer?: undefined; } | { name: string; writable?: undefined; signer?: undefined; docs?: undefined; })[]; args: { name: string; type: string; }[]; returns: { defined: { name: string; }; }; docs?: undefined; } | { name: string; discriminator: number[]; accounts: ({ name: string; writable: boolean; signer: boolean; docs?: undefined; } | { name: string; writable: boolean; signer?: undefined; docs?: undefined; } | { name: string; docs: string[]; writable: boolean; signer?: undefined; } | { name: string; writable?: undefined; signer?: undefined; docs?: undefined; })[]; args: { name: string; type: string; }[]; returns?: undefined; docs?: undefined; })[]; accounts: { name: string; discriminator: number[]; }[]; events: { name: string; discriminator: number[]; }[]; errors: { code: number; name: string; msg: string; }[]; types: ({ name: string; type: { kind: string; fields: ({ name: string; type: string; } | { name: string; type: { option: string; defined?: undefined; }; } | { name: string; type: { defined: { name: string; }; option?: undefined; }; })[]; variants?: undefined; }; docs?: undefined; repr?: undefined; } | { name: string; type: { kind: string; variants: ({ name: string; fields?: undefined; } | { name: string; fields: string[]; })[]; fields?: undefined; }; docs?: undefined; repr?: undefined; } | { name: string; type: { kind: string; fields: ({ name: string; docs: string[]; type: string; } | { name: string; type: string; docs?: undefined; } | { name: string; type: { array: (string | number)[]; }; docs?: undefined; })[]; variants?: undefined; }; docs?: undefined; repr?: undefined; } | { name: string; docs: string[]; type: { kind: string; fields: ({ name: string; docs: string[]; type: { vec: { defined: { name: string; }; vec?: undefined; }; }; } | { name: string; docs: string[]; type: { vec: { vec: { defined: { name: string; }; }; defined?: undefined; }; }; })[]; variants?: undefined; }; repr?: undefined; } | { name: string; docs: string[]; type: { kind: string; fields: ({ name: string; docs: string[]; type: string; } | { name: string; type: string; docs?: undefined; } | { name: string; type: { defined: { name: string; }; }; docs?: undefined; })[]; variants?: undefined; }; repr?: undefined; } | { name: string; type: { kind: string; variants: ({ name: string; fields: string[]; } | { name: string; fields: { name: string; type: { defined: { name: string; }; }; }[]; } | { name: string; fields: { name: string; type: string; }[]; })[]; fields?: undefined; }; docs?: undefined; repr?: undefined; } | { name: string; docs: string[]; repr: { kind: string; }; type: { kind: string; fields: { array: (string | number)[]; }[]; variants?: undefined; }; } | { name: string; docs: string[]; type: { kind: string; fields: ({ name: string; docs: string[]; type: string; } | { name: string; docs: string[]; type: { defined: { name: string; }; }; } | { name: string; type: { defined: { name: string; }; }; docs?: undefined; })[]; variants?: undefined; }; repr?: undefined; } | { name: string; type: { kind: string; fields: { name: string; type: { vec: string; }; }[]; variants?: undefined; }; docs?: undefined; repr?: undefined; } | { name: string; type: { kind: string; fields: ({ name: string; docs: string[]; type: string; } | { name: string; docs: string[]; type: { array: (string | number)[]; defined?: undefined; vec?: undefined; }; } | { name: string; docs: string[]; type: { defined: { name: string; }; array?: undefined; vec?: undefined; }; } | { name: string; type: string; docs?: undefined; } | { name: string; type: { vec: { defined: { name: string; }; }; array?: undefined; defined?: undefined; }; docs?: undefined; } | { name: string; type: { defined: { name: string; }; array?: undefined; vec?: undefined; }; docs?: undefined; })[]; variants?: undefined; }; docs?: undefined; repr?: undefined; })[]; }; /** * Exponent's high-precision `Number` is a little-endian U256 (`[u64; 4]`) scaled by 1e12 * (`precise_number::ONE`). See exponent-core `libraries/precise_number`. */ declare const EXPONENT_NUMBER_DENOM: BigNumber; /** Convert a decoded Exponent `Number` (LE `[u64; 4]` U256) to a scaled BigNumber. */ declare function exponentNumberToBigNumber(raw: unknown): BigNumber; /** Decode a raw `Vault` account buffer into {@link ExponentVault}. */ declare function decodeExponentVault(data: Buffer): ExponentVault; /** Decode a `MarketTwo` account and return its `vault` address. */ declare function decodeExponentMarketVault(data: Buffer): PublicKey; /** Decode a raw `MarketTwo` account buffer into {@link ExponentMarketTwo}. */ declare function decodeExponentMarketTwo(data: Buffer): ExponentMarketTwo; /** Fetch + decode an Exponent `MarketTwo` account. */ declare function fetchExponentMarketTwo(connection: Connection, market: PublicKey): Promise; /** Decode a raw `MarketThree` (CLMM) pool account buffer into {@link ExponentMarketThree}. */ declare function decodeExponentMarketThree(data: Buffer): ExponentMarketThree; /** Fetch + decode an Exponent `MarketThree` (CLMM) pool account. */ declare function fetchExponentMarketThree(connection: Connection, market: PublicKey): Promise; /** Fetch + decode an Exponent `Vault` account. */ declare function fetchExponentVault(connection: Connection, vault: PublicKey): Promise; /** Fetch a `MarketTwo` account and resolve + fetch its `Vault`. */ declare function fetchExponentVaultFromMarket(connection: Connection, market: PublicKey): Promise<{ vault: PublicKey; account: ExponentVault; }>; /** Read an SPL mint's decimals (classic + token-2022 share the offset-44 layout). */ declare function getMintDecimals(connection: Connection, mint: PublicKey): Promise; /** Derive the Anchor event-CPI authority PDA for the Exponent core program. */ declare function deriveExponentEventAuthority(): PublicKey; /** Derive the Anchor event-CPI authority PDA for the Exponent CLMM (`MarketThree`) program. */ declare function deriveExponentClmmEventAuthority(): PublicKey; /** * Resolve everything `makeRollPtTx` needs for an Exponent PT roll by decoding the maturity * `Vault` (every vault-side `merge` account is a `has_one` field on it), deriving the * owner's PT/YT/SY token accounts, and resolving the SY-program CPI remaining accounts * (`get_sy_state ++ withdraw_sy`) from the vault's address lookup table. */ declare function resolveExponentMergeContext(params: ResolveExponentMergeContextParams): Promise; /** * Resolve everything `makeRollPtTx` needs to buy the successor PT natively (SY → PT, * no unwrap, no external aggregator) by trading on the successor maturity's `MarketTwo`. * * Decodes the market, resolves the SY-program CPI accounts from the market's address * lookup table (every `CpiInterfaceContext` is an ALT index), and derives the owner's * SY/PT token accounts. The returned {@link ExponentTradePtContext.addressLookupTable} * must be added to the transaction's lookup tables. */ declare function resolveExponentTradePtContext(params: ResolveExponentTradePtContextParams): Promise; /** * Resolve everything the roll needs to buy the successor PT natively on its **CLMM** * (`MarketThree`) pool — SY → PT in one on-chain trade, no base unwrap and no external * aggregator. The newer maturities (e.g. October bulkSOL) only list a CLMM PT/SY pool (no * `MarketTwo`, no order book), so this is the direct buy leg. * * Decodes the pool, resolves its SY-program CPI accounts from the pool's address lookup * table (each `CpiInterfaceContext` is an ALT index), de-duplicates them, and derives the * owner's SY/PT token accounts. The returned {@link ExponentClmmTradePtContext.addressLookupTable} * must be added to the transaction's lookup tables. The pool uses a single `ticks` account, * so the resolved account set is fixed regardless of trade size. */ declare function resolveExponentClmmTradePtContext(params: ResolveExponentClmmTradePtContextParams): Promise; /** * Resolve everything needed to `strip` SY → PT + YT on an Exponent vault (the buy leg that * *mints* the successor PT, unbounded by AMM depth). Decodes the vault, derives the owner's * SY/PT/YT token accounts, resolves the `deposit_sy` CPI remaining accounts from the vault's * address lookup table, and exposes the last-seen SY exchange rate for sizing the minted PT. */ declare function resolveExponentStripContext(params: ResolveExponentStripContextParams): Promise; /** * Resolve everything the roll's redeem leg needs to turn matured PT into the underlying * **base** token via `wrapper_merge` (merge PT → SY, then CPI-redeem SY → base, in one ix) — * so the buy leg swaps a normal token, not the un-swappable SY. * * Decodes the maturity `Vault`, derives the owner's SY/PT/YT/base token accounts, assembles * the flavor redeem accounts (all derivable: the generic SY state is `get_sy_state[0]`, the * SPL stake pool is `get_sy_state[3]`, the base escrow is `ATA(syState, baseMint)`), appends * the vault's `withdraw_sy ++ get_sy_state` CPI accounts, and builds the stake-pool refresh * that must run first. Validated byte-for-byte against the Exponent SDK's `ixMergeToBase`. */ declare function resolveExponentWrapperMergeContext(params: ResolveExponentWrapperMergeContextParams): Promise; /** * Build the Exponent `merge(amount)` instruction — redeems `amount` PT (post-maturity, * 1:1, no AMM/slippage) into SY at `sySrcDstAta`. * * @param accounts resolved merge accounts (see {@link ExponentMergeAccounts}) * @param amountNative PT amount to redeem, in native units (u64) */ declare function makeExponentMergeIx(accounts: ExponentMergeAccounts, amountNative: bigint): TransactionInstruction; /** * Signed `trade_pt` args for **buying** PT with SY (the roll's buy leg). * * The program's convention is signed-from-the-trader's-perspective: a buy makes PT flow * *to* the trader (`net_trader_pt > 0`) and SY flow *away* (`sy_constraint < 0`, the most * negative SY balance change the trader will tolerate — i.e. the max SY spent). * * @param ptOutNative exact PT the trader receives (native u64). Set to a conservative * floor; the trade gives exactly this many PT. * @param maxSyInNative max SY the trader is willing to spend (native u64). */ declare function exponentBuyPtArgs({ ptOutNative, maxSyInNative, }: { ptOutNative: bigint; maxSyInNative: bigint; }): { netTraderPt: bigint; syConstraint: bigint; }; /** * Build the Exponent `trade_pt(net_trader_pt, sy_constraint)` instruction — an * implied-APY AMM trade of SY ↔ PT on a `MarketTwo`. For a buy use {@link exponentBuyPtArgs}. * * Pricing PT reads the SY exchange rate on-chain, so `accounts.remainingAccounts` (the * flavor's SY-program CPI accounts, resolved from the market ALT) are appended after the * 12 fixed accounts, and the transaction must carry the market's address lookup table. * * @param accounts resolved trade accounts (see {@link ExponentTradePtAccounts}) * @param args signed `net_trader_pt` / `sy_constraint` (i64 LE) */ declare function makeExponentTradePtIx(accounts: ExponentTradePtAccounts, args: { netTraderPt: bigint; syConstraint: bigint; }): TransactionInstruction; /** * Build the Exponent `strip(amount)` instruction — splits `amount` SY into PT + YT on an * active vault. The minted PT lands in `ptDst`, the YT in `ytDst`. Because PT is minted (not * swapped), this is the buy leg for rolling more PT than a thin AMM pool could provide. * * Pricing PT/YT reads the SY rate on-chain, so `accounts.remainingAccounts` (the flavor's * `deposit_sy` CPI accounts, resolved from the vault ALT) are appended after the 15 fixed * accounts, and the transaction must carry the vault's address lookup table. * * @param accounts resolved strip accounts (see {@link ExponentStripAccounts}) * @param amountNative SY amount to strip, in native units (u64) */ declare function makeExponentStripIx(accounts: ExponentStripAccounts, amountNative: bigint): TransactionInstruction; /** * Build the Exponent `wrapper_merge(amount_py, redeem_sy_accounts_until)` instruction — * redeems `amountPyNative` PT into the underlying base token at the owner's base ATA. * * The remaining accounts are `[...flavor redeem accounts, ...vault SY-CPI accounts]`; * `redeemSyAccountsUntil` tells the program where the redeem accounts end. The redeem's first * account is the owner and keeps its signer flag (the SY-CPI accounts are forced non-signer, * resolved upstream). The transaction must carry the vault's address lookup table. * * @param accounts resolved wrapper-merge accounts (see {@link ExponentWrapperMergeAccounts}) * @param args `amountPyNative` (u64) PT to redeem + `redeemSyAccountsUntil` (u8) */ declare function makeExponentWrapperMergeIx(accounts: ExponentWrapperMergeAccounts, args: { amountPyNative: bigint; redeemSyAccountsUntil: number; }): TransactionInstruction; /** * Build the SPL Stake Pool `UpdateStakePoolBalance` instruction — refreshes a stake pool's * total-lamports / pool-token-supply so the pool↔token exchange rate is current for the * epoch. An SPL-stake-pool SY flavor (e.g. bulkSOL) requires this immediately before * `wrapper_merge`, otherwise the redeem reads a stale SY↔base rate. * * Account order matches the SPL Stake Pool program's `UpdateStakePoolBalance`. */ declare function makeSplStakePoolUpdateBalanceIx(accounts: { stakePoolProgram: PublicKey; stakePool: PublicKey; withdrawAuthority: PublicKey; validatorList: PublicKey; reserveStake: PublicKey; managerFeeAccount: PublicKey; poolMint: PublicKey; tokenProgram?: PublicKey; }): TransactionInstruction; /** * Signed `trade_pt` args for **buying** PT with SY on the CLMM (the roll's buy leg). * * `amountIn` is the exact SY spent; `swapDirection` is `SyToPt`; `amountOutConstraint` is * the minimum PT out (slippage floor); `priceSpotLimit` (ln-implied-APY limit) is left unset. * * @param amountInSyNative SY to spend (native u64). * @param minPtOutNative minimum PT to receive (native u64) — the swap reverts below this. */ declare function exponentClmmBuyPtArgs({ amountInSyNative, minPtOutNative, }: { amountInSyNative: bigint; minPtOutNative: bigint; }): { amountIn: bigint; swapDirection: ExponentSwapDirection; amountOutConstraint: bigint | null; priceSpotLimit: null; }; /** * Build the CLMM `trade_pt(amount_in, swap_direction, amount_out_constraint, price_spot_limit)` * instruction — an implied-APY AMM trade of SY ↔ PT on a `MarketThree` pool. For a buy use * {@link exponentClmmBuyPtArgs}. * * Pricing PT reads the SY exchange rate on-chain, so `accounts.remainingAccounts` (the SY-CPI * accounts resolved from the market ALT) are appended after the 14 fixed accounts, and the * transaction must carry the market's address lookup table. * * @param accounts resolved trade accounts (see {@link ExponentClmmTradePtAccounts}) * @param args `amountIn` (u64) + `swapDirection` (u8) + `amountOutConstraint` (Option) * + `priceSpotLimit` (Option, always `null` here) */ declare function makeExponentClmmTradePtIx(accounts: ExponentClmmTradePtAccounts, args: { amountIn: bigint; swapDirection: ExponentSwapDirection; amountOutConstraint: bigint | null; priceSpotLimit: null; }): TransactionInstruction; interface DriftSpotMarketRaw { pubkey: PublicKey; oracle: PublicKey; mint: PublicKey; vault: PublicKey; name: Array; historicalOracleData: HistoricalOracleData; historicalIndexData: HistoricalIndexData; revenuePool: PoolBalance; spotFeePool: PoolBalance; insuranceFund: InsuranceFund; totalSpotFee: BN; depositBalance: BN; borrowBalance: BN; cumulativeDepositInterest: BN; cumulativeBorrowInterest: BN; totalSocialLoss: BN; totalQuoteSocialLoss: BN; withdrawGuardThreshold: BN; maxTokenDeposits: BN; depositTokenTwap: BN; borrowTokenTwap: BN; utilizationTwap: BN; lastInterestTs: BN; lastTwapTs: BN; expiryTs: BN; orderStepSize: BN; orderTickSize: BN; minOrderSize: BN; maxPositionSize: BN; nextFillRecordId: BN; nextDepositRecordId: BN; initialAssetWeight: number; maintenanceAssetWeight: number; initialLiabilityWeight: number; maintenanceLiabilityWeight: number; imfFactor: number; liquidatorFee: number; ifLiquidationFee: number; optimalUtilization: number; optimalBorrowRate: number; maxBorrowRate: number; decimals: number; marketIndex: number; ordersEnabled: boolean; oracleSource: any; status: any; assetTier: any; pausedOperations: number; ifPausedOperations: number; feeAdjustment: number; maxTokenBorrowsFraction: number; flashLoanAmount: BN; flashLoanInitialTokenAmount: BN; totalSwapFee: BN; scaleInitialAssetWeightStart: BN; minBorrowRate: number; fuelBoostDeposits: number; fuelBoostBorrows: number; fuelBoostTaker: number; fuelBoostMaker: number; fuelBoostInsurance: number; tokenProgram: number; poolId: number; padding: Array; } interface DriftStateJSON { admin: string; whitelistMint: string; discountMint: string; signer: string; srmVault: string; perpFeeStructure: FeeStructureJSON; spotFeeStructure: FeeStructureJSON; oracleGuardRails: OracleGuardRailsJSON; numberOfAuthorities: string; numberOfSubAccounts: string; lpCooldownTime: string; liquidationMarginBufferRatio: number; settlementDuration: number; numberOfMarkets: number; numberOfSpotMarkets: number; signerNonce: number; minPerpAuctionDuration: number; defaultMarketOrderTimeInForce: number; defaultSpotAuctionDuration: number; exchangeStatus: number; liquidationDuration: number; initialPctToLiquidate: number; maxNumberOfSubAccounts: number; maxInitializeUserFee: number; padding: Array; } interface DriftState { admin: PublicKey; whitelistMint: PublicKey; discountMint: PublicKey; signer: PublicKey; srmVault: PublicKey; perpFeeStructure: FeeStructure; spotFeeStructure: FeeStructure; oracleGuardRails: OracleGuardRails; numberOfAuthorities: BN; numberOfSubAccounts: BN; lpCooldownTime: BN; liquidationMarginBufferRatio: number; settlementDuration: number; numberOfMarkets: number; numberOfSpotMarkets: number; signerNonce: number; minPerpAuctionDuration: number; defaultMarketOrderTimeInForce: number; defaultSpotAuctionDuration: number; exchangeStatus: number; liquidationDuration: number; initialPctToLiquidate: number; maxNumberOfSubAccounts: number; maxInitializeUserFee: number; padding: Array; } interface DriftUserRaw { authority: PublicKey; delegate: PublicKey; name: Array; spotPositions: Array; perpPositions: Array; orders: Array; lastAddPerpLpSharesTs: BN; totalDeposits: BN; totalWithdraws: BN; totalSocialLoss: BN; settledPerpPnl: BN; cumulativeSpotFees: BN; cumulativePerpFunding: BN; liquidationMarginFreed: BN; lastActiveSlot: BN; nextOrderId: number; maxMarginRatio: number; nextLiquidationId: number; subAccountId: number; status: number; isMarginTradingEnabled: boolean; idle: boolean; openOrders: number; hasOpenOrder: boolean; openAuctions: number; hasOpenAuction: boolean; marginMode: any; poolId: number; padding1: Array; lastFuelBonusUpdateTs: number; padding: Array; } /** * Program IDL in camelCase format in order to be used in JS/TS. * * Note that this is only a type helper and is not the actual IDL. The original * IDL can be found at `target/idl/drift.json`. */ type Drift = { address: "dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"; metadata: { name: "drift"; version: "2.114.0"; spec: "0.1.0"; }; instructions: [ { name: "initializeUser"; discriminator: [111, 17, 185, 250, 60, 122, 38, 254]; accounts: [ { name: "user"; writable: true; }, { name: "userStats"; writable: true; }, { name: "state"; writable: true; }, { name: "authority"; signer: true; }, { name: "payer"; writable: true; signer: true; }, { name: "rent"; }, { name: "systemProgram"; } ]; args: [ { name: "subAccountId"; type: "u16"; }, { name: "name"; type: { array: ["u8", 32]; }; } ]; }, { name: "initializeUserStats"; discriminator: [254, 243, 72, 98, 251, 130, 168, 213]; accounts: [ { name: "userStats"; writable: true; }, { name: "state"; writable: true; }, { name: "authority"; signer: true; }, { name: "payer"; writable: true; signer: true; }, { name: "rent"; }, { name: "systemProgram"; } ]; args: []; }, { name: "initializeSignedMsgUserOrders"; discriminator: [164, 99, 156, 126, 156, 57, 99, 180]; accounts: [ { name: "signedMsgUserOrders"; writable: true; }, { name: "authority"; }, { name: "payer"; writable: true; signer: true; }, { name: "rent"; }, { name: "systemProgram"; } ]; args: [ { name: "numOrders"; type: "u16"; } ]; }, { name: "resizeSignedMsgUserOrders"; discriminator: [137, 10, 87, 150, 18, 115, 79, 168]; accounts: [ { name: "signedMsgUserOrders"; writable: true; }, { name: "authority"; }, { name: "user"; }, { name: "payer"; writable: true; signer: true; }, { name: "systemProgram"; } ]; args: [ { name: "numOrders"; type: "u16"; } ]; }, { name: "initializeSignedMsgWsDelegates"; discriminator: [40, 132, 96, 219, 184, 193, 80, 8]; accounts: [ { name: "signedMsgWsDelegates"; writable: true; }, { name: "authority"; writable: true; signer: true; }, { name: "rent"; }, { name: "systemProgram"; } ]; args: [ { name: "delegates"; type: { vec: "pubkey"; }; } ]; }, { name: "changeSignedMsgWsDelegateStatus"; discriminator: [252, 202, 252, 219, 179, 27, 84, 138]; accounts: [ { name: "signedMsgWsDelegates"; writable: true; }, { name: "authority"; writable: true; signer: true; }, { name: "systemProgram"; } ]; args: [ { name: "delegate"; type: "pubkey"; }, { name: "add"; type: "bool"; } ]; }, { name: "initializeFuelOverflow"; discriminator: [88, 223, 132, 161, 208, 88, 142, 42]; accounts: [ { name: "fuelOverflow"; writable: true; }, { name: "userStats"; writable: true; }, { name: "authority"; }, { name: "payer"; writable: true; signer: true; }, { name: "rent"; }, { name: "systemProgram"; } ]; args: []; }, { name: "sweepFuel"; discriminator: [175, 107, 19, 56, 165, 241, 43, 69]; accounts: [ { name: "fuelOverflow"; writable: true; }, { name: "userStats"; writable: true; }, { name: "authority"; }, { name: "signer"; signer: true; } ]; args: []; }, { name: "resetFuelSeason"; discriminator: [199, 122, 192, 255, 32, 99, 63, 200]; accounts: [ { name: "userStats"; writable: true; }, { name: "authority"; }, { name: "state"; }, { name: "admin"; signer: true; } ]; args: []; }, { name: "initializeReferrerName"; discriminator: [235, 126, 231, 10, 42, 164, 26, 61]; accounts: [ { name: "referrerName"; writable: true; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; }, { name: "authority"; signer: true; }, { name: "payer"; writable: true; signer: true; }, { name: "rent"; }, { name: "systemProgram"; } ]; args: [ { name: "name"; type: { array: ["u8", 32]; }; } ]; }, { name: "deposit"; discriminator: [242, 35, 198, 137, 82, 225, 242, 182]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; }, { name: "authority"; signer: true; }, { name: "spotMarketVault"; writable: true; }, { name: "userTokenAccount"; writable: true; }, { name: "tokenProgram"; } ]; args: [ { name: "marketIndex"; type: "u16"; }, { name: "amount"; type: "u64"; }, { name: "reduceOnly"; type: "bool"; } ]; }, { name: "withdraw"; discriminator: [183, 18, 70, 156, 148, 109, 161, 34]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; }, { name: "authority"; signer: true; }, { name: "spotMarketVault"; writable: true; }, { name: "driftSigner"; }, { name: "userTokenAccount"; writable: true; }, { name: "tokenProgram"; } ]; args: [ { name: "marketIndex"; type: "u16"; }, { name: "amount"; type: "u64"; }, { name: "reduceOnly"; type: "bool"; } ]; }, { name: "transferDeposit"; discriminator: [20, 20, 147, 223, 41, 63, 204, 111]; accounts: [ { name: "fromUser"; writable: true; }, { name: "toUser"; writable: true; }, { name: "userStats"; writable: true; }, { name: "authority"; signer: true; }, { name: "state"; }, { name: "spotMarketVault"; } ]; args: [ { name: "marketIndex"; type: "u16"; }, { name: "amount"; type: "u64"; } ]; }, { name: "transferPools"; discriminator: [197, 103, 154, 25, 107, 90, 60, 94]; accounts: [ { name: "fromUser"; writable: true; }, { name: "toUser"; writable: true; }, { name: "userStats"; writable: true; }, { name: "authority"; signer: true; }, { name: "state"; }, { name: "depositFromSpotMarketVault"; writable: true; }, { name: "depositToSpotMarketVault"; writable: true; }, { name: "borrowFromSpotMarketVault"; writable: true; }, { name: "borrowToSpotMarketVault"; writable: true; }, { name: "driftSigner"; } ]; args: [ { name: "depositFromMarketIndex"; type: "u16"; }, { name: "depositToMarketIndex"; type: "u16"; }, { name: "borrowFromMarketIndex"; type: "u16"; }, { name: "borrowToMarketIndex"; type: "u16"; }, { name: "depositAmount"; type: { option: "u64"; }; }, { name: "borrowAmount"; type: { option: "u64"; }; } ]; }, { name: "transferPerpPosition"; discriminator: [23, 172, 188, 168, 134, 210, 3, 108]; accounts: [ { name: "fromUser"; writable: true; }, { name: "toUser"; writable: true; }, { name: "userStats"; writable: true; }, { name: "authority"; signer: true; }, { name: "state"; } ]; args: [ { name: "marketIndex"; type: "u16"; }, { name: "amount"; type: { option: "i64"; }; } ]; }, { name: "placePerpOrder"; discriminator: [69, 161, 93, 202, 120, 126, 76, 185]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "authority"; signer: true; } ]; args: [ { name: "params"; type: { defined: { name: "orderParams"; }; }; } ]; }, { name: "cancelOrder"; discriminator: [95, 129, 237, 240, 8, 49, 223, 132]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "authority"; signer: true; } ]; args: [ { name: "orderId"; type: { option: "u32"; }; } ]; }, { name: "cancelOrderByUserId"; discriminator: [107, 211, 250, 133, 18, 37, 57, 100]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "authority"; signer: true; } ]; args: [ { name: "userOrderId"; type: "u8"; } ]; }, { name: "cancelOrders"; discriminator: [238, 225, 95, 158, 227, 103, 8, 194]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "authority"; signer: true; } ]; args: [ { name: "marketType"; type: { option: { defined: { name: "marketType"; }; }; }; }, { name: "marketIndex"; type: { option: "u16"; }; }, { name: "direction"; type: { option: { defined: { name: "positionDirection"; }; }; }; } ]; }, { name: "cancelOrdersByIds"; discriminator: [134, 19, 144, 165, 94, 240, 210, 94]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "authority"; signer: true; } ]; args: [ { name: "orderIds"; type: { vec: "u32"; }; } ]; }, { name: "modifyOrder"; discriminator: [47, 124, 117, 255, 201, 197, 130, 94]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "authority"; signer: true; } ]; args: [ { name: "orderId"; type: { option: "u32"; }; }, { name: "modifyOrderParams"; type: { defined: { name: "modifyOrderParams"; }; }; } ]; }, { name: "modifyOrderByUserId"; discriminator: [158, 77, 4, 253, 252, 194, 161, 179]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "authority"; signer: true; } ]; args: [ { name: "userOrderId"; type: "u8"; }, { name: "modifyOrderParams"; type: { defined: { name: "modifyOrderParams"; }; }; } ]; }, { name: "placeAndTakePerpOrder"; discriminator: [213, 51, 1, 187, 108, 220, 230, 224]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; }, { name: "authority"; signer: true; } ]; args: [ { name: "params"; type: { defined: { name: "orderParams"; }; }; }, { name: "successCondition"; type: { option: "u32"; }; } ]; }, { name: "placeAndMakePerpOrder"; discriminator: [149, 117, 11, 237, 47, 95, 89, 237]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; }, { name: "taker"; writable: true; }, { name: "takerStats"; writable: true; }, { name: "authority"; signer: true; } ]; args: [ { name: "params"; type: { defined: { name: "orderParams"; }; }; }, { name: "takerOrderId"; type: "u32"; } ]; }, { name: "placeAndMakeSignedMsgPerpOrder"; discriminator: [16, 26, 123, 131, 94, 29, 175, 98]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; }, { name: "taker"; writable: true; }, { name: "takerStats"; writable: true; }, { name: "takerSignedMsgUserOrders"; }, { name: "authority"; signer: true; } ]; args: [ { name: "params"; type: { defined: { name: "orderParams"; }; }; }, { name: "signedMsgOrderUuid"; type: { array: ["u8", 8]; }; } ]; }, { name: "placeSignedMsgTakerOrder"; discriminator: [32, 79, 101, 139, 25, 6, 98, 15]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; }, { name: "signedMsgUserOrders"; writable: true; }, { name: "authority"; signer: true; }, { name: "ixSysvar"; docs: [ "the supplied Sysvar could be anything else.", "The Instruction Sysvar has not been implemented", "in the Anchor framework yet, so this is the safe approach." ]; } ]; args: [ { name: "signedMsgOrderParamsMessageBytes"; type: "bytes"; }, { name: "isDelegateSigner"; type: "bool"; } ]; }, { name: "placeSpotOrder"; discriminator: [45, 79, 81, 160, 248, 90, 91, 220]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "authority"; signer: true; } ]; args: [ { name: "params"; type: { defined: { name: "orderParams"; }; }; } ]; }, { name: "placeAndTakeSpotOrder"; discriminator: [191, 3, 138, 71, 114, 198, 202, 100]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; }, { name: "authority"; signer: true; } ]; args: [ { name: "params"; type: { defined: { name: "orderParams"; }; }; }, { name: "fulfillmentType"; type: { option: { defined: { name: "spotFulfillmentType"; }; }; }; }, { name: "makerOrderId"; type: { option: "u32"; }; } ]; }, { name: "placeAndMakeSpotOrder"; discriminator: [149, 158, 85, 66, 239, 9, 243, 98]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; }, { name: "taker"; writable: true; }, { name: "takerStats"; writable: true; }, { name: "authority"; signer: true; } ]; args: [ { name: "params"; type: { defined: { name: "orderParams"; }; }; }, { name: "takerOrderId"; type: "u32"; }, { name: "fulfillmentType"; type: { option: { defined: { name: "spotFulfillmentType"; }; }; }; } ]; }, { name: "placeOrders"; discriminator: [60, 63, 50, 123, 12, 197, 60, 190]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "authority"; signer: true; } ]; args: [ { name: "params"; type: { vec: { defined: { name: "orderParams"; }; }; }; } ]; }, { name: "beginSwap"; discriminator: [174, 109, 228, 1, 242, 105, 232, 105]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; }, { name: "authority"; signer: true; }, { name: "outSpotMarketVault"; writable: true; }, { name: "inSpotMarketVault"; writable: true; }, { name: "outTokenAccount"; writable: true; }, { name: "inTokenAccount"; writable: true; }, { name: "tokenProgram"; }, { name: "driftSigner"; }, { name: "instructions"; docs: ["Instructions Sysvar for instruction introspection"]; } ]; args: [ { name: "inMarketIndex"; type: "u16"; }, { name: "outMarketIndex"; type: "u16"; }, { name: "amountIn"; type: "u64"; } ]; }, { name: "endSwap"; discriminator: [177, 184, 27, 193, 34, 13, 210, 145]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; }, { name: "authority"; signer: true; }, { name: "outSpotMarketVault"; writable: true; }, { name: "inSpotMarketVault"; writable: true; }, { name: "outTokenAccount"; writable: true; }, { name: "inTokenAccount"; writable: true; }, { name: "tokenProgram"; }, { name: "driftSigner"; }, { name: "instructions"; docs: ["Instructions Sysvar for instruction introspection"]; } ]; args: [ { name: "inMarketIndex"; type: "u16"; }, { name: "outMarketIndex"; type: "u16"; }, { name: "limitPrice"; type: { option: "u64"; }; }, { name: "reduceOnly"; type: { option: { defined: { name: "swapReduceOnly"; }; }; }; } ]; }, { name: "addPerpLpShares"; discriminator: [56, 209, 56, 197, 119, 254, 188, 117]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "authority"; signer: true; } ]; args: [ { name: "nShares"; type: "u64"; }, { name: "marketIndex"; type: "u16"; } ]; }, { name: "removePerpLpShares"; discriminator: [213, 89, 217, 18, 160, 55, 53, 141]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "authority"; signer: true; } ]; args: [ { name: "sharesToBurn"; type: "u64"; }, { name: "marketIndex"; type: "u16"; } ]; }, { name: "removePerpLpSharesInExpiringMarket"; discriminator: [83, 254, 253, 137, 59, 122, 68, 156]; accounts: [ { name: "state"; }, { name: "user"; writable: true; } ]; args: [ { name: "sharesToBurn"; type: "u64"; }, { name: "marketIndex"; type: "u16"; } ]; }, { name: "updateUserName"; discriminator: [135, 25, 185, 56, 165, 53, 34, 136]; accounts: [ { name: "user"; writable: true; }, { name: "authority"; signer: true; } ]; args: [ { name: "subAccountId"; type: "u16"; }, { name: "name"; type: { array: ["u8", 32]; }; } ]; }, { name: "updateUserCustomMarginRatio"; discriminator: [21, 221, 140, 187, 32, 129, 11, 123]; accounts: [ { name: "user"; writable: true; }, { name: "authority"; signer: true; } ]; args: [ { name: "subAccountId"; type: "u16"; }, { name: "marginRatio"; type: "u32"; } ]; }, { name: "updateUserMarginTradingEnabled"; discriminator: [194, 92, 204, 223, 246, 188, 31, 203]; accounts: [ { name: "user"; writable: true; }, { name: "authority"; signer: true; } ]; args: [ { name: "subAccountId"; type: "u16"; }, { name: "marginTradingEnabled"; type: "bool"; } ]; }, { name: "updateUserPoolId"; discriminator: [219, 86, 73, 106, 56, 218, 128, 109]; accounts: [ { name: "user"; writable: true; }, { name: "authority"; signer: true; } ]; args: [ { name: "subAccountId"; type: "u16"; }, { name: "poolId"; type: "u8"; } ]; }, { name: "updateUserDelegate"; discriminator: [139, 205, 141, 141, 113, 36, 94, 187]; accounts: [ { name: "user"; writable: true; }, { name: "authority"; signer: true; } ]; args: [ { name: "subAccountId"; type: "u16"; }, { name: "delegate"; type: "pubkey"; } ]; }, { name: "updateUserReduceOnly"; discriminator: [199, 71, 42, 67, 144, 19, 86, 109]; accounts: [ { name: "user"; writable: true; }, { name: "authority"; signer: true; } ]; args: [ { name: "subAccountId"; type: "u16"; }, { name: "reduceOnly"; type: "bool"; } ]; }, { name: "updateUserAdvancedLp"; discriminator: [66, 80, 107, 186, 27, 242, 66, 95]; accounts: [ { name: "user"; writable: true; }, { name: "authority"; signer: true; } ]; args: [ { name: "subAccountId"; type: "u16"; }, { name: "advancedLp"; type: "bool"; } ]; }, { name: "updateUserProtectedMakerOrders"; discriminator: [114, 39, 123, 198, 187, 25, 90, 219]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "authority"; signer: true; }, { name: "protectedMakerModeConfig"; writable: true; } ]; args: [ { name: "subAccountId"; type: "u16"; }, { name: "protectedMakerOrders"; type: "bool"; } ]; }, { name: "deleteUser"; discriminator: [186, 85, 17, 249, 219, 231, 98, 251]; accounts: [ { name: "user"; writable: true; }, { name: "userStats"; writable: true; }, { name: "state"; writable: true; }, { name: "authority"; writable: true; signer: true; } ]; args: []; }, { name: "forceDeleteUser"; discriminator: [2, 241, 195, 172, 227, 24, 254, 158]; accounts: [ { name: "user"; writable: true; }, { name: "userStats"; writable: true; }, { name: "state"; writable: true; }, { name: "authority"; writable: true; }, { name: "keeper"; writable: true; signer: true; }, { name: "driftSigner"; } ]; args: []; }, { name: "deleteSignedMsgUserOrders"; discriminator: [221, 247, 128, 253, 212, 254, 46, 153]; accounts: [ { name: "signedMsgUserOrders"; writable: true; }, { name: "state"; writable: true; }, { name: "authority"; signer: true; } ]; args: []; }, { name: "reclaimRent"; discriminator: [218, 200, 19, 197, 227, 89, 192, 22]; accounts: [ { name: "user"; writable: true; }, { name: "userStats"; writable: true; }, { name: "state"; }, { name: "authority"; signer: true; }, { name: "rent"; } ]; args: []; }, { name: "enableUserHighLeverageMode"; discriminator: [231, 24, 230, 112, 201, 173, 73, 184]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "authority"; signer: true; }, { name: "highLeverageModeConfig"; writable: true; } ]; args: [ { name: "subAccountId"; type: "u16"; } ]; }, { name: "fillPerpOrder"; discriminator: [13, 188, 248, 103, 134, 217, 106, 240]; accounts: [ { name: "state"; }, { name: "authority"; signer: true; }, { name: "filler"; writable: true; }, { name: "fillerStats"; writable: true; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; } ]; args: [ { name: "orderId"; type: { option: "u32"; }; }, { name: "makerOrderId"; type: { option: "u32"; }; } ]; }, { name: "revertFill"; discriminator: [236, 238, 176, 69, 239, 10, 181, 193]; accounts: [ { name: "state"; }, { name: "authority"; signer: true; }, { name: "filler"; writable: true; }, { name: "fillerStats"; writable: true; } ]; args: []; }, { name: "fillSpotOrder"; discriminator: [212, 206, 130, 173, 21, 34, 199, 40]; accounts: [ { name: "state"; }, { name: "authority"; signer: true; }, { name: "filler"; writable: true; }, { name: "fillerStats"; writable: true; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; } ]; args: [ { name: "orderId"; type: { option: "u32"; }; }, { name: "fulfillmentType"; type: { option: { defined: { name: "spotFulfillmentType"; }; }; }; }, { name: "makerOrderId"; type: { option: "u32"; }; } ]; }, { name: "triggerOrder"; discriminator: [63, 112, 51, 233, 232, 47, 240, 199]; accounts: [ { name: "state"; }, { name: "authority"; signer: true; }, { name: "filler"; writable: true; }, { name: "user"; writable: true; } ]; args: [ { name: "orderId"; type: "u32"; } ]; }, { name: "forceCancelOrders"; discriminator: [64, 181, 196, 63, 222, 72, 64, 232]; accounts: [ { name: "state"; }, { name: "authority"; signer: true; }, { name: "filler"; writable: true; }, { name: "user"; writable: true; } ]; args: []; }, { name: "updateUserIdle"; discriminator: [253, 133, 67, 22, 103, 161, 20, 100]; accounts: [ { name: "state"; }, { name: "authority"; signer: true; }, { name: "filler"; writable: true; }, { name: "user"; writable: true; } ]; args: []; }, { name: "logUserBalances"; discriminator: [162, 21, 35, 251, 32, 57, 161, 210]; accounts: [ { name: "state"; }, { name: "authority"; signer: true; }, { name: "user"; writable: true; } ]; args: []; }, { name: "disableUserHighLeverageMode"; discriminator: [183, 155, 45, 0, 226, 85, 213, 69]; accounts: [ { name: "state"; }, { name: "authority"; signer: true; }, { name: "user"; writable: true; }, { name: "highLeverageModeConfig"; writable: true; } ]; args: []; }, { name: "updateUserFuelBonus"; discriminator: [88, 175, 201, 190, 222, 100, 143, 57]; accounts: [ { name: "state"; }, { name: "authority"; signer: true; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; } ]; args: []; }, { name: "updateUserStatsReferrerStatus"; discriminator: [174, 154, 72, 42, 191, 148, 145, 205]; accounts: [ { name: "state"; }, { name: "authority"; signer: true; }, { name: "userStats"; writable: true; } ]; args: []; }, { name: "updateUserOpenOrdersCount"; discriminator: [104, 39, 65, 210, 250, 163, 100, 134]; accounts: [ { name: "state"; }, { name: "authority"; signer: true; }, { name: "filler"; writable: true; }, { name: "user"; writable: true; } ]; args: []; }, { name: "adminDisableUpdatePerpBidAskTwap"; discriminator: [17, 164, 82, 45, 183, 86, 191, 199]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "userStats"; writable: true; } ]; args: [ { name: "disable"; type: "bool"; } ]; }, { name: "settlePnl"; discriminator: [43, 61, 234, 45, 15, 95, 152, 153]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "authority"; signer: true; }, { name: "spotMarketVault"; } ]; args: [ { name: "marketIndex"; type: "u16"; } ]; }, { name: "settleMultiplePnls"; discriminator: [127, 66, 117, 57, 40, 50, 152, 127]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "authority"; signer: true; }, { name: "spotMarketVault"; } ]; args: [ { name: "marketIndexes"; type: { vec: "u16"; }; }, { name: "mode"; type: { defined: { name: "settlePnlMode"; }; }; } ]; }, { name: "settleFundingPayment"; discriminator: [222, 90, 202, 94, 28, 45, 115, 183]; accounts: [ { name: "state"; }, { name: "user"; writable: true; } ]; args: []; }, { name: "settleLp"; discriminator: [155, 231, 116, 113, 97, 229, 139, 141]; accounts: [ { name: "state"; }, { name: "user"; writable: true; } ]; args: [ { name: "marketIndex"; type: "u16"; } ]; }, { name: "settleExpiredMarket"; discriminator: [120, 89, 11, 25, 122, 77, 72, 193]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "marketIndex"; type: "u16"; } ]; }, { name: "liquidatePerp"; discriminator: [75, 35, 119, 247, 191, 18, 139, 2]; accounts: [ { name: "state"; }, { name: "authority"; signer: true; }, { name: "liquidator"; writable: true; }, { name: "liquidatorStats"; writable: true; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; } ]; args: [ { name: "marketIndex"; type: "u16"; }, { name: "liquidatorMaxBaseAssetAmount"; type: "u64"; }, { name: "limitPrice"; type: { option: "u64"; }; } ]; }, { name: "liquidatePerpWithFill"; discriminator: [95, 111, 124, 105, 86, 169, 187, 34]; accounts: [ { name: "state"; }, { name: "authority"; signer: true; }, { name: "liquidator"; writable: true; }, { name: "liquidatorStats"; writable: true; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; } ]; args: [ { name: "marketIndex"; type: "u16"; } ]; }, { name: "liquidateSpot"; discriminator: [107, 0, 128, 41, 35, 229, 251, 18]; accounts: [ { name: "state"; }, { name: "authority"; signer: true; }, { name: "liquidator"; writable: true; }, { name: "liquidatorStats"; writable: true; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; } ]; args: [ { name: "assetMarketIndex"; type: "u16"; }, { name: "liabilityMarketIndex"; type: "u16"; }, { name: "liquidatorMaxLiabilityTransfer"; type: "u128"; }, { name: "limitPrice"; type: { option: "u64"; }; } ]; }, { name: "liquidateSpotWithSwapBegin"; discriminator: [12, 43, 176, 83, 156, 251, 117, 13]; accounts: [ { name: "state"; }, { name: "authority"; signer: true; }, { name: "liquidator"; writable: true; }, { name: "liquidatorStats"; writable: true; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; }, { name: "liabilitySpotMarketVault"; writable: true; }, { name: "assetSpotMarketVault"; writable: true; }, { name: "liabilityTokenAccount"; writable: true; }, { name: "assetTokenAccount"; writable: true; }, { name: "tokenProgram"; }, { name: "driftSigner"; }, { name: "instructions"; docs: ["Instructions Sysvar for instruction introspection"]; } ]; args: [ { name: "assetMarketIndex"; type: "u16"; }, { name: "liabilityMarketIndex"; type: "u16"; }, { name: "swapAmount"; type: "u64"; } ]; }, { name: "liquidateSpotWithSwapEnd"; discriminator: [142, 88, 163, 160, 223, 75, 55, 225]; accounts: [ { name: "state"; }, { name: "authority"; signer: true; }, { name: "liquidator"; writable: true; }, { name: "liquidatorStats"; writable: true; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; }, { name: "liabilitySpotMarketVault"; writable: true; }, { name: "assetSpotMarketVault"; writable: true; }, { name: "liabilityTokenAccount"; writable: true; }, { name: "assetTokenAccount"; writable: true; }, { name: "tokenProgram"; }, { name: "driftSigner"; }, { name: "instructions"; docs: ["Instructions Sysvar for instruction introspection"]; } ]; args: [ { name: "assetMarketIndex"; type: "u16"; }, { name: "liabilityMarketIndex"; type: "u16"; } ]; }, { name: "liquidateBorrowForPerpPnl"; discriminator: [169, 17, 32, 90, 207, 148, 209, 27]; accounts: [ { name: "state"; }, { name: "authority"; signer: true; }, { name: "liquidator"; writable: true; }, { name: "liquidatorStats"; writable: true; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; } ]; args: [ { name: "perpMarketIndex"; type: "u16"; }, { name: "spotMarketIndex"; type: "u16"; }, { name: "liquidatorMaxLiabilityTransfer"; type: "u128"; }, { name: "limitPrice"; type: { option: "u64"; }; } ]; }, { name: "liquidatePerpPnlForDeposit"; discriminator: [237, 75, 198, 235, 233, 186, 75, 35]; accounts: [ { name: "state"; }, { name: "authority"; signer: true; }, { name: "liquidator"; writable: true; }, { name: "liquidatorStats"; writable: true; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; } ]; args: [ { name: "perpMarketIndex"; type: "u16"; }, { name: "spotMarketIndex"; type: "u16"; }, { name: "liquidatorMaxPnlTransfer"; type: "u128"; }, { name: "limitPrice"; type: { option: "u64"; }; } ]; }, { name: "setUserStatusToBeingLiquidated"; discriminator: [106, 133, 160, 206, 193, 171, 192, 194]; accounts: [ { name: "state"; }, { name: "user"; writable: true; }, { name: "authority"; signer: true; } ]; args: []; }, { name: "resolvePerpPnlDeficit"; discriminator: [168, 204, 68, 150, 159, 126, 95, 148]; accounts: [ { name: "state"; }, { name: "authority"; signer: true; }, { name: "spotMarketVault"; writable: true; }, { name: "insuranceFundVault"; writable: true; }, { name: "driftSigner"; }, { name: "tokenProgram"; } ]; args: [ { name: "spotMarketIndex"; type: "u16"; }, { name: "perpMarketIndex"; type: "u16"; } ]; }, { name: "resolvePerpBankruptcy"; discriminator: [224, 16, 176, 214, 162, 213, 183, 222]; accounts: [ { name: "state"; }, { name: "authority"; signer: true; }, { name: "liquidator"; writable: true; }, { name: "liquidatorStats"; writable: true; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; }, { name: "spotMarketVault"; writable: true; }, { name: "insuranceFundVault"; writable: true; }, { name: "driftSigner"; }, { name: "tokenProgram"; } ]; args: [ { name: "quoteSpotMarketIndex"; type: "u16"; }, { name: "marketIndex"; type: "u16"; } ]; }, { name: "resolveSpotBankruptcy"; discriminator: [124, 194, 240, 254, 198, 213, 52, 122]; accounts: [ { name: "state"; }, { name: "authority"; signer: true; }, { name: "liquidator"; writable: true; }, { name: "liquidatorStats"; writable: true; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; }, { name: "spotMarketVault"; writable: true; }, { name: "insuranceFundVault"; writable: true; }, { name: "driftSigner"; }, { name: "tokenProgram"; } ]; args: [ { name: "marketIndex"; type: "u16"; } ]; }, { name: "settleRevenueToInsuranceFund"; discriminator: [200, 120, 93, 136, 69, 38, 199, 159]; accounts: [ { name: "state"; }, { name: "spotMarket"; writable: true; }, { name: "spotMarketVault"; writable: true; }, { name: "driftSigner"; }, { name: "insuranceFundVault"; writable: true; }, { name: "tokenProgram"; } ]; args: [ { name: "spotMarketIndex"; type: "u16"; } ]; }, { name: "updateFundingRate"; discriminator: [201, 178, 116, 212, 166, 144, 72, 238]; accounts: [ { name: "state"; }, { name: "perpMarket"; writable: true; }, { name: "oracle"; } ]; args: [ { name: "marketIndex"; type: "u16"; } ]; }, { name: "updatePrelaunchOracle"; discriminator: [220, 132, 27, 27, 233, 220, 61, 219]; accounts: [ { name: "state"; }, { name: "perpMarket"; }, { name: "oracle"; writable: true; } ]; args: []; }, { name: "updatePerpBidAskTwap"; discriminator: [247, 23, 255, 65, 212, 90, 221, 194]; accounts: [ { name: "state"; }, { name: "perpMarket"; writable: true; }, { name: "oracle"; }, { name: "keeperStats"; }, { name: "authority"; signer: true; } ]; args: []; }, { name: "updateSpotMarketCumulativeInterest"; discriminator: [39, 166, 139, 243, 158, 165, 155, 225]; accounts: [ { name: "state"; }, { name: "spotMarket"; writable: true; }, { name: "oracle"; }, { name: "spotMarketVault"; } ]; args: []; }, { name: "updateAmms"; discriminator: [201, 106, 217, 253, 4, 175, 228, 97]; accounts: [ { name: "state"; }, { name: "authority"; signer: true; } ]; args: [ { name: "marketIndexes"; type: { array: ["u16", 5]; }; } ]; }, { name: "updateSpotMarketExpiry"; discriminator: [208, 11, 211, 159, 226, 24, 11, 247]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; } ]; args: [ { name: "expiryTs"; type: "i64"; } ]; }, { name: "updateUserQuoteAssetInsuranceStake"; discriminator: [251, 101, 156, 7, 2, 63, 30, 23]; accounts: [ { name: "state"; }, { name: "spotMarket"; writable: true; }, { name: "insuranceFundStake"; writable: true; }, { name: "userStats"; writable: true; }, { name: "signer"; signer: true; }, { name: "insuranceFundVault"; writable: true; } ]; args: []; }, { name: "updateUserGovTokenInsuranceStake"; discriminator: [143, 99, 235, 187, 20, 159, 184, 84]; accounts: [ { name: "state"; }, { name: "spotMarket"; writable: true; }, { name: "insuranceFundStake"; writable: true; }, { name: "userStats"; writable: true; }, { name: "signer"; signer: true; }, { name: "insuranceFundVault"; writable: true; } ]; args: []; }, { name: "updateUserGovTokenInsuranceStakeDevnet"; discriminator: [129, 185, 243, 183, 228, 111, 64, 175]; accounts: [ { name: "userStats"; writable: true; }, { name: "signer"; signer: true; } ]; args: [ { name: "govStakeAmount"; type: "u64"; } ]; }, { name: "initializeInsuranceFundStake"; discriminator: [187, 179, 243, 70, 248, 90, 92, 147]; accounts: [ { name: "spotMarket"; }, { name: "insuranceFundStake"; writable: true; }, { name: "userStats"; writable: true; }, { name: "state"; }, { name: "authority"; signer: true; }, { name: "payer"; writable: true; signer: true; }, { name: "rent"; }, { name: "systemProgram"; } ]; args: [ { name: "marketIndex"; type: "u16"; } ]; }, { name: "addInsuranceFundStake"; discriminator: [251, 144, 115, 11, 222, 47, 62, 236]; accounts: [ { name: "state"; }, { name: "spotMarket"; writable: true; }, { name: "insuranceFundStake"; writable: true; }, { name: "userStats"; writable: true; }, { name: "authority"; signer: true; }, { name: "spotMarketVault"; writable: true; }, { name: "insuranceFundVault"; writable: true; }, { name: "driftSigner"; }, { name: "userTokenAccount"; writable: true; }, { name: "tokenProgram"; } ]; args: [ { name: "marketIndex"; type: "u16"; }, { name: "amount"; type: "u64"; } ]; }, { name: "requestRemoveInsuranceFundStake"; discriminator: [142, 70, 204, 92, 73, 106, 180, 52]; accounts: [ { name: "spotMarket"; writable: true; }, { name: "insuranceFundStake"; writable: true; }, { name: "userStats"; writable: true; }, { name: "authority"; signer: true; }, { name: "insuranceFundVault"; writable: true; } ]; args: [ { name: "marketIndex"; type: "u16"; }, { name: "amount"; type: "u64"; } ]; }, { name: "cancelRequestRemoveInsuranceFundStake"; discriminator: [97, 235, 78, 62, 212, 42, 241, 127]; accounts: [ { name: "spotMarket"; writable: true; }, { name: "insuranceFundStake"; writable: true; }, { name: "userStats"; writable: true; }, { name: "authority"; signer: true; }, { name: "insuranceFundVault"; writable: true; } ]; args: [ { name: "marketIndex"; type: "u16"; } ]; }, { name: "removeInsuranceFundStake"; discriminator: [128, 166, 142, 9, 254, 187, 143, 174]; accounts: [ { name: "state"; }, { name: "spotMarket"; writable: true; }, { name: "insuranceFundStake"; writable: true; }, { name: "userStats"; writable: true; }, { name: "authority"; signer: true; }, { name: "insuranceFundVault"; writable: true; }, { name: "driftSigner"; }, { name: "userTokenAccount"; writable: true; }, { name: "tokenProgram"; } ]; args: [ { name: "marketIndex"; type: "u16"; } ]; }, { name: "transferProtocolIfShares"; discriminator: [94, 93, 226, 240, 195, 201, 184, 109]; accounts: [ { name: "signer"; signer: true; }, { name: "transferConfig"; writable: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; }, { name: "insuranceFundStake"; writable: true; }, { name: "userStats"; writable: true; }, { name: "authority"; signer: true; }, { name: "insuranceFundVault"; } ]; args: [ { name: "marketIndex"; type: "u16"; }, { name: "shares"; type: "u128"; } ]; }, { name: "updatePythPullOracle"; discriminator: [230, 191, 189, 94, 108, 59, 74, 197]; accounts: [ { name: "keeper"; writable: true; signer: true; }, { name: "pythSolanaReceiver"; }, { name: "encodedVaa"; }, { name: "priceFeed"; writable: true; } ]; args: [ { name: "feedId"; type: { array: ["u8", 32]; }; }, { name: "params"; type: "bytes"; } ]; }, { name: "postPythPullOracleUpdateAtomic"; discriminator: [116, 122, 137, 158, 224, 195, 173, 119]; accounts: [ { name: "keeper"; writable: true; signer: true; }, { name: "pythSolanaReceiver"; }, { name: "guardianSet"; }, { name: "priceFeed"; writable: true; } ]; args: [ { name: "feedId"; type: { array: ["u8", 32]; }; }, { name: "params"; type: "bytes"; } ]; }, { name: "postMultiPythPullOracleUpdatesAtomic"; discriminator: [243, 79, 204, 228, 227, 208, 100, 244]; accounts: [ { name: "keeper"; writable: true; signer: true; }, { name: "pythSolanaReceiver"; }, { name: "guardianSet"; } ]; args: [ { name: "params"; type: "bytes"; } ]; }, { name: "pauseSpotMarketDepositWithdraw"; discriminator: [183, 119, 59, 170, 137, 35, 242, 86]; accounts: [ { name: "state"; }, { name: "keeper"; signer: true; }, { name: "spotMarket"; writable: true; }, { name: "spotMarketVault"; } ]; args: []; }, { name: "initialize"; discriminator: [175, 175, 109, 31, 13, 152, 155, 237]; accounts: [ { name: "admin"; writable: true; signer: true; }, { name: "state"; writable: true; }, { name: "quoteAssetMint"; }, { name: "driftSigner"; }, { name: "rent"; }, { name: "systemProgram"; }, { name: "tokenProgram"; } ]; args: []; }, { name: "initializeSpotMarket"; discriminator: [234, 196, 128, 44, 94, 15, 48, 201]; accounts: [ { name: "spotMarket"; writable: true; }, { name: "spotMarketMint"; }, { name: "spotMarketVault"; writable: true; }, { name: "insuranceFundVault"; writable: true; }, { name: "driftSigner"; }, { name: "state"; writable: true; }, { name: "oracle"; }, { name: "admin"; writable: true; signer: true; }, { name: "rent"; }, { name: "systemProgram"; }, { name: "tokenProgram"; } ]; args: [ { name: "optimalUtilization"; type: "u32"; }, { name: "optimalBorrowRate"; type: "u32"; }, { name: "maxBorrowRate"; type: "u32"; }, { name: "oracleSource"; type: { defined: { name: "oracleSource"; }; }; }, { name: "initialAssetWeight"; type: "u32"; }, { name: "maintenanceAssetWeight"; type: "u32"; }, { name: "initialLiabilityWeight"; type: "u32"; }, { name: "maintenanceLiabilityWeight"; type: "u32"; }, { name: "imfFactor"; type: "u32"; }, { name: "liquidatorFee"; type: "u32"; }, { name: "ifLiquidationFee"; type: "u32"; }, { name: "activeStatus"; type: "bool"; }, { name: "assetTier"; type: { defined: { name: "assetTier"; }; }; }, { name: "scaleInitialAssetWeightStart"; type: "u64"; }, { name: "withdrawGuardThreshold"; type: "u64"; }, { name: "orderTickSize"; type: "u64"; }, { name: "orderStepSize"; type: "u64"; }, { name: "ifTotalFactor"; type: "u32"; }, { name: "name"; type: { array: ["u8", 32]; }; } ]; }, { name: "deleteInitializedSpotMarket"; discriminator: [31, 140, 67, 191, 189, 20, 101, 221]; accounts: [ { name: "admin"; writable: true; signer: true; }, { name: "state"; writable: true; }, { name: "spotMarket"; writable: true; }, { name: "spotMarketVault"; writable: true; }, { name: "insuranceFundVault"; writable: true; }, { name: "driftSigner"; }, { name: "tokenProgram"; } ]; args: [ { name: "marketIndex"; type: "u16"; } ]; }, { name: "initializeSerumFulfillmentConfig"; discriminator: [193, 211, 132, 172, 70, 171, 7, 94]; accounts: [ { name: "baseSpotMarket"; }, { name: "quoteSpotMarket"; }, { name: "state"; writable: true; }, { name: "serumProgram"; }, { name: "serumMarket"; }, { name: "serumOpenOrders"; writable: true; }, { name: "driftSigner"; }, { name: "serumFulfillmentConfig"; writable: true; }, { name: "admin"; writable: true; signer: true; }, { name: "rent"; }, { name: "systemProgram"; } ]; args: [ { name: "marketIndex"; type: "u16"; } ]; }, { name: "updateSerumFulfillmentConfigStatus"; discriminator: [171, 109, 240, 251, 95, 1, 149, 89]; accounts: [ { name: "state"; }, { name: "serumFulfillmentConfig"; writable: true; }, { name: "admin"; writable: true; signer: true; } ]; args: [ { name: "status"; type: { defined: { name: "spotFulfillmentConfigStatus"; }; }; } ]; }, { name: "initializeOpenbookV2FulfillmentConfig"; discriminator: [7, 221, 103, 153, 107, 57, 27, 197]; accounts: [ { name: "baseSpotMarket"; }, { name: "quoteSpotMarket"; }, { name: "state"; writable: true; }, { name: "openbookV2Program"; }, { name: "openbookV2Market"; }, { name: "driftSigner"; }, { name: "openbookV2FulfillmentConfig"; writable: true; }, { name: "admin"; writable: true; signer: true; }, { name: "rent"; }, { name: "systemProgram"; } ]; args: [ { name: "marketIndex"; type: "u16"; } ]; }, { name: "openbookV2FulfillmentConfigStatus"; discriminator: [25, 173, 19, 189, 4, 211, 64, 238]; accounts: [ { name: "state"; }, { name: "openbookV2FulfillmentConfig"; writable: true; }, { name: "admin"; writable: true; signer: true; } ]; args: [ { name: "status"; type: { defined: { name: "spotFulfillmentConfigStatus"; }; }; } ]; }, { name: "initializePhoenixFulfillmentConfig"; discriminator: [135, 132, 110, 107, 185, 160, 169, 154]; accounts: [ { name: "baseSpotMarket"; }, { name: "quoteSpotMarket"; }, { name: "state"; writable: true; }, { name: "phoenixProgram"; }, { name: "phoenixMarket"; }, { name: "driftSigner"; }, { name: "phoenixFulfillmentConfig"; writable: true; }, { name: "admin"; writable: true; signer: true; }, { name: "rent"; }, { name: "systemProgram"; } ]; args: [ { name: "marketIndex"; type: "u16"; } ]; }, { name: "phoenixFulfillmentConfigStatus"; discriminator: [96, 31, 113, 32, 12, 203, 7, 154]; accounts: [ { name: "state"; }, { name: "phoenixFulfillmentConfig"; writable: true; }, { name: "admin"; writable: true; signer: true; } ]; args: [ { name: "status"; type: { defined: { name: "spotFulfillmentConfigStatus"; }; }; } ]; }, { name: "updateSerumVault"; discriminator: [219, 8, 246, 96, 169, 121, 91, 110]; accounts: [ { name: "state"; writable: true; }, { name: "admin"; writable: true; signer: true; }, { name: "srmVault"; } ]; args: []; }, { name: "initializePerpMarket"; discriminator: [132, 9, 229, 118, 117, 118, 117, 62]; accounts: [ { name: "admin"; writable: true; signer: true; }, { name: "state"; writable: true; }, { name: "perpMarket"; writable: true; }, { name: "oracle"; }, { name: "rent"; }, { name: "systemProgram"; } ]; args: [ { name: "marketIndex"; type: "u16"; }, { name: "ammBaseAssetReserve"; type: "u128"; }, { name: "ammQuoteAssetReserve"; type: "u128"; }, { name: "ammPeriodicity"; type: "i64"; }, { name: "ammPegMultiplier"; type: "u128"; }, { name: "oracleSource"; type: { defined: { name: "oracleSource"; }; }; }, { name: "contractTier"; type: { defined: { name: "contractTier"; }; }; }, { name: "marginRatioInitial"; type: "u32"; }, { name: "marginRatioMaintenance"; type: "u32"; }, { name: "liquidatorFee"; type: "u32"; }, { name: "ifLiquidationFee"; type: "u32"; }, { name: "imfFactor"; type: "u32"; }, { name: "activeStatus"; type: "bool"; }, { name: "baseSpread"; type: "u32"; }, { name: "maxSpread"; type: "u32"; }, { name: "maxOpenInterest"; type: "u128"; }, { name: "maxRevenueWithdrawPerPeriod"; type: "u64"; }, { name: "quoteMaxInsurance"; type: "u64"; }, { name: "orderStepSize"; type: "u64"; }, { name: "orderTickSize"; type: "u64"; }, { name: "minOrderSize"; type: "u64"; }, { name: "concentrationCoefScale"; type: "u128"; }, { name: "curveUpdateIntensity"; type: "u8"; }, { name: "ammJitIntensity"; type: "u8"; }, { name: "name"; type: { array: ["u8", 32]; }; } ]; }, { name: "initializePredictionMarket"; discriminator: [248, 70, 198, 224, 224, 105, 125, 195]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: []; }, { name: "deleteInitializedPerpMarket"; discriminator: [91, 154, 24, 87, 106, 59, 190, 66]; accounts: [ { name: "admin"; writable: true; signer: true; }, { name: "state"; writable: true; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "marketIndex"; type: "u16"; } ]; }, { name: "moveAmmPrice"; discriminator: [235, 109, 2, 82, 219, 118, 6, 159]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "baseAssetReserve"; type: "u128"; }, { name: "quoteAssetReserve"; type: "u128"; }, { name: "sqrtK"; type: "u128"; } ]; }, { name: "recenterPerpMarketAmm"; discriminator: [24, 87, 10, 115, 165, 190, 80, 139]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "pegMultiplier"; type: "u128"; }, { name: "sqrtK"; type: "u128"; } ]; }, { name: "updatePerpMarketAmmSummaryStats"; discriminator: [122, 101, 249, 238, 209, 9, 241, 245]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; }, { name: "spotMarket"; }, { name: "oracle"; } ]; args: [ { name: "params"; type: { defined: { name: "updatePerpMarketSummaryStatsParams"; }; }; } ]; }, { name: "updatePerpMarketExpiry"; discriminator: [44, 221, 227, 151, 131, 140, 22, 110]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "expiryTs"; type: "i64"; } ]; }, { name: "settleExpiredMarketPoolsToRevenuePool"; discriminator: [55, 19, 238, 169, 227, 90, 200, 184]; accounts: [ { name: "state"; }, { name: "admin"; signer: true; }, { name: "spotMarket"; writable: true; }, { name: "perpMarket"; writable: true; } ]; args: []; }, { name: "depositIntoPerpMarketFeePool"; discriminator: [34, 58, 57, 68, 97, 80, 244, 6]; accounts: [ { name: "state"; writable: true; }, { name: "perpMarket"; writable: true; }, { name: "admin"; signer: true; }, { name: "sourceVault"; writable: true; }, { name: "driftSigner"; }, { name: "quoteSpotMarket"; writable: true; }, { name: "spotMarketVault"; writable: true; }, { name: "tokenProgram"; } ]; args: [ { name: "amount"; type: "u64"; } ]; }, { name: "depositIntoSpotMarketVault"; discriminator: [48, 252, 119, 73, 255, 205, 174, 247]; accounts: [ { name: "state"; }, { name: "spotMarket"; writable: true; }, { name: "admin"; signer: true; }, { name: "sourceVault"; writable: true; }, { name: "spotMarketVault"; writable: true; }, { name: "tokenProgram"; } ]; args: [ { name: "amount"; type: "u64"; } ]; }, { name: "depositIntoSpotMarketRevenuePool"; discriminator: [92, 40, 151, 42, 122, 254, 139, 246]; accounts: [ { name: "state"; }, { name: "spotMarket"; writable: true; }, { name: "authority"; writable: true; signer: true; }, { name: "spotMarketVault"; writable: true; }, { name: "userTokenAccount"; writable: true; }, { name: "tokenProgram"; } ]; args: [ { name: "amount"; type: "u64"; } ]; }, { name: "repegAmmCurve"; discriminator: [3, 36, 102, 89, 180, 128, 120, 213]; accounts: [ { name: "state"; }, { name: "perpMarket"; writable: true; }, { name: "oracle"; }, { name: "admin"; signer: true; } ]; args: [ { name: "newPegCandidate"; type: "u128"; } ]; }, { name: "updatePerpMarketAmmOracleTwap"; discriminator: [241, 74, 114, 123, 206, 153, 24, 202]; accounts: [ { name: "state"; }, { name: "perpMarket"; writable: true; }, { name: "oracle"; }, { name: "admin"; signer: true; } ]; args: []; }, { name: "resetPerpMarketAmmOracleTwap"; discriminator: [127, 10, 55, 164, 123, 226, 47, 24]; accounts: [ { name: "state"; }, { name: "perpMarket"; writable: true; }, { name: "oracle"; }, { name: "admin"; signer: true; } ]; args: []; }, { name: "updateK"; discriminator: [72, 98, 9, 139, 129, 229, 172, 56]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; }, { name: "oracle"; } ]; args: [ { name: "sqrtK"; type: "u128"; } ]; }, { name: "updatePerpMarketMarginRatio"; discriminator: [130, 173, 107, 45, 119, 105, 26, 113]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "marginRatioInitial"; type: "u32"; }, { name: "marginRatioMaintenance"; type: "u32"; } ]; }, { name: "updatePerpMarketHighLeverageMarginRatio"; discriminator: [88, 112, 86, 49, 24, 116, 74, 157]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "marginRatioInitial"; type: "u16"; }, { name: "marginRatioMaintenance"; type: "u16"; } ]; }, { name: "updatePerpMarketFundingPeriod"; discriminator: [171, 161, 69, 91, 129, 139, 161, 28]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "fundingPeriod"; type: "i64"; } ]; }, { name: "updatePerpMarketMaxImbalances"; discriminator: [15, 206, 73, 133, 60, 8, 86, 89]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "unrealizedMaxImbalance"; type: "u64"; }, { name: "maxRevenueWithdrawPerPeriod"; type: "u64"; }, { name: "quoteMaxInsurance"; type: "u64"; } ]; }, { name: "updatePerpMarketLiquidationFee"; discriminator: [90, 137, 9, 145, 41, 8, 148, 117]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "liquidatorFee"; type: "u32"; }, { name: "ifLiquidationFee"; type: "u32"; } ]; }, { name: "updateInsuranceFundUnstakingPeriod"; discriminator: [44, 69, 43, 226, 204, 223, 202, 52]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; } ]; args: [ { name: "insuranceFundUnstakingPeriod"; type: "i64"; } ]; }, { name: "updateSpotMarketPoolId"; discriminator: [22, 213, 197, 160, 139, 193, 81, 149]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; } ]; args: [ { name: "poolId"; type: "u8"; } ]; }, { name: "updateSpotMarketLiquidationFee"; discriminator: [11, 13, 255, 53, 56, 136, 104, 177]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; } ]; args: [ { name: "liquidatorFee"; type: "u32"; }, { name: "ifLiquidationFee"; type: "u32"; } ]; }, { name: "updateWithdrawGuardThreshold"; discriminator: [56, 18, 39, 61, 155, 211, 44, 133]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; } ]; args: [ { name: "withdrawGuardThreshold"; type: "u64"; } ]; }, { name: "updateSpotMarketIfFactor"; discriminator: [147, 30, 224, 34, 18, 230, 105, 4]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; } ]; args: [ { name: "spotMarketIndex"; type: "u16"; }, { name: "userIfFactor"; type: "u32"; }, { name: "totalIfFactor"; type: "u32"; } ]; }, { name: "updateSpotMarketRevenueSettlePeriod"; discriminator: [81, 92, 126, 41, 250, 225, 156, 219]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; } ]; args: [ { name: "revenueSettlePeriod"; type: "i64"; } ]; }, { name: "updateSpotMarketStatus"; discriminator: [78, 94, 16, 188, 193, 110, 231, 31]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; } ]; args: [ { name: "status"; type: { defined: { name: "marketStatus"; }; }; } ]; }, { name: "updateSpotMarketPausedOperations"; discriminator: [100, 61, 153, 81, 180, 12, 6, 248]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; } ]; args: [ { name: "pausedOperations"; type: "u8"; } ]; }, { name: "updateSpotMarketAssetTier"; discriminator: [253, 209, 231, 14, 242, 208, 243, 130]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; } ]; args: [ { name: "assetTier"; type: { defined: { name: "assetTier"; }; }; } ]; }, { name: "updateSpotMarketMarginWeights"; discriminator: [109, 33, 87, 195, 255, 36, 6, 81]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; } ]; args: [ { name: "initialAssetWeight"; type: "u32"; }, { name: "maintenanceAssetWeight"; type: "u32"; }, { name: "initialLiabilityWeight"; type: "u32"; }, { name: "maintenanceLiabilityWeight"; type: "u32"; }, { name: "imfFactor"; type: "u32"; } ]; }, { name: "updateSpotMarketBorrowRate"; discriminator: [71, 239, 236, 153, 210, 62, 254, 76]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; } ]; args: [ { name: "optimalUtilization"; type: "u32"; }, { name: "optimalBorrowRate"; type: "u32"; }, { name: "maxBorrowRate"; type: "u32"; }, { name: "minBorrowRate"; type: { option: "u8"; }; } ]; }, { name: "updateSpotMarketMaxTokenDeposits"; discriminator: [56, 191, 79, 18, 26, 121, 80, 208]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; } ]; args: [ { name: "maxTokenDeposits"; type: "u64"; } ]; }, { name: "updateSpotMarketMaxTokenBorrows"; discriminator: [57, 102, 204, 212, 253, 95, 13, 199]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; } ]; args: [ { name: "maxTokenBorrowsFraction"; type: "u16"; } ]; }, { name: "updateSpotMarketScaleInitialAssetWeightStart"; discriminator: [217, 204, 204, 118, 204, 130, 225, 147]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; } ]; args: [ { name: "scaleInitialAssetWeightStart"; type: "u64"; } ]; }, { name: "updateSpotMarketOracle"; discriminator: [114, 184, 102, 37, 246, 186, 180, 99]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; }, { name: "oracle"; }, { name: "oldOracle"; } ]; args: [ { name: "oracle"; type: "pubkey"; }, { name: "oracleSource"; type: { defined: { name: "oracleSource"; }; }; }, { name: "skipInvariantCheck"; type: "bool"; } ]; }, { name: "updateSpotMarketStepSizeAndTickSize"; discriminator: [238, 153, 137, 80, 206, 59, 250, 61]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; } ]; args: [ { name: "stepSize"; type: "u64"; }, { name: "tickSize"; type: "u64"; } ]; }, { name: "updateSpotMarketMinOrderSize"; discriminator: [93, 128, 11, 119, 26, 20, 181, 50]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; } ]; args: [ { name: "orderSize"; type: "u64"; } ]; }, { name: "updateSpotMarketOrdersEnabled"; discriminator: [190, 79, 206, 15, 26, 229, 229, 43]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; } ]; args: [ { name: "ordersEnabled"; type: "bool"; } ]; }, { name: "updateSpotMarketIfPausedOperations"; discriminator: [101, 215, 79, 74, 59, 41, 79, 12]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; } ]; args: [ { name: "pausedOperations"; type: "u8"; } ]; }, { name: "updateSpotMarketName"; discriminator: [17, 208, 1, 1, 162, 211, 188, 224]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; } ]; args: [ { name: "name"; type: { array: ["u8", 32]; }; } ]; }, { name: "updatePerpMarketStatus"; discriminator: [71, 201, 175, 122, 255, 207, 196, 207]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "status"; type: { defined: { name: "marketStatus"; }; }; } ]; }, { name: "updatePerpMarketPausedOperations"; discriminator: [53, 16, 136, 132, 30, 220, 121, 85]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "pausedOperations"; type: "u8"; } ]; }, { name: "updatePerpMarketContractTier"; discriminator: [236, 128, 15, 95, 203, 214, 68, 117]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "contractTier"; type: { defined: { name: "contractTier"; }; }; } ]; }, { name: "updatePerpMarketImfFactor"; discriminator: [207, 194, 56, 132, 35, 67, 71, 244]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "imfFactor"; type: "u32"; }, { name: "unrealizedPnlImfFactor"; type: "u32"; } ]; }, { name: "updatePerpMarketUnrealizedAssetWeight"; discriminator: [135, 132, 205, 165, 109, 150, 166, 106]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "unrealizedInitialAssetWeight"; type: "u32"; }, { name: "unrealizedMaintenanceAssetWeight"; type: "u32"; } ]; }, { name: "updatePerpMarketConcentrationCoef"; discriminator: [24, 78, 232, 126, 169, 176, 230, 16]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "concentrationScale"; type: "u128"; } ]; }, { name: "updatePerpMarketCurveUpdateIntensity"; discriminator: [50, 131, 6, 156, 226, 231, 189, 72]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "curveUpdateIntensity"; type: "u8"; } ]; }, { name: "updatePerpMarketTargetBaseAssetAmountPerLp"; discriminator: [62, 87, 68, 115, 29, 150, 150, 165]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "targetBaseAssetAmountPerLp"; type: "i32"; } ]; }, { name: "updatePerpMarketPerLpBase"; discriminator: [103, 152, 103, 102, 89, 144, 193, 71]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "perLpBase"; type: "i8"; } ]; }, { name: "updateLpCooldownTime"; discriminator: [198, 133, 88, 41, 241, 119, 61, 14]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; writable: true; } ]; args: [ { name: "lpCooldownTime"; type: "u64"; } ]; }, { name: "updatePerpFeeStructure"; discriminator: [23, 178, 111, 203, 73, 22, 140, 75]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; writable: true; } ]; args: [ { name: "feeStructure"; type: { defined: { name: "feeStructure"; }; }; } ]; }, { name: "updateSpotFeeStructure"; discriminator: [97, 216, 105, 131, 113, 246, 142, 141]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; writable: true; } ]; args: [ { name: "feeStructure"; type: { defined: { name: "feeStructure"; }; }; } ]; }, { name: "updateInitialPctToLiquidate"; discriminator: [210, 133, 225, 128, 194, 50, 13, 109]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; writable: true; } ]; args: [ { name: "initialPctToLiquidate"; type: "u16"; } ]; }, { name: "updateLiquidationDuration"; discriminator: [28, 154, 20, 249, 102, 192, 73, 71]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; writable: true; } ]; args: [ { name: "liquidationDuration"; type: "u8"; } ]; }, { name: "updateLiquidationMarginBufferRatio"; discriminator: [132, 224, 243, 160, 154, 82, 97, 215]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; writable: true; } ]; args: [ { name: "liquidationMarginBufferRatio"; type: "u32"; } ]; }, { name: "updateOracleGuardRails"; discriminator: [131, 112, 10, 59, 32, 54, 40, 164]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; writable: true; } ]; args: [ { name: "oracleGuardRails"; type: { defined: { name: "oracleGuardRails"; }; }; } ]; }, { name: "updateStateSettlementDuration"; discriminator: [97, 68, 199, 235, 131, 80, 61, 173]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; writable: true; } ]; args: [ { name: "settlementDuration"; type: "u16"; } ]; }, { name: "updateStateMaxNumberOfSubAccounts"; discriminator: [155, 123, 214, 2, 221, 166, 204, 85]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; writable: true; } ]; args: [ { name: "maxNumberOfSubAccounts"; type: "u16"; } ]; }, { name: "updateStateMaxInitializeUserFee"; discriminator: [237, 225, 25, 237, 193, 45, 77, 97]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; writable: true; } ]; args: [ { name: "maxInitializeUserFee"; type: "u16"; } ]; }, { name: "updatePerpMarketOracle"; discriminator: [182, 113, 111, 160, 67, 174, 89, 191]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; }, { name: "oracle"; }, { name: "oldOracle"; } ]; args: [ { name: "oracle"; type: "pubkey"; }, { name: "oracleSource"; type: { defined: { name: "oracleSource"; }; }; }, { name: "skipInvariantCheck"; type: "bool"; } ]; }, { name: "updatePerpMarketBaseSpread"; discriminator: [71, 95, 84, 168, 9, 157, 198, 65]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "baseSpread"; type: "u32"; } ]; }, { name: "updateAmmJitIntensity"; discriminator: [181, 191, 53, 109, 166, 249, 55, 142]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "ammJitIntensity"; type: "u8"; } ]; }, { name: "updatePerpMarketMaxSpread"; discriminator: [80, 252, 122, 62, 40, 218, 91, 100]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "maxSpread"; type: "u32"; } ]; }, { name: "updatePerpMarketStepSizeAndTickSize"; discriminator: [231, 255, 97, 25, 146, 139, 174, 4]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "stepSize"; type: "u64"; }, { name: "tickSize"; type: "u64"; } ]; }, { name: "updatePerpMarketName"; discriminator: [211, 31, 21, 210, 64, 108, 66, 201]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "name"; type: { array: ["u8", 32]; }; } ]; }, { name: "updatePerpMarketMinOrderSize"; discriminator: [226, 74, 5, 89, 108, 223, 46, 141]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "orderSize"; type: "u64"; } ]; }, { name: "updatePerpMarketMaxSlippageRatio"; discriminator: [235, 37, 40, 196, 70, 146, 54, 201]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "maxSlippageRatio"; type: "u16"; } ]; }, { name: "updatePerpMarketMaxFillReserveFraction"; discriminator: [19, 172, 114, 154, 42, 135, 161, 133]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "maxFillReserveFraction"; type: "u16"; } ]; }, { name: "updatePerpMarketMaxOpenInterest"; discriminator: [194, 79, 149, 224, 246, 102, 186, 140]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "maxOpenInterest"; type: "u128"; } ]; }, { name: "updatePerpMarketNumberOfUsers"; discriminator: [35, 62, 144, 177, 180, 62, 215, 196]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "numberOfUsers"; type: { option: "u32"; }; }, { name: "numberOfUsersWithBase"; type: { option: "u32"; }; } ]; }, { name: "updatePerpMarketFeeAdjustment"; discriminator: [194, 174, 87, 102, 43, 148, 32, 112]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "feeAdjustment"; type: "i16"; } ]; }, { name: "updateSpotMarketFeeAdjustment"; discriminator: [148, 182, 3, 126, 157, 114, 220, 99]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; } ]; args: [ { name: "feeAdjustment"; type: "i16"; } ]; }, { name: "updatePerpMarketFuel"; discriminator: [252, 141, 110, 101, 27, 99, 182, 21]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "perpMarket"; writable: true; } ]; args: [ { name: "fuelBoostTaker"; type: { option: "u8"; }; }, { name: "fuelBoostMaker"; type: { option: "u8"; }; }, { name: "fuelBoostPosition"; type: { option: "u8"; }; } ]; }, { name: "updateSpotMarketFuel"; discriminator: [226, 253, 76, 71, 17, 2, 171, 169]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "spotMarket"; writable: true; } ]; args: [ { name: "fuelBoostDeposits"; type: { option: "u8"; }; }, { name: "fuelBoostBorrows"; type: { option: "u8"; }; }, { name: "fuelBoostTaker"; type: { option: "u8"; }; }, { name: "fuelBoostMaker"; type: { option: "u8"; }; }, { name: "fuelBoostInsurance"; type: { option: "u8"; }; } ]; }, { name: "initUserFuel"; discriminator: [132, 191, 228, 141, 201, 138, 60, 48]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; }, { name: "user"; writable: true; }, { name: "userStats"; writable: true; } ]; args: [ { name: "fuelBoostDeposits"; type: { option: "i32"; }; }, { name: "fuelBoostBorrows"; type: { option: "u32"; }; }, { name: "fuelBoostTaker"; type: { option: "u32"; }; }, { name: "fuelBoostMaker"; type: { option: "u32"; }; }, { name: "fuelBoostInsurance"; type: { option: "u32"; }; } ]; }, { name: "updateAdmin"; discriminator: [161, 176, 40, 213, 60, 184, 179, 228]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; writable: true; } ]; args: [ { name: "admin"; type: "pubkey"; } ]; }, { name: "updateWhitelistMint"; discriminator: [161, 15, 162, 19, 148, 120, 144, 151]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; writable: true; } ]; args: [ { name: "whitelistMint"; type: "pubkey"; } ]; }, { name: "updateDiscountMint"; discriminator: [32, 252, 122, 211, 66, 31, 47, 241]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; writable: true; } ]; args: [ { name: "discountMint"; type: "pubkey"; } ]; }, { name: "updateExchangeStatus"; discriminator: [83, 160, 252, 250, 129, 116, 49, 223]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; writable: true; } ]; args: [ { name: "exchangeStatus"; type: "u8"; } ]; }, { name: "updatePerpAuctionDuration"; discriminator: [126, 110, 52, 174, 30, 206, 215, 90]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; writable: true; } ]; args: [ { name: "minPerpAuctionDuration"; type: "u8"; } ]; }, { name: "updateSpotAuctionDuration"; discriminator: [182, 178, 203, 72, 187, 143, 157, 107]; accounts: [ { name: "admin"; signer: true; }, { name: "state"; writable: true; } ]; args: [ { name: "defaultSpotAuctionDuration"; type: "u8"; } ]; }, { name: "initializeProtocolIfSharesTransferConfig"; discriminator: [89, 131, 239, 200, 178, 141, 106, 194]; accounts: [ { name: "admin"; writable: true; signer: true; }, { name: "protocolIfSharesTransferConfig"; writable: true; }, { name: "state"; }, { name: "rent"; }, { name: "systemProgram"; } ]; args: []; }, { name: "updateProtocolIfSharesTransferConfig"; discriminator: [34, 135, 47, 91, 220, 24, 212, 53]; accounts: [ { name: "admin"; writable: true; signer: true; }, { name: "protocolIfSharesTransferConfig"; writable: true; }, { name: "state"; } ]; args: [ { name: "whitelistedSigners"; type: { option: { array: ["pubkey", 4]; }; }; }, { name: "maxTransferPerEpoch"; type: { option: "u128"; }; } ]; }, { name: "initializePrelaunchOracle"; discriminator: [169, 178, 84, 25, 175, 62, 29, 247]; accounts: [ { name: "admin"; writable: true; signer: true; }, { name: "prelaunchOracle"; writable: true; }, { name: "state"; }, { name: "rent"; }, { name: "systemProgram"; } ]; args: [ { name: "params"; type: { defined: { name: "prelaunchOracleParams"; }; }; } ]; }, { name: "updatePrelaunchOracleParams"; discriminator: [98, 205, 147, 243, 18, 75, 83, 207]; accounts: [ { name: "admin"; writable: true; signer: true; }, { name: "prelaunchOracle"; writable: true; }, { name: "perpMarket"; writable: true; }, { name: "state"; } ]; args: [ { name: "params"; type: { defined: { name: "prelaunchOracleParams"; }; }; } ]; }, { name: "deletePrelaunchOracle"; discriminator: [59, 169, 100, 49, 69, 17, 173, 253]; accounts: [ { name: "admin"; writable: true; signer: true; }, { name: "prelaunchOracle"; writable: true; }, { name: "perpMarket"; }, { name: "state"; } ]; args: [ { name: "perpMarketIndex"; type: "u16"; } ]; }, { name: "initializePythPullOracle"; discriminator: [249, 140, 253, 243, 248, 74, 240, 238]; accounts: [ { name: "admin"; writable: true; signer: true; }, { name: "pythSolanaReceiver"; }, { name: "priceFeed"; writable: true; }, { name: "systemProgram"; }, { name: "state"; } ]; args: [ { name: "feedId"; type: { array: ["u8", 32]; }; } ]; }, { name: "initializePythLazerOracle"; discriminator: [140, 107, 33, 214, 235, 219, 103, 20]; accounts: [ { name: "admin"; writable: true; signer: true; }, { name: "lazerOracle"; writable: true; }, { name: "state"; }, { name: "rent"; }, { name: "systemProgram"; } ]; args: [ { name: "feedId"; type: "u32"; } ]; }, { name: "postPythLazerOracleUpdate"; discriminator: [218, 237, 170, 245, 39, 143, 166, 33]; accounts: [ { name: "keeper"; writable: true; signer: true; }, { name: "pythLazerStorage"; }, { name: "ixSysvar"; } ]; args: [ { name: "pythMessage"; type: "bytes"; } ]; }, { name: "initializeHighLeverageModeConfig"; discriminator: [213, 167, 93, 246, 208, 130, 90, 248]; accounts: [ { name: "admin"; writable: true; signer: true; }, { name: "highLeverageModeConfig"; writable: true; }, { name: "state"; }, { name: "rent"; }, { name: "systemProgram"; } ]; args: [ { name: "maxUsers"; type: "u32"; } ]; }, { name: "updateHighLeverageModeConfig"; discriminator: [64, 122, 212, 93, 141, 217, 202, 55]; accounts: [ { name: "admin"; writable: true; signer: true; }, { name: "highLeverageModeConfig"; writable: true; }, { name: "state"; } ]; args: [ { name: "maxUsers"; type: "u32"; }, { name: "reduceOnly"; type: "bool"; } ]; }, { name: "initializeProtectedMakerModeConfig"; discriminator: [67, 103, 220, 67, 88, 32, 252, 8]; accounts: [ { name: "admin"; writable: true; signer: true; }, { name: "protectedMakerModeConfig"; writable: true; }, { name: "state"; }, { name: "rent"; }, { name: "systemProgram"; } ]; args: [ { name: "maxUsers"; type: "u32"; } ]; }, { name: "updateProtectedMakerModeConfig"; discriminator: [86, 166, 235, 253, 67, 202, 223, 17]; accounts: [ { name: "admin"; writable: true; signer: true; }, { name: "protectedMakerModeConfig"; writable: true; }, { name: "state"; } ]; args: [ { name: "maxUsers"; type: "u32"; }, { name: "reduceOnly"; type: "bool"; }, { name: "currentUsers"; type: { option: "u32"; }; } ]; } ]; accounts: [ { name: "openbookV2FulfillmentConfig"; discriminator: [3, 43, 58, 106, 131, 132, 199, 171]; }, { name: "phoenixV1FulfillmentConfig"; discriminator: [233, 45, 62, 40, 35, 129, 48, 72]; }, { name: "serumV3FulfillmentConfig"; discriminator: [65, 160, 197, 112, 239, 168, 103, 185]; }, { name: "highLeverageModeConfig"; discriminator: [3, 196, 90, 189, 193, 64, 228, 234]; }, { name: "insuranceFundStake"; discriminator: [110, 202, 14, 42, 95, 73, 90, 95]; }, { name: "protocolIfSharesTransferConfig"; discriminator: [188, 1, 213, 98, 23, 148, 30, 1]; }, { name: "prelaunchOracle"; discriminator: [92, 14, 139, 234, 72, 244, 68, 26]; }, { name: "perpMarket"; discriminator: [10, 223, 12, 44, 107, 245, 55, 247]; }, { name: "protectedMakerModeConfig"; discriminator: [47, 86, 90, 9, 224, 255, 10, 69]; }, { name: "pythLazerOracle"; discriminator: [159, 7, 161, 249, 34, 81, 121, 133]; }, { name: "signedMsgUserOrders"; discriminator: [70, 6, 50, 248, 222, 1, 143, 49]; }, { name: "signedMsgWsDelegates"; discriminator: [190, 115, 111, 44, 216, 252, 108, 85]; }, { name: "spotMarket"; discriminator: [100, 177, 8, 107, 168, 65, 65, 39]; }, { name: "state"; discriminator: [216, 146, 107, 94, 104, 75, 182, 177]; }, { name: "user"; discriminator: [159, 117, 95, 227, 239, 151, 58, 236]; }, { name: "userStats"; discriminator: [176, 223, 136, 27, 122, 79, 32, 227]; }, { name: "referrerName"; discriminator: [105, 133, 170, 110, 52, 42, 28, 182]; }, { name: "fuelOverflow"; discriminator: [182, 64, 231, 177, 226, 142, 69, 58]; } ]; events: [ { name: "newUserRecord"; discriminator: [236, 186, 113, 219, 42, 51, 149, 249]; }, { name: "depositRecord"; discriminator: [180, 241, 218, 207, 102, 135, 44, 134]; }, { name: "spotInterestRecord"; discriminator: [183, 186, 203, 186, 225, 187, 95, 130]; }, { name: "fundingPaymentRecord"; discriminator: [8, 59, 96, 20, 137, 201, 56, 95]; }, { name: "fundingRateRecord"; discriminator: [68, 3, 255, 26, 133, 91, 147, 254]; }, { name: "curveRecord"; discriminator: [101, 238, 40, 228, 70, 46, 61, 117]; }, { name: "signedMsgOrderRecord"; discriminator: [211, 197, 25, 18, 142, 86, 113, 27]; }, { name: "orderRecord"; discriminator: [104, 19, 64, 56, 89, 21, 2, 90]; }, { name: "orderActionRecord"; discriminator: [224, 52, 67, 71, 194, 237, 109, 1]; }, { name: "lpRecord"; discriminator: [101, 22, 54, 38, 178, 13, 142, 111]; }, { name: "liquidationRecord"; discriminator: [127, 17, 0, 108, 182, 13, 231, 53]; }, { name: "settlePnlRecord"; discriminator: [57, 68, 105, 26, 119, 198, 213, 89]; }, { name: "insuranceFundRecord"; discriminator: [56, 222, 215, 235, 78, 197, 99, 146]; }, { name: "insuranceFundStakeRecord"; discriminator: [68, 66, 156, 7, 216, 148, 250, 114]; }, { name: "swapRecord"; discriminator: [162, 187, 123, 194, 138, 56, 250, 241]; }, { name: "spotMarketVaultDepositRecord"; discriminator: [178, 217, 23, 188, 127, 190, 32, 73]; }, { name: "deleteUserRecord"; discriminator: [71, 111, 190, 118, 7, 3, 132, 222]; }, { name: "fuelSweepRecord"; discriminator: [41, 84, 37, 246, 132, 240, 131, 8]; }, { name: "fuelSeasonRecord"; discriminator: [19, 137, 119, 33, 224, 249, 6, 87]; } ]; errors: [ { code: 6000; name: "invalidSpotMarketAuthority"; msg: "Invalid Spot Market Authority"; }, { code: 6001; name: "invalidInsuranceFundAuthority"; msg: "Clearing house not insurance fund authority"; }, { code: 6002; name: "insufficientDeposit"; msg: "Insufficient deposit"; }, { code: 6003; name: "insufficientCollateral"; msg: "Insufficient collateral"; }, { code: 6004; name: "sufficientCollateral"; msg: "Sufficient collateral"; }, { code: 6005; name: "maxNumberOfPositions"; msg: "Max number of positions taken"; }, { code: 6006; name: "adminControlsPricesDisabled"; msg: "Admin Controls Prices Disabled"; }, { code: 6007; name: "marketDelisted"; msg: "Market Delisted"; }, { code: 6008; name: "marketIndexAlreadyInitialized"; msg: "Market Index Already Initialized"; }, { code: 6009; name: "userAccountAndUserPositionsAccountMismatch"; msg: "User Account And User Positions Account Mismatch"; }, { code: 6010; name: "userHasNoPositionInMarket"; msg: "User Has No Position In Market"; }, { code: 6011; name: "invalidInitialPeg"; msg: "Invalid Initial Peg"; }, { code: 6012; name: "invalidRepegRedundant"; msg: "AMM repeg already configured with amt given"; }, { code: 6013; name: "invalidRepegDirection"; msg: "AMM repeg incorrect repeg direction"; }, { code: 6014; name: "invalidRepegProfitability"; msg: "AMM repeg out of bounds pnl"; }, { code: 6015; name: "slippageOutsideLimit"; msg: "Slippage Outside Limit Price"; }, { code: 6016; name: "orderSizeTooSmall"; msg: "Order Size Too Small"; }, { code: 6017; name: "invalidUpdateK"; msg: "Price change too large when updating K"; }, { code: 6018; name: "adminWithdrawTooLarge"; msg: "Admin tried to withdraw amount larger than fees collected"; }, { code: 6019; name: "mathError"; msg: "Math Error"; }, { code: 6020; name: "bnConversionError"; msg: "Conversion to u128/u64 failed with an overflow or underflow"; }, { code: 6021; name: "clockUnavailable"; msg: "Clock unavailable"; }, { code: 6022; name: "unableToLoadOracle"; msg: "Unable To Load Oracles"; }, { code: 6023; name: "priceBandsBreached"; msg: "Price Bands Breached"; }, { code: 6024; name: "exchangePaused"; msg: "Exchange is paused"; }, { code: 6025; name: "invalidWhitelistToken"; msg: "Invalid whitelist token"; }, { code: 6026; name: "whitelistTokenNotFound"; msg: "Whitelist token not found"; }, { code: 6027; name: "invalidDiscountToken"; msg: "Invalid discount token"; }, { code: 6028; name: "discountTokenNotFound"; msg: "Discount token not found"; }, { code: 6029; name: "referrerNotFound"; msg: "Referrer not found"; }, { code: 6030; name: "referrerStatsNotFound"; msg: "referrerNotFound"; }, { code: 6031; name: "referrerMustBeWritable"; msg: "referrerMustBeWritable"; }, { code: 6032; name: "referrerStatsMustBeWritable"; msg: "referrerMustBeWritable"; }, { code: 6033; name: "referrerAndReferrerStatsAuthorityUnequal"; msg: "referrerAndReferrerStatsAuthorityUnequal"; }, { code: 6034; name: "invalidReferrer"; msg: "invalidReferrer"; }, { code: 6035; name: "invalidOracle"; msg: "invalidOracle"; }, { code: 6036; name: "oracleNotFound"; msg: "oracleNotFound"; }, { code: 6037; name: "liquidationsBlockedByOracle"; msg: "Liquidations Blocked By Oracle"; }, { code: 6038; name: "maxDeposit"; msg: "Can not deposit more than max deposit"; }, { code: 6039; name: "cantDeleteUserWithCollateral"; msg: "Can not delete user that still has collateral"; }, { code: 6040; name: "invalidFundingProfitability"; msg: "AMM funding out of bounds pnl"; }, { code: 6041; name: "castingFailure"; msg: "Casting Failure"; }, { code: 6042; name: "invalidOrder"; msg: "invalidOrder"; }, { code: 6043; name: "invalidOrderMaxTs"; msg: "invalidOrderMaxTs"; }, { code: 6044; name: "invalidOrderMarketType"; msg: "invalidOrderMarketType"; }, { code: 6045; name: "invalidOrderForInitialMarginReq"; msg: "invalidOrderForInitialMarginReq"; }, { code: 6046; name: "invalidOrderNotRiskReducing"; msg: "invalidOrderNotRiskReducing"; }, { code: 6047; name: "invalidOrderSizeTooSmall"; msg: "invalidOrderSizeTooSmall"; }, { code: 6048; name: "invalidOrderNotStepSizeMultiple"; msg: "invalidOrderNotStepSizeMultiple"; }, { code: 6049; name: "invalidOrderBaseQuoteAsset"; msg: "invalidOrderBaseQuoteAsset"; }, { code: 6050; name: "invalidOrderIoc"; msg: "invalidOrderIoc"; }, { code: 6051; name: "invalidOrderPostOnly"; msg: "invalidOrderPostOnly"; }, { code: 6052; name: "invalidOrderIocPostOnly"; msg: "invalidOrderIocPostOnly"; }, { code: 6053; name: "invalidOrderTrigger"; msg: "invalidOrderTrigger"; }, { code: 6054; name: "invalidOrderAuction"; msg: "invalidOrderAuction"; }, { code: 6055; name: "invalidOrderOracleOffset"; msg: "invalidOrderOracleOffset"; }, { code: 6056; name: "invalidOrderMinOrderSize"; msg: "invalidOrderMinOrderSize"; }, { code: 6057; name: "placePostOnlyLimitFailure"; msg: "Failed to Place Post-Only Limit Order"; }, { code: 6058; name: "userHasNoOrder"; msg: "User has no order"; }, { code: 6059; name: "orderAmountTooSmall"; msg: "Order Amount Too Small"; }, { code: 6060; name: "maxNumberOfOrders"; msg: "Max number of orders taken"; }, { code: 6061; name: "orderDoesNotExist"; msg: "Order does not exist"; }, { code: 6062; name: "orderNotOpen"; msg: "Order not open"; }, { code: 6063; name: "fillOrderDidNotUpdateState"; msg: "fillOrderDidNotUpdateState"; }, { code: 6064; name: "reduceOnlyOrderIncreasedRisk"; msg: "Reduce only order increased risk"; }, { code: 6065; name: "unableToLoadAccountLoader"; msg: "Unable to load AccountLoader"; }, { code: 6066; name: "tradeSizeTooLarge"; msg: "Trade Size Too Large"; }, { code: 6067; name: "userCantReferThemselves"; msg: "User cant refer themselves"; }, { code: 6068; name: "didNotReceiveExpectedReferrer"; msg: "Did not receive expected referrer"; }, { code: 6069; name: "couldNotDeserializeReferrer"; msg: "Could not deserialize referrer"; }, { code: 6070; name: "couldNotDeserializeReferrerStats"; msg: "Could not deserialize referrer stats"; }, { code: 6071; name: "userOrderIdAlreadyInUse"; msg: "User Order Id Already In Use"; }, { code: 6072; name: "noPositionsLiquidatable"; msg: "No positions liquidatable"; }, { code: 6073; name: "invalidMarginRatio"; msg: "Invalid Margin Ratio"; }, { code: 6074; name: "cantCancelPostOnlyOrder"; msg: "Cant Cancel Post Only Order"; }, { code: 6075; name: "invalidOracleOffset"; msg: "invalidOracleOffset"; }, { code: 6076; name: "cantExpireOrders"; msg: "cantExpireOrders"; }, { code: 6077; name: "couldNotLoadMarketData"; msg: "couldNotLoadMarketData"; }, { code: 6078; name: "perpMarketNotFound"; msg: "perpMarketNotFound"; }, { code: 6079; name: "invalidMarketAccount"; msg: "invalidMarketAccount"; }, { code: 6080; name: "unableToLoadPerpMarketAccount"; msg: "unableToLoadMarketAccount"; }, { code: 6081; name: "marketWrongMutability"; msg: "marketWrongMutability"; }, { code: 6082; name: "unableToCastUnixTime"; msg: "unableToCastUnixTime"; }, { code: 6083; name: "couldNotFindSpotPosition"; msg: "couldNotFindSpotPosition"; }, { code: 6084; name: "noSpotPositionAvailable"; msg: "noSpotPositionAvailable"; }, { code: 6085; name: "invalidSpotMarketInitialization"; msg: "invalidSpotMarketInitialization"; }, { code: 6086; name: "couldNotLoadSpotMarketData"; msg: "couldNotLoadSpotMarketData"; }, { code: 6087; name: "spotMarketNotFound"; msg: "spotMarketNotFound"; }, { code: 6088; name: "invalidSpotMarketAccount"; msg: "invalidSpotMarketAccount"; }, { code: 6089; name: "unableToLoadSpotMarketAccount"; msg: "unableToLoadSpotMarketAccount"; }, { code: 6090; name: "spotMarketWrongMutability"; msg: "spotMarketWrongMutability"; }, { code: 6091; name: "spotMarketInterestNotUpToDate"; msg: "spotInterestNotUpToDate"; }, { code: 6092; name: "spotMarketInsufficientDeposits"; msg: "spotMarketInsufficientDeposits"; }, { code: 6093; name: "userMustSettleTheirOwnPositiveUnsettledPnl"; msg: "userMustSettleTheirOwnPositiveUnsettledPnl"; }, { code: 6094; name: "cantUpdatePoolBalanceType"; msg: "cantUpdatePoolBalanceType"; }, { code: 6095; name: "insufficientCollateralForSettlingPnl"; msg: "insufficientCollateralForSettlingPnl"; }, { code: 6096; name: "ammNotUpdatedInSameSlot"; msg: "ammNotUpdatedInSameSlot"; }, { code: 6097; name: "auctionNotComplete"; msg: "auctionNotComplete"; }, { code: 6098; name: "makerNotFound"; msg: "makerNotFound"; }, { code: 6099; name: "makerStatsNotFound"; msg: "makerNotFound"; }, { code: 6100; name: "makerMustBeWritable"; msg: "makerMustBeWritable"; }, { code: 6101; name: "makerStatsMustBeWritable"; msg: "makerMustBeWritable"; }, { code: 6102; name: "makerOrderNotFound"; msg: "makerOrderNotFound"; }, { code: 6103; name: "couldNotDeserializeMaker"; msg: "couldNotDeserializeMaker"; }, { code: 6104; name: "couldNotDeserializeMakerStats"; msg: "couldNotDeserializeMaker"; }, { code: 6105; name: "auctionPriceDoesNotSatisfyMaker"; msg: "auctionPriceDoesNotSatisfyMaker"; }, { code: 6106; name: "makerCantFulfillOwnOrder"; msg: "makerCantFulfillOwnOrder"; }, { code: 6107; name: "makerOrderMustBePostOnly"; msg: "makerOrderMustBePostOnly"; }, { code: 6108; name: "cantMatchTwoPostOnlys"; msg: "cantMatchTwoPostOnlys"; }, { code: 6109; name: "orderBreachesOraclePriceLimits"; msg: "orderBreachesOraclePriceLimits"; }, { code: 6110; name: "orderMustBeTriggeredFirst"; msg: "orderMustBeTriggeredFirst"; }, { code: 6111; name: "orderNotTriggerable"; msg: "orderNotTriggerable"; }, { code: 6112; name: "orderDidNotSatisfyTriggerCondition"; msg: "orderDidNotSatisfyTriggerCondition"; }, { code: 6113; name: "positionAlreadyBeingLiquidated"; msg: "positionAlreadyBeingLiquidated"; }, { code: 6114; name: "positionDoesntHaveOpenPositionOrOrders"; msg: "positionDoesntHaveOpenPositionOrOrders"; }, { code: 6115; name: "allOrdersAreAlreadyLiquidations"; msg: "allOrdersAreAlreadyLiquidations"; }, { code: 6116; name: "cantCancelLiquidationOrder"; msg: "cantCancelLiquidationOrder"; }, { code: 6117; name: "userIsBeingLiquidated"; msg: "userIsBeingLiquidated"; }, { code: 6118; name: "liquidationsOngoing"; msg: "liquidationsOngoing"; }, { code: 6119; name: "wrongSpotBalanceType"; msg: "wrongSpotBalanceType"; }, { code: 6120; name: "userCantLiquidateThemself"; msg: "userCantLiquidateThemself"; }, { code: 6121; name: "invalidPerpPositionToLiquidate"; msg: "invalidPerpPositionToLiquidate"; }, { code: 6122; name: "invalidBaseAssetAmountForLiquidatePerp"; msg: "invalidBaseAssetAmountForLiquidatePerp"; }, { code: 6123; name: "invalidPositionLastFundingRate"; msg: "invalidPositionLastFundingRate"; }, { code: 6124; name: "invalidPositionDelta"; msg: "invalidPositionDelta"; }, { code: 6125; name: "userBankrupt"; msg: "userBankrupt"; }, { code: 6126; name: "userNotBankrupt"; msg: "userNotBankrupt"; }, { code: 6127; name: "userHasInvalidBorrow"; msg: "userHasInvalidBorrow"; }, { code: 6128; name: "dailyWithdrawLimit"; msg: "dailyWithdrawLimit"; }, { code: 6129; name: "defaultError"; msg: "defaultError"; }, { code: 6130; name: "insufficientLpTokens"; msg: "Insufficient LP tokens"; }, { code: 6131; name: "cantLpWithPerpPosition"; msg: "Cant LP with a market position"; }, { code: 6132; name: "unableToBurnLpTokens"; msg: "Unable to burn LP tokens"; }, { code: 6133; name: "tryingToRemoveLiquidityTooFast"; msg: "Trying to remove liqudity too fast after adding it"; }, { code: 6134; name: "invalidSpotMarketVault"; msg: "Invalid Spot Market Vault"; }, { code: 6135; name: "invalidSpotMarketState"; msg: "Invalid Spot Market State"; }, { code: 6136; name: "invalidSerumProgram"; msg: "invalidSerumProgram"; }, { code: 6137; name: "invalidSerumMarket"; msg: "invalidSerumMarket"; }, { code: 6138; name: "invalidSerumBids"; msg: "invalidSerumBids"; }, { code: 6139; name: "invalidSerumAsks"; msg: "invalidSerumAsks"; }, { code: 6140; name: "invalidSerumOpenOrders"; msg: "invalidSerumOpenOrders"; }, { code: 6141; name: "failedSerumCpi"; msg: "failedSerumCpi"; }, { code: 6142; name: "failedToFillOnExternalMarket"; msg: "failedToFillOnExternalMarket"; }, { code: 6143; name: "invalidFulfillmentConfig"; msg: "invalidFulfillmentConfig"; }, { code: 6144; name: "invalidFeeStructure"; msg: "invalidFeeStructure"; }, { code: 6145; name: "insufficientIfShares"; msg: "Insufficient IF shares"; }, { code: 6146; name: "marketActionPaused"; msg: "the Market has paused this action"; }, { code: 6147; name: "marketPlaceOrderPaused"; msg: "the Market status doesnt allow placing orders"; }, { code: 6148; name: "marketFillOrderPaused"; msg: "the Market status doesnt allow filling orders"; }, { code: 6149; name: "marketWithdrawPaused"; msg: "the Market status doesnt allow withdraws"; }, { code: 6150; name: "protectedAssetTierViolation"; msg: "Action violates the Protected Asset Tier rules"; }, { code: 6151; name: "isolatedAssetTierViolation"; msg: "Action violates the Isolated Asset Tier rules"; }, { code: 6152; name: "userCantBeDeleted"; msg: "User Cant Be Deleted"; }, { code: 6153; name: "reduceOnlyWithdrawIncreasedRisk"; msg: "Reduce Only Withdraw Increased Risk"; }, { code: 6154; name: "maxOpenInterest"; msg: "Max Open Interest"; }, { code: 6155; name: "cantResolvePerpBankruptcy"; msg: "Cant Resolve Perp Bankruptcy"; }, { code: 6156; name: "liquidationDoesntSatisfyLimitPrice"; msg: "Liquidation Doesnt Satisfy Limit Price"; }, { code: 6157; name: "marginTradingDisabled"; msg: "Margin Trading Disabled"; }, { code: 6158; name: "invalidMarketStatusToSettlePnl"; msg: "Invalid Market Status to Settle Perp Pnl"; }, { code: 6159; name: "perpMarketNotInSettlement"; msg: "perpMarketNotInSettlement"; }, { code: 6160; name: "perpMarketNotInReduceOnly"; msg: "perpMarketNotInReduceOnly"; }, { code: 6161; name: "perpMarketSettlementBufferNotReached"; msg: "perpMarketSettlementBufferNotReached"; }, { code: 6162; name: "perpMarketSettlementUserHasOpenOrders"; msg: "perpMarketSettlementUserHasOpenOrders"; }, { code: 6163; name: "perpMarketSettlementUserHasActiveLp"; msg: "perpMarketSettlementUserHasActiveLp"; }, { code: 6164; name: "unableToSettleExpiredUserPosition"; msg: "unableToSettleExpiredUserPosition"; }, { code: 6165; name: "unequalMarketIndexForSpotTransfer"; msg: "unequalMarketIndexForSpotTransfer"; }, { code: 6166; name: "invalidPerpPositionDetected"; msg: "invalidPerpPositionDetected"; }, { code: 6167; name: "invalidSpotPositionDetected"; msg: "invalidSpotPositionDetected"; }, { code: 6168; name: "invalidAmmDetected"; msg: "invalidAmmDetected"; }, { code: 6169; name: "invalidAmmForFillDetected"; msg: "invalidAmmForFillDetected"; }, { code: 6170; name: "invalidAmmLimitPriceOverride"; msg: "invalidAmmLimitPriceOverride"; }, { code: 6171; name: "invalidOrderFillPrice"; msg: "invalidOrderFillPrice"; }, { code: 6172; name: "spotMarketBalanceInvariantViolated"; msg: "spotMarketBalanceInvariantViolated"; }, { code: 6173; name: "spotMarketVaultInvariantViolated"; msg: "spotMarketVaultInvariantViolated"; }, { code: 6174; name: "invalidPda"; msg: "invalidPda"; }, { code: 6175; name: "invalidPdaSigner"; msg: "invalidPdaSigner"; }, { code: 6176; name: "revenueSettingsCannotSettleToIf"; msg: "revenueSettingsCannotSettleToIf"; }, { code: 6177; name: "noRevenueToSettleToIf"; msg: "noRevenueToSettleToIf"; }, { code: 6178; name: "noAmmPerpPnlDeficit"; msg: "noAmmPerpPnlDeficit"; }, { code: 6179; name: "sufficientPerpPnlPool"; msg: "sufficientPerpPnlPool"; }, { code: 6180; name: "insufficientPerpPnlPool"; msg: "insufficientPerpPnlPool"; }, { code: 6181; name: "perpPnlDeficitBelowThreshold"; msg: "perpPnlDeficitBelowThreshold"; }, { code: 6182; name: "maxRevenueWithdrawPerPeriodReached"; msg: "maxRevenueWithdrawPerPeriodReached"; }, { code: 6183; name: "maxIfWithdrawReached"; msg: "invalidSpotPositionDetected"; }, { code: 6184; name: "noIfWithdrawAvailable"; msg: "noIfWithdrawAvailable"; }, { code: 6185; name: "invalidIfUnstake"; msg: "invalidIfUnstake"; }, { code: 6186; name: "invalidIfUnstakeSize"; msg: "invalidIfUnstakeSize"; }, { code: 6187; name: "invalidIfUnstakeCancel"; msg: "invalidIfUnstakeCancel"; }, { code: 6188; name: "invalidIfForNewStakes"; msg: "invalidIfForNewStakes"; }, { code: 6189; name: "invalidIfRebase"; msg: "invalidIfRebase"; }, { code: 6190; name: "invalidInsuranceUnstakeSize"; msg: "invalidInsuranceUnstakeSize"; }, { code: 6191; name: "invalidOrderLimitPrice"; msg: "invalidOrderLimitPrice"; }, { code: 6192; name: "invalidIfDetected"; msg: "invalidIfDetected"; }, { code: 6193; name: "invalidAmmMaxSpreadDetected"; msg: "invalidAmmMaxSpreadDetected"; }, { code: 6194; name: "invalidConcentrationCoef"; msg: "invalidConcentrationCoef"; }, { code: 6195; name: "invalidSrmVault"; msg: "invalidSrmVault"; }, { code: 6196; name: "invalidVaultOwner"; msg: "invalidVaultOwner"; }, { code: 6197; name: "invalidMarketStatusForFills"; msg: "invalidMarketStatusForFills"; }, { code: 6198; name: "ifWithdrawRequestInProgress"; msg: "ifWithdrawRequestInProgress"; }, { code: 6199; name: "noIfWithdrawRequestInProgress"; msg: "noIfWithdrawRequestInProgress"; }, { code: 6200; name: "ifWithdrawRequestTooSmall"; msg: "ifWithdrawRequestTooSmall"; }, { code: 6201; name: "incorrectSpotMarketAccountPassed"; msg: "incorrectSpotMarketAccountPassed"; }, { code: 6202; name: "blockchainClockInconsistency"; msg: "blockchainClockInconsistency"; }, { code: 6203; name: "invalidIfSharesDetected"; msg: "invalidIfSharesDetected"; }, { code: 6204; name: "newLpSizeTooSmall"; msg: "newLpSizeTooSmall"; }, { code: 6205; name: "marketStatusInvalidForNewLp"; msg: "marketStatusInvalidForNewLp"; }, { code: 6206; name: "invalidMarkTwapUpdateDetected"; msg: "invalidMarkTwapUpdateDetected"; }, { code: 6207; name: "marketSettlementAttemptOnActiveMarket"; msg: "marketSettlementAttemptOnActiveMarket"; }, { code: 6208; name: "marketSettlementRequiresSettledLp"; msg: "marketSettlementRequiresSettledLp"; }, { code: 6209; name: "marketSettlementAttemptTooEarly"; msg: "marketSettlementAttemptTooEarly"; }, { code: 6210; name: "marketSettlementTargetPriceInvalid"; msg: "marketSettlementTargetPriceInvalid"; }, { code: 6211; name: "unsupportedSpotMarket"; msg: "unsupportedSpotMarket"; }, { code: 6212; name: "spotOrdersDisabled"; msg: "spotOrdersDisabled"; }, { code: 6213; name: "marketBeingInitialized"; msg: "Market Being Initialized"; }, { code: 6214; name: "invalidUserSubAccountId"; msg: "Invalid Sub Account Id"; }, { code: 6215; name: "invalidTriggerOrderCondition"; msg: "Invalid Trigger Order Condition"; }, { code: 6216; name: "invalidSpotPosition"; msg: "Invalid Spot Position"; }, { code: 6217; name: "cantTransferBetweenSameUserAccount"; msg: "Cant transfer between same user account"; }, { code: 6218; name: "invalidPerpPosition"; msg: "Invalid Perp Position"; }, { code: 6219; name: "unableToGetLimitPrice"; msg: "Unable To Get Limit Price"; }, { code: 6220; name: "invalidLiquidation"; msg: "Invalid Liquidation"; }, { code: 6221; name: "spotFulfillmentConfigDisabled"; msg: "Spot Fulfillment Config Disabled"; }, { code: 6222; name: "invalidMaker"; msg: "Invalid Maker"; }, { code: 6223; name: "failedUnwrap"; msg: "Failed Unwrap"; }, { code: 6224; name: "maxNumberOfUsers"; msg: "Max Number Of Users"; }, { code: 6225; name: "invalidOracleForSettlePnl"; msg: "invalidOracleForSettlePnl"; }, { code: 6226; name: "marginOrdersOpen"; msg: "marginOrdersOpen"; }, { code: 6227; name: "tierViolationLiquidatingPerpPnl"; msg: "tierViolationLiquidatingPerpPnl"; }, { code: 6228; name: "couldNotLoadUserData"; msg: "couldNotLoadUserData"; }, { code: 6229; name: "userWrongMutability"; msg: "userWrongMutability"; }, { code: 6230; name: "invalidUserAccount"; msg: "invalidUserAccount"; }, { code: 6231; name: "couldNotLoadUserStatsData"; msg: "couldNotLoadUserData"; }, { code: 6232; name: "userStatsWrongMutability"; msg: "userWrongMutability"; }, { code: 6233; name: "invalidUserStatsAccount"; msg: "invalidUserAccount"; }, { code: 6234; name: "userNotFound"; msg: "userNotFound"; }, { code: 6235; name: "unableToLoadUserAccount"; msg: "unableToLoadUserAccount"; }, { code: 6236; name: "userStatsNotFound"; msg: "userStatsNotFound"; }, { code: 6237; name: "unableToLoadUserStatsAccount"; msg: "unableToLoadUserStatsAccount"; }, { code: 6238; name: "userNotInactive"; msg: "User Not Inactive"; }, { code: 6239; name: "revertFill"; msg: "revertFill"; }, { code: 6240; name: "invalidMarketAccountforDeletion"; msg: "Invalid MarketAccount for Deletion"; }, { code: 6241; name: "invalidSpotFulfillmentParams"; msg: "Invalid Spot Fulfillment Params"; }, { code: 6242; name: "failedToGetMint"; msg: "Failed to Get Mint"; }, { code: 6243; name: "failedPhoenixCpi"; msg: "failedPhoenixCpi"; }, { code: 6244; name: "failedToDeserializePhoenixMarket"; msg: "failedToDeserializePhoenixMarket"; }, { code: 6245; name: "invalidPricePrecision"; msg: "invalidPricePrecision"; }, { code: 6246; name: "invalidPhoenixProgram"; msg: "invalidPhoenixProgram"; }, { code: 6247; name: "invalidPhoenixMarket"; msg: "invalidPhoenixMarket"; }, { code: 6248; name: "invalidSwap"; msg: "invalidSwap"; }, { code: 6249; name: "swapLimitPriceBreached"; msg: "swapLimitPriceBreached"; }, { code: 6250; name: "spotMarketReduceOnly"; msg: "spotMarketReduceOnly"; }, { code: 6251; name: "fundingWasNotUpdated"; msg: "fundingWasNotUpdated"; }, { code: 6252; name: "impossibleFill"; msg: "impossibleFill"; }, { code: 6253; name: "cantUpdatePerpBidAskTwap"; msg: "cantUpdatePerpBidAskTwap"; }, { code: 6254; name: "userReduceOnly"; msg: "userReduceOnly"; }, { code: 6255; name: "invalidMarginCalculation"; msg: "invalidMarginCalculation"; }, { code: 6256; name: "cantPayUserInitFee"; msg: "cantPayUserInitFee"; }, { code: 6257; name: "cantReclaimRent"; msg: "cantReclaimRent"; }, { code: 6258; name: "insuranceFundOperationPaused"; msg: "insuranceFundOperationPaused"; }, { code: 6259; name: "noUnsettledPnl"; msg: "noUnsettledPnl"; }, { code: 6260; name: "pnlPoolCantSettleUser"; msg: "pnlPoolCantSettleUser"; }, { code: 6261; name: "oracleNonPositive"; msg: "oracleInvalid"; }, { code: 6262; name: "oracleTooVolatile"; msg: "oracleTooVolatile"; }, { code: 6263; name: "oracleTooUncertain"; msg: "oracleTooUncertain"; }, { code: 6264; name: "oracleStaleForMargin"; msg: "oracleStaleForMargin"; }, { code: 6265; name: "oracleInsufficientDataPoints"; msg: "oracleInsufficientDataPoints"; }, { code: 6266; name: "oracleStaleForAmm"; msg: "oracleStaleForAmm"; }, { code: 6267; name: "unableToParsePullOracleMessage"; msg: "Unable to parse pull oracle message"; }, { code: 6268; name: "maxBorrows"; msg: "Can not borow more than max borrows"; }, { code: 6269; name: "oracleUpdatesNotMonotonic"; msg: "Updates must be monotonically increasing"; }, { code: 6270; name: "oraclePriceFeedMessageMismatch"; msg: "Trying to update price feed with the wrong feed id"; }, { code: 6271; name: "oracleUnsupportedMessageType"; msg: "The message in the update must be a PriceFeedMessage"; }, { code: 6272; name: "oracleDeserializeMessageFailed"; msg: "Could not deserialize the message in the update"; }, { code: 6273; name: "oracleWrongGuardianSetOwner"; msg: "Wrong guardian set owner in update price atomic"; }, { code: 6274; name: "oracleWrongWriteAuthority"; msg: "Oracle post update atomic price feed account must be drift program"; }, { code: 6275; name: "oracleWrongVaaOwner"; msg: "Oracle vaa owner must be wormhole program"; }, { code: 6276; name: "oracleTooManyPriceAccountUpdates"; msg: "Multi updates must have 2 or fewer accounts passed in remaining accounts"; }, { code: 6277; name: "oracleMismatchedVaaAndPriceUpdates"; msg: "Don't have the same remaining accounts number and pyth updates left"; }, { code: 6278; name: "oracleBadRemainingAccountPublicKey"; msg: "Remaining account passed does not match oracle update derived pda"; }, { code: 6279; name: "failedOpenbookV2cpi"; msg: "failedOpenbookV2cpi"; }, { code: 6280; name: "invalidOpenbookV2Program"; msg: "invalidOpenbookV2Program"; }, { code: 6281; name: "invalidOpenbookV2Market"; msg: "invalidOpenbookV2Market"; }, { code: 6282; name: "nonZeroTransferFee"; msg: "Non zero transfer fee"; }, { code: 6283; name: "liquidationOrderFailedToFill"; msg: "Liquidation order failed to fill"; }, { code: 6284; name: "invalidPredictionMarketOrder"; msg: "Invalid prediction market order"; }, { code: 6285; name: "invalidVerificationIxIndex"; msg: "Ed25519 Ix must be before place and make SignedMsg order ix"; }, { code: 6286; name: "sigVerificationFailed"; msg: "SignedMsg message verificaiton failed"; }, { code: 6287; name: "mismatchedSignedMsgOrderParamsMarketIndex"; msg: "Market index mismatched b/w taker and maker SignedMsg order params"; }, { code: 6288; name: "invalidSignedMsgOrderParam"; msg: "Invalid SignedMsg order param"; }, { code: 6289; name: "placeAndTakeOrderSuccessConditionFailed"; msg: "Place and take order success condition failed"; }, { code: 6290; name: "invalidHighLeverageModeConfig"; msg: "Invalid High Leverage Mode Config"; }, { code: 6291; name: "invalidRfqUserAccount"; msg: "Invalid RFQ User Account"; }, { code: 6292; name: "rfqUserAccountWrongMutability"; msg: "RFQUserAccount should be mutable"; }, { code: 6293; name: "rfqUserAccountFull"; msg: "RFQUserAccount has too many active RFQs"; }, { code: 6294; name: "rfqOrderNotFilled"; msg: "RFQ order not filled as expected"; }, { code: 6295; name: "invalidRfqOrder"; msg: "RFQ orders must be jit makers"; }, { code: 6296; name: "invalidRfqMatch"; msg: "RFQ matches must be valid"; }, { code: 6297; name: "invalidSignedMsgUserAccount"; msg: "Invalid SignedMsg user account"; }, { code: 6298; name: "signedMsgUserAccountWrongMutability"; msg: "SignedMsg account wrong mutability"; }, { code: 6299; name: "signedMsgUserOrdersAccountFull"; msg: "SignedMsgUserAccount has too many active orders"; }, { code: 6300; name: "signedMsgOrderDoesNotExist"; msg: "Order with SignedMsg uuid does not exist"; }, { code: 6301; name: "invalidSignedMsgOrderId"; msg: "SignedMsg order id cannot be 0s"; }, { code: 6302; name: "invalidPoolId"; msg: "Invalid pool id"; }, { code: 6303; name: "invalidProtectedMakerModeConfig"; msg: "Invalid Protected Maker Mode Config"; }, { code: 6304; name: "invalidPythLazerStorageOwner"; msg: "Invalid pyth lazer storage owner"; }, { code: 6305; name: "unverifiedPythLazerMessage"; msg: "Verification of pyth lazer message failed"; }, { code: 6306; name: "invalidPythLazerMessage"; msg: "Invalid pyth lazer message"; }, { code: 6307; name: "pythLazerMessagePriceFeedMismatch"; msg: "Pyth lazer message does not correspond to correct fed id"; }, { code: 6308; name: "invalidLiquidateSpotWithSwap"; msg: "invalidLiquidateSpotWithSwap"; }, { code: 6309; name: "signedMsgUserContextUserMismatch"; msg: "User in SignedMsg message does not match user in ix context"; }, { code: 6310; name: "userFuelOverflowThresholdNotMet"; msg: "User fuel overflow threshold not met"; }, { code: 6311; name: "fuelOverflowAccountNotFound"; msg: "FuelOverflow account not found"; }, { code: 6312; name: "invalidTransferPerpPosition"; msg: "Invalid Transfer Perp Position"; }, { code: 6313; name: "invalidSignedMsgUserOrdersResize"; msg: "Invalid SignedMsgUserOrders resize"; } ]; types: [ { name: "updatePerpMarketSummaryStatsParams"; type: { kind: "struct"; fields: [ { name: "quoteAssetAmountWithUnsettledLp"; type: { option: "i64"; }; }, { name: "netUnsettledFundingPnl"; type: { option: "i64"; }; }, { name: "updateAmmSummaryStats"; type: { option: "bool"; }; }, { name: "excludeTotalLiqFee"; type: { option: "bool"; }; } ]; }; }, { name: "liquidatePerpRecord"; type: { kind: "struct"; fields: [ { name: "marketIndex"; type: "u16"; }, { name: "oraclePrice"; type: "i64"; }, { name: "baseAssetAmount"; type: "i64"; }, { name: "quoteAssetAmount"; type: "i64"; }, { name: "lpShares"; docs: ["precision: AMM_RESERVE_PRECISION"]; type: "u64"; }, { name: "fillRecordId"; type: "u64"; }, { name: "userOrderId"; type: "u32"; }, { name: "liquidatorOrderId"; type: "u32"; }, { name: "liquidatorFee"; docs: ["precision: QUOTE_PRECISION"]; type: "u64"; }, { name: "ifFee"; docs: ["precision: QUOTE_PRECISION"]; type: "u64"; } ]; }; }, { name: "liquidateSpotRecord"; type: { kind: "struct"; fields: [ { name: "assetMarketIndex"; type: "u16"; }, { name: "assetPrice"; type: "i64"; }, { name: "assetTransfer"; type: "u128"; }, { name: "liabilityMarketIndex"; type: "u16"; }, { name: "liabilityPrice"; type: "i64"; }, { name: "liabilityTransfer"; docs: ["precision: token mint precision"]; type: "u128"; }, { name: "ifFee"; docs: ["precision: token mint precision"]; type: "u64"; } ]; }; }, { name: "liquidateBorrowForPerpPnlRecord"; type: { kind: "struct"; fields: [ { name: "perpMarketIndex"; type: "u16"; }, { name: "marketOraclePrice"; type: "i64"; }, { name: "pnlTransfer"; type: "u128"; }, { name: "liabilityMarketIndex"; type: "u16"; }, { name: "liabilityPrice"; type: "i64"; }, { name: "liabilityTransfer"; type: "u128"; } ]; }; }, { name: "liquidatePerpPnlForDepositRecord"; type: { kind: "struct"; fields: [ { name: "perpMarketIndex"; type: "u16"; }, { name: "marketOraclePrice"; type: "i64"; }, { name: "pnlTransfer"; type: "u128"; }, { name: "assetMarketIndex"; type: "u16"; }, { name: "assetPrice"; type: "i64"; }, { name: "assetTransfer"; type: "u128"; } ]; }; }, { name: "perpBankruptcyRecord"; type: { kind: "struct"; fields: [ { name: "marketIndex"; type: "u16"; }, { name: "pnl"; type: "i128"; }, { name: "ifPayment"; type: "u128"; }, { name: "clawbackUser"; type: { option: "pubkey"; }; }, { name: "clawbackUserPayment"; type: { option: "u128"; }; }, { name: "cumulativeFundingRateDelta"; type: "i128"; } ]; }; }, { name: "spotBankruptcyRecord"; type: { kind: "struct"; fields: [ { name: "marketIndex"; type: "u16"; }, { name: "borrowAmount"; type: "u128"; }, { name: "ifPayment"; type: "u128"; }, { name: "cumulativeDepositInterestDelta"; type: "u128"; } ]; }; }, { name: "marketIdentifier"; type: { kind: "struct"; fields: [ { name: "marketType"; type: { defined: { name: "marketType"; }; }; }, { name: "marketIndex"; type: "u16"; } ]; }; }, { name: "historicalOracleData"; type: { kind: "struct"; fields: [ { name: "lastOraclePrice"; docs: ["precision: PRICE_PRECISION"]; type: "i64"; }, { name: "lastOracleConf"; docs: ["precision: PRICE_PRECISION"]; type: "u64"; }, { name: "lastOracleDelay"; docs: ["number of slots since last update"]; type: "i64"; }, { name: "lastOraclePriceTwap"; docs: ["precision: PRICE_PRECISION"]; type: "i64"; }, { name: "lastOraclePriceTwap5min"; docs: ["precision: PRICE_PRECISION"]; type: "i64"; }, { name: "lastOraclePriceTwapTs"; docs: ["unix_timestamp of last snapshot"]; type: "i64"; } ]; }; }, { name: "historicalIndexData"; type: { kind: "struct"; fields: [ { name: "lastIndexBidPrice"; docs: ["precision: PRICE_PRECISION"]; type: "u64"; }, { name: "lastIndexAskPrice"; docs: ["precision: PRICE_PRECISION"]; type: "u64"; }, { name: "lastIndexPriceTwap"; docs: ["precision: PRICE_PRECISION"]; type: "u64"; }, { name: "lastIndexPriceTwap5min"; docs: ["precision: PRICE_PRECISION"]; type: "u64"; }, { name: "lastIndexPriceTwapTs"; docs: ["unix_timestamp of last snapshot"]; type: "i64"; } ]; }; }, { name: "prelaunchOracleParams"; type: { kind: "struct"; fields: [ { name: "perpMarketIndex"; type: "u16"; }, { name: "price"; type: { option: "i64"; }; }, { name: "maxPrice"; type: { option: "i64"; }; } ]; }; }, { name: "orderParams"; type: { kind: "struct"; fields: [ { name: "orderType"; type: { defined: { name: "orderType"; }; }; }, { name: "marketType"; type: { defined: { name: "marketType"; }; }; }, { name: "direction"; type: { defined: { name: "positionDirection"; }; }; }, { name: "userOrderId"; type: "u8"; }, { name: "baseAssetAmount"; type: "u64"; }, { name: "price"; type: "u64"; }, { name: "marketIndex"; type: "u16"; }, { name: "reduceOnly"; type: "bool"; }, { name: "postOnly"; type: { defined: { name: "postOnlyParam"; }; }; }, { name: "immediateOrCancel"; type: "bool"; }, { name: "maxTs"; type: { option: "i64"; }; }, { name: "triggerPrice"; type: { option: "u64"; }; }, { name: "triggerCondition"; type: { defined: { name: "orderTriggerCondition"; }; }; }, { name: "oraclePriceOffset"; type: { option: "i32"; }; }, { name: "auctionDuration"; type: { option: "u8"; }; }, { name: "auctionStartPrice"; type: { option: "i64"; }; }, { name: "auctionEndPrice"; type: { option: "i64"; }; } ]; }; }, { name: "signedMsgOrderParamsMessage"; type: { kind: "struct"; fields: [ { name: "signedMsgOrderParams"; type: { defined: { name: "orderParams"; }; }; }, { name: "subAccountId"; type: "u16"; }, { name: "slot"; type: "u64"; }, { name: "uuid"; type: { array: ["u8", 8]; }; }, { name: "takeProfitOrderParams"; type: { option: { defined: { name: "signedMsgTriggerOrderParams"; }; }; }; }, { name: "stopLossOrderParams"; type: { option: { defined: { name: "signedMsgTriggerOrderParams"; }; }; }; } ]; }; }, { name: "signedMsgTriggerOrderParams"; type: { kind: "struct"; fields: [ { name: "triggerPrice"; type: "u64"; }, { name: "baseAssetAmount"; type: "u64"; } ]; }; }, { name: "modifyOrderParams"; type: { kind: "struct"; fields: [ { name: "direction"; type: { option: { defined: { name: "positionDirection"; }; }; }; }, { name: "baseAssetAmount"; type: { option: "u64"; }; }, { name: "price"; type: { option: "u64"; }; }, { name: "reduceOnly"; type: { option: "bool"; }; }, { name: "postOnly"; type: { option: { defined: { name: "postOnlyParam"; }; }; }; }, { name: "immediateOrCancel"; type: { option: "bool"; }; }, { name: "maxTs"; type: { option: "i64"; }; }, { name: "triggerPrice"; type: { option: "u64"; }; }, { name: "triggerCondition"; type: { option: { defined: { name: "orderTriggerCondition"; }; }; }; }, { name: "oraclePriceOffset"; type: { option: "i32"; }; }, { name: "auctionDuration"; type: { option: "u8"; }; }, { name: "auctionStartPrice"; type: { option: "i64"; }; }, { name: "auctionEndPrice"; type: { option: "i64"; }; }, { name: "policy"; type: { option: "u8"; }; } ]; }; }, { name: "insuranceClaim"; type: { kind: "struct"; fields: [ { name: "revenueWithdrawSinceLastSettle"; docs: [ "The amount of revenue last settled", "Positive if funds left the perp market,", "negative if funds were pulled into the perp market", "precision: QUOTE_PRECISION" ]; type: "i64"; }, { name: "maxRevenueWithdrawPerPeriod"; docs: [ "The max amount of revenue that can be withdrawn per period", "precision: QUOTE_PRECISION" ]; type: "u64"; }, { name: "quoteMaxInsurance"; docs: [ "The max amount of insurance that perp market can use to resolve bankruptcy and pnl deficits", "precision: QUOTE_PRECISION" ]; type: "u64"; }, { name: "quoteSettledInsurance"; docs: [ "The amount of insurance that has been used to resolve bankruptcy and pnl deficits", "precision: QUOTE_PRECISION" ]; type: "u64"; }, { name: "lastRevenueWithdrawTs"; docs: ["The last time revenue was settled in/out of market"]; type: "i64"; } ]; }; }, { name: "poolBalance"; type: { kind: "struct"; fields: [ { name: "scaledBalance"; docs: [ "To get the pool's token amount, you must multiply the scaled balance by the market's cumulative", "deposit interest", "precision: SPOT_BALANCE_PRECISION" ]; type: "u128"; }, { name: "marketIndex"; docs: ["The spot market the pool is for"]; type: "u16"; }, { name: "padding"; type: { array: ["u8", 6]; }; } ]; }; }, { name: "amm"; type: { kind: "struct"; fields: [ { name: "oracle"; docs: ["oracle price data public key"]; type: "pubkey"; }, { name: "historicalOracleData"; docs: ["stores historically witnessed oracle data"]; type: { defined: { name: "historicalOracleData"; }; }; }, { name: "baseAssetAmountPerLp"; docs: [ "accumulated base asset amount since inception per lp share", "precision: QUOTE_PRECISION" ]; type: "i128"; }, { name: "quoteAssetAmountPerLp"; docs: [ "accumulated quote asset amount since inception per lp share", "precision: QUOTE_PRECISION" ]; type: "i128"; }, { name: "feePool"; docs: [ "partition of fees from perp market trading moved from pnl settlements" ]; type: { defined: { name: "poolBalance"; }; }; }, { name: "baseAssetReserve"; docs: [ "`x` reserves for constant product mm formula (x * y = k)", "precision: AMM_RESERVE_PRECISION" ]; type: "u128"; }, { name: "quoteAssetReserve"; docs: [ "`y` reserves for constant product mm formula (x * y = k)", "precision: AMM_RESERVE_PRECISION" ]; type: "u128"; }, { name: "concentrationCoef"; docs: [ "determines how close the min/max base asset reserve sit vs base reserves", "allow for decreasing slippage without increasing liquidity and v.v.", "precision: PERCENTAGE_PRECISION" ]; type: "u128"; }, { name: "minBaseAssetReserve"; docs: [ "minimum base_asset_reserve allowed before AMM is unavailable", "precision: AMM_RESERVE_PRECISION" ]; type: "u128"; }, { name: "maxBaseAssetReserve"; docs: [ "maximum base_asset_reserve allowed before AMM is unavailable", "precision: AMM_RESERVE_PRECISION" ]; type: "u128"; }, { name: "sqrtK"; docs: [ "`sqrt(k)` in constant product mm formula (x * y = k). stored to avoid drift caused by integer math issues", "precision: AMM_RESERVE_PRECISION" ]; type: "u128"; }, { name: "pegMultiplier"; docs: [ "normalizing numerical factor for y, its use offers lowest slippage in cp-curve when market is balanced", "precision: PEG_PRECISION" ]; type: "u128"; }, { name: "terminalQuoteAssetReserve"; docs: [ "y when market is balanced. stored to save computation", "precision: AMM_RESERVE_PRECISION" ]; type: "u128"; }, { name: "baseAssetAmountLong"; docs: [ "always non-negative. tracks number of total longs in market (regardless of counterparty)", "precision: BASE_PRECISION" ]; type: "i128"; }, { name: "baseAssetAmountShort"; docs: [ "always non-positive. tracks number of total shorts in market (regardless of counterparty)", "precision: BASE_PRECISION" ]; type: "i128"; }, { name: "baseAssetAmountWithAmm"; docs: [ "tracks net position (longs-shorts) in market with AMM as counterparty", "precision: BASE_PRECISION" ]; type: "i128"; }, { name: "baseAssetAmountWithUnsettledLp"; docs: [ "tracks net position (longs-shorts) in market with LPs as counterparty", "precision: BASE_PRECISION" ]; type: "i128"; }, { name: "maxOpenInterest"; docs: [ "max allowed open interest, blocks trades that breach this value", "precision: BASE_PRECISION" ]; type: "u128"; }, { name: "quoteAssetAmount"; docs: [ "sum of all user's perp quote_asset_amount in market", "precision: QUOTE_PRECISION" ]; type: "i128"; }, { name: "quoteEntryAmountLong"; docs: [ "sum of all long user's quote_entry_amount in market", "precision: QUOTE_PRECISION" ]; type: "i128"; }, { name: "quoteEntryAmountShort"; docs: [ "sum of all short user's quote_entry_amount in market", "precision: QUOTE_PRECISION" ]; type: "i128"; }, { name: "quoteBreakEvenAmountLong"; docs: [ "sum of all long user's quote_break_even_amount in market", "precision: QUOTE_PRECISION" ]; type: "i128"; }, { name: "quoteBreakEvenAmountShort"; docs: [ "sum of all short user's quote_break_even_amount in market", "precision: QUOTE_PRECISION" ]; type: "i128"; }, { name: "userLpShares"; docs: [ "total user lp shares of sqrt_k (protocol owned liquidity = sqrt_k - last_funding_rate)", "precision: AMM_RESERVE_PRECISION" ]; type: "u128"; }, { name: "lastFundingRate"; docs: [ "last funding rate in this perp market (unit is quote per base)", "precision: QUOTE_PRECISION" ]; type: "i64"; }, { name: "lastFundingRateLong"; docs: [ "last funding rate for longs in this perp market (unit is quote per base)", "precision: QUOTE_PRECISION" ]; type: "i64"; }, { name: "lastFundingRateShort"; docs: [ "last funding rate for shorts in this perp market (unit is quote per base)", "precision: QUOTE_PRECISION" ]; type: "i64"; }, { name: "last24hAvgFundingRate"; docs: [ "estimate of last 24h of funding rate perp market (unit is quote per base)", "precision: QUOTE_PRECISION" ]; type: "i64"; }, { name: "totalFee"; docs: [ "total fees collected by this perp market", "precision: QUOTE_PRECISION" ]; type: "i128"; }, { name: "totalMmFee"; docs: [ "total fees collected by the vAMM's bid/ask spread", "precision: QUOTE_PRECISION" ]; type: "i128"; }, { name: "totalExchangeFee"; docs: [ "total fees collected by exchange fee schedule", "precision: QUOTE_PRECISION" ]; type: "u128"; }, { name: "totalFeeMinusDistributions"; docs: [ "total fees minus any recognized upnl and pool withdraws", "precision: QUOTE_PRECISION" ]; type: "i128"; }, { name: "totalFeeWithdrawn"; docs: [ "sum of all fees from fee pool withdrawn to revenue pool", "precision: QUOTE_PRECISION" ]; type: "u128"; }, { name: "totalLiquidationFee"; docs: [ "all fees collected by market for liquidations", "precision: QUOTE_PRECISION" ]; type: "u128"; }, { name: "cumulativeFundingRateLong"; docs: [ "accumulated funding rate for longs since inception in market" ]; type: "i128"; }, { name: "cumulativeFundingRateShort"; docs: [ "accumulated funding rate for shorts since inception in market" ]; type: "i128"; }, { name: "totalSocialLoss"; docs: [ "accumulated social loss paid by users since inception in market" ]; type: "u128"; }, { name: "askBaseAssetReserve"; docs: [ "transformed base_asset_reserve for users going long", "precision: AMM_RESERVE_PRECISION" ]; type: "u128"; }, { name: "askQuoteAssetReserve"; docs: [ "transformed quote_asset_reserve for users going long", "precision: AMM_RESERVE_PRECISION" ]; type: "u128"; }, { name: "bidBaseAssetReserve"; docs: [ "transformed base_asset_reserve for users going short", "precision: AMM_RESERVE_PRECISION" ]; type: "u128"; }, { name: "bidQuoteAssetReserve"; docs: [ "transformed quote_asset_reserve for users going short", "precision: AMM_RESERVE_PRECISION" ]; type: "u128"; }, { name: "lastOracleNormalisedPrice"; docs: [ "the last seen oracle price partially shrunk toward the amm reserve price", "precision: PRICE_PRECISION" ]; type: "i64"; }, { name: "lastOracleReservePriceSpreadPct"; docs: [ "the gap between the oracle price and the reserve price = y * peg_multiplier / x" ]; type: "i64"; }, { name: "lastBidPriceTwap"; docs: [ "average estimate of bid price over funding_period", "precision: PRICE_PRECISION" ]; type: "u64"; }, { name: "lastAskPriceTwap"; docs: [ "average estimate of ask price over funding_period", "precision: PRICE_PRECISION" ]; type: "u64"; }, { name: "lastMarkPriceTwap"; docs: [ "average estimate of (bid+ask)/2 price over funding_period", "precision: PRICE_PRECISION" ]; type: "u64"; }, { name: "lastMarkPriceTwap5min"; docs: ["average estimate of (bid+ask)/2 price over FIVE_MINUTES"]; type: "u64"; }, { name: "lastUpdateSlot"; docs: ["the last blockchain slot the amm was updated"]; type: "u64"; }, { name: "lastOracleConfPct"; docs: [ "the pct size of the oracle confidence interval", "precision: PERCENTAGE_PRECISION" ]; type: "u64"; }, { name: "netRevenueSinceLastFunding"; docs: [ "the total_fee_minus_distribution change since the last funding update", "precision: QUOTE_PRECISION" ]; type: "i64"; }, { name: "lastFundingRateTs"; docs: ["the last funding rate update unix_timestamp"]; type: "i64"; }, { name: "fundingPeriod"; docs: ["the peridocity of the funding rate updates"]; type: "i64"; }, { name: "orderStepSize"; docs: [ "the base step size (increment) of orders", "precision: BASE_PRECISION" ]; type: "u64"; }, { name: "orderTickSize"; docs: [ "the price tick size of orders", "precision: PRICE_PRECISION" ]; type: "u64"; }, { name: "minOrderSize"; docs: [ "the minimum base size of an order", "precision: BASE_PRECISION" ]; type: "u64"; }, { name: "maxPositionSize"; docs: [ "the max base size a single user can have", "precision: BASE_PRECISION" ]; type: "u64"; }, { name: "volume24h"; docs: ["estimated total of volume in market", "QUOTE_PRECISION"]; type: "u64"; }, { name: "longIntensityVolume"; docs: ["the volume intensity of long fills against AMM"]; type: "u64"; }, { name: "shortIntensityVolume"; docs: ["the volume intensity of short fills against AMM"]; type: "u64"; }, { name: "lastTradeTs"; docs: [ "the blockchain unix timestamp at the time of the last trade" ]; type: "i64"; }, { name: "markStd"; docs: [ "estimate of standard deviation of the fill (mark) prices", "precision: PRICE_PRECISION" ]; type: "u64"; }, { name: "oracleStd"; docs: [ "estimate of standard deviation of the oracle price at each update", "precision: PRICE_PRECISION" ]; type: "u64"; }, { name: "lastMarkPriceTwapTs"; docs: ["the last unix_timestamp the mark twap was updated"]; type: "i64"; }, { name: "baseSpread"; docs: [ "the minimum spread the AMM can quote. also used as step size for some spread logic increases." ]; type: "u32"; }, { name: "maxSpread"; docs: ["the maximum spread the AMM can quote"]; type: "u32"; }, { name: "longSpread"; docs: ["the spread for asks vs the reserve price"]; type: "u32"; }, { name: "shortSpread"; docs: ["the spread for bids vs the reserve price"]; type: "u32"; }, { name: "longIntensityCount"; docs: ["the count intensity of long fills against AMM"]; type: "u32"; }, { name: "shortIntensityCount"; docs: ["the count intensity of short fills against AMM"]; type: "u32"; }, { name: "maxFillReserveFraction"; docs: [ "the fraction of total available liquidity a single fill on the AMM can consume" ]; type: "u16"; }, { name: "maxSlippageRatio"; docs: ["the maximum slippage a single fill on the AMM can push"]; type: "u16"; }, { name: "curveUpdateIntensity"; docs: [ "the update intensity of AMM formulaic updates (adjusting k). 0-100" ]; type: "u8"; }, { name: "ammJitIntensity"; docs: [ "the jit intensity of AMM. larger intensity means larger participation in jit. 0 means no jit participation.", "(0, 100] is intensity for protocol-owned AMM. (100, 200] is intensity for user LP-owned AMM." ]; type: "u8"; }, { name: "oracleSource"; docs: [ "the oracle provider information. used to decode/scale the oracle public key" ]; type: { defined: { name: "oracleSource"; }; }; }, { name: "lastOracleValid"; docs: [ "tracks whether the oracle was considered valid at the last AMM update" ]; type: "bool"; }, { name: "targetBaseAssetAmountPerLp"; docs: [ "the target value for `base_asset_amount_per_lp`, used during AMM JIT with LP split", "precision: BASE_PRECISION" ]; type: "i32"; }, { name: "perLpBase"; docs: [ "expo for unit of per_lp, base 10 (if per_lp_base=X, then per_lp unit is 10^X)" ]; type: "i8"; }, { name: "padding1"; type: "u8"; }, { name: "padding2"; type: "u16"; }, { name: "totalFeeEarnedPerLp"; type: "u64"; }, { name: "netUnsettledFundingPnl"; type: "i64"; }, { name: "quoteAssetAmountWithUnsettledLp"; type: "i64"; }, { name: "referencePriceOffset"; type: "i32"; }, { name: "padding"; type: { array: ["u8", 12]; }; } ]; }; }, { name: "signedMsgOrderId"; type: { kind: "struct"; fields: [ { name: "uuid"; type: { array: ["u8", 8]; }; }, { name: "maxSlot"; type: "u64"; }, { name: "orderId"; type: "u32"; }, { name: "padding"; type: "u32"; } ]; }; }, { name: "signedMsgUserOrdersFixed"; type: { kind: "struct"; fields: [ { name: "userPubkey"; type: "pubkey"; }, { name: "padding"; type: "u32"; }, { name: "len"; type: "u32"; } ]; }; }, { name: "insuranceFund"; type: { kind: "struct"; fields: [ { name: "vault"; type: "pubkey"; }, { name: "totalShares"; type: "u128"; }, { name: "userShares"; type: "u128"; }, { name: "sharesBase"; type: "u128"; }, { name: "unstakingPeriod"; type: "i64"; }, { name: "lastRevenueSettleTs"; type: "i64"; }, { name: "revenueSettlePeriod"; type: "i64"; }, { name: "totalFactor"; type: "u32"; }, { name: "userFactor"; type: "u32"; } ]; }; }, { name: "oracleGuardRails"; type: { kind: "struct"; fields: [ { name: "priceDivergence"; type: { defined: { name: "priceDivergenceGuardRails"; }; }; }, { name: "validity"; type: { defined: { name: "validityGuardRails"; }; }; } ]; }; }, { name: "priceDivergenceGuardRails"; type: { kind: "struct"; fields: [ { name: "markOraclePercentDivergence"; type: "u64"; }, { name: "oracleTwap5minPercentDivergence"; type: "u64"; } ]; }; }, { name: "validityGuardRails"; type: { kind: "struct"; fields: [ { name: "slotsBeforeStaleForAmm"; type: "i64"; }, { name: "slotsBeforeStaleForMargin"; type: "i64"; }, { name: "confidenceIntervalMaxSize"; type: "u64"; }, { name: "tooVolatileRatio"; type: "i64"; } ]; }; }, { name: "feeStructure"; type: { kind: "struct"; fields: [ { name: "feeTiers"; type: { array: [ { defined: { name: "feeTier"; }; }, 10 ]; }; }, { name: "fillerRewardStructure"; type: { defined: { name: "orderFillerRewardStructure"; }; }; }, { name: "referrerRewardEpochUpperBound"; type: "u64"; }, { name: "flatFillerFee"; type: "u64"; } ]; }; }, { name: "feeTier"; type: { kind: "struct"; fields: [ { name: "feeNumerator"; type: "u32"; }, { name: "feeDenominator"; type: "u32"; }, { name: "makerRebateNumerator"; type: "u32"; }, { name: "makerRebateDenominator"; type: "u32"; }, { name: "referrerRewardNumerator"; type: "u32"; }, { name: "referrerRewardDenominator"; type: "u32"; }, { name: "refereeFeeNumerator"; type: "u32"; }, { name: "refereeFeeDenominator"; type: "u32"; } ]; }; }, { name: "orderFillerRewardStructure"; type: { kind: "struct"; fields: [ { name: "rewardNumerator"; type: "u32"; }, { name: "rewardDenominator"; type: "u32"; }, { name: "timeBasedRewardLowerBound"; type: "u128"; } ]; }; }, { name: "userFees"; type: { kind: "struct"; fields: [ { name: "totalFeePaid"; docs: ["Total taker fee paid", "precision: QUOTE_PRECISION"]; type: "u64"; }, { name: "totalFeeRebate"; docs: ["Total maker fee rebate", "precision: QUOTE_PRECISION"]; type: "u64"; }, { name: "totalTokenDiscount"; docs: [ "Total discount from holding token", "precision: QUOTE_PRECISION" ]; type: "u64"; }, { name: "totalRefereeDiscount"; docs: [ "Total discount from being referred", "precision: QUOTE_PRECISION" ]; type: "u64"; }, { name: "totalReferrerReward"; docs: ["Total reward to referrer", "precision: QUOTE_PRECISION"]; type: "u64"; }, { name: "currentEpochReferrerReward"; docs: [ "Total reward to referrer this epoch", "precision: QUOTE_PRECISION" ]; type: "u64"; } ]; }; }, { name: "spotPosition"; type: { kind: "struct"; fields: [ { name: "scaledBalance"; docs: [ "The scaled balance of the position. To get the token amount, multiply by the cumulative deposit/borrow", "interest of corresponding market.", "precision: SPOT_BALANCE_PRECISION" ]; type: "u64"; }, { name: "openBids"; docs: [ "How many spot bids the user has open", "precision: token mint precision" ]; type: "i64"; }, { name: "openAsks"; docs: [ "How many spot asks the user has open", "precision: token mint precision" ]; type: "i64"; }, { name: "cumulativeDeposits"; docs: [ "The cumulative deposits/borrows a user has made into a market", "precision: token mint precision" ]; type: "i64"; }, { name: "marketIndex"; docs: ["The market index of the corresponding spot market"]; type: "u16"; }, { name: "balanceType"; docs: ["Whether the position is deposit or borrow"]; type: { defined: { name: "spotBalanceType"; }; }; }, { name: "openOrders"; docs: ["Number of open orders"]; type: "u8"; }, { name: "padding"; type: { array: ["u8", 4]; }; } ]; }; }, { name: "perpPosition"; type: { kind: "struct"; fields: [ { name: "lastCumulativeFundingRate"; docs: [ "The perp market's last cumulative funding rate. Used to calculate the funding payment owed to user", "precision: FUNDING_RATE_PRECISION" ]; type: "i64"; }, { name: "baseAssetAmount"; docs: [ "the size of the users perp position", "precision: BASE_PRECISION" ]; type: "i64"; }, { name: "quoteAssetAmount"; docs: [ "Used to calculate the users pnl. Upon entry, is equal to base_asset_amount * avg entry price - fees", "Updated when the user open/closes position or settles pnl. Includes fees/funding", "precision: QUOTE_PRECISION" ]; type: "i64"; }, { name: "quoteBreakEvenAmount"; docs: [ "The amount of quote the user would need to exit their position at to break even", "Updated when the user open/closes position or settles pnl. Includes fees/funding", "precision: QUOTE_PRECISION" ]; type: "i64"; }, { name: "quoteEntryAmount"; docs: [ "The amount quote the user entered the position with. Equal to base asset amount * avg entry price", "Updated when the user open/closes position. Excludes fees/funding", "precision: QUOTE_PRECISION" ]; type: "i64"; }, { name: "openBids"; docs: [ "The amount of open bids the user has in this perp market", "precision: BASE_PRECISION" ]; type: "i64"; }, { name: "openAsks"; docs: [ "The amount of open asks the user has in this perp market", "precision: BASE_PRECISION" ]; type: "i64"; }, { name: "settledPnl"; docs: [ "The amount of pnl settled in this market since opening the position", "precision: QUOTE_PRECISION" ]; type: "i64"; }, { name: "lpShares"; docs: [ "The number of lp (liquidity provider) shares the user has in this perp market", "LP shares allow users to provide liquidity via the AMM", "precision: BASE_PRECISION" ]; type: "u64"; }, { name: "lastBaseAssetAmountPerLp"; docs: [ "The last base asset amount per lp the amm had", "Used to settle the users lp position", "precision: BASE_PRECISION" ]; type: "i64"; }, { name: "lastQuoteAssetAmountPerLp"; docs: [ "The last quote asset amount per lp the amm had", "Used to settle the users lp position", "precision: QUOTE_PRECISION" ]; type: "i64"; }, { name: "remainderBaseAssetAmount"; docs: [ "Settling LP position can lead to a small amount of base asset being left over smaller than step size", "This records that remainder so it can be settled later on", "precision: BASE_PRECISION" ]; type: "i32"; }, { name: "marketIndex"; docs: ["The market index for the perp market"]; type: "u16"; }, { name: "openOrders"; docs: ["The number of open orders"]; type: "u8"; }, { name: "perLpBase"; type: "i8"; } ]; }; }, { name: "order"; type: { kind: "struct"; fields: [ { name: "slot"; docs: ["The slot the order was placed"]; type: "u64"; }, { name: "price"; docs: [ "The limit price for the order (can be 0 for market orders)", "For orders with an auction, this price isn't used until the auction is complete", "precision: PRICE_PRECISION" ]; type: "u64"; }, { name: "baseAssetAmount"; docs: [ "The size of the order", "precision for perps: BASE_PRECISION", "precision for spot: token mint precision" ]; type: "u64"; }, { name: "baseAssetAmountFilled"; docs: [ "The amount of the order filled", "precision for perps: BASE_PRECISION", "precision for spot: token mint precision" ]; type: "u64"; }, { name: "quoteAssetAmountFilled"; docs: [ "The amount of quote filled for the order", "precision: QUOTE_PRECISION" ]; type: "u64"; }, { name: "triggerPrice"; docs: [ "At what price the order will be triggered. Only relevant for trigger orders", "precision: PRICE_PRECISION" ]; type: "u64"; }, { name: "auctionStartPrice"; docs: [ "The start price for the auction. Only relevant for market/oracle orders", "precision: PRICE_PRECISION" ]; type: "i64"; }, { name: "auctionEndPrice"; docs: [ "The end price for the auction. Only relevant for market/oracle orders", "precision: PRICE_PRECISION" ]; type: "i64"; }, { name: "maxTs"; docs: ["The time when the order will expire"]; type: "i64"; }, { name: "oraclePriceOffset"; docs: [ "If set, the order limit price is the oracle price + this offset", "precision: PRICE_PRECISION" ]; type: "i32"; }, { name: "orderId"; docs: [ "The id for the order. Each users has their own order id space" ]; type: "u32"; }, { name: "marketIndex"; docs: ["The perp/spot market index"]; type: "u16"; }, { name: "status"; docs: ["Whether the order is open or unused"]; type: { defined: { name: "orderStatus"; }; }; }, { name: "orderType"; docs: ["The type of order"]; type: { defined: { name: "orderType"; }; }; }, { name: "marketType"; docs: ["Whether market is spot or perp"]; type: { defined: { name: "marketType"; }; }; }, { name: "userOrderId"; docs: [ "User generated order id. Can make it easier to place/cancel orders" ]; type: "u8"; }, { name: "existingPositionDirection"; docs: ["What the users position was when the order was placed"]; type: { defined: { name: "positionDirection"; }; }; }, { name: "direction"; docs: [ "Whether the user is going long or short. LONG = bid, SHORT = ask" ]; type: { defined: { name: "positionDirection"; }; }; }, { name: "reduceOnly"; docs: ["Whether the order is allowed to only reduce position size"]; type: "bool"; }, { name: "postOnly"; docs: ["Whether the order must be a maker"]; type: "bool"; }, { name: "immediateOrCancel"; docs: [ "Whether the order must be canceled the same slot it is placed" ]; type: "bool"; }, { name: "triggerCondition"; docs: [ "Whether the order is triggered above or below the trigger price. Only relevant for trigger orders" ]; type: { defined: { name: "orderTriggerCondition"; }; }; }, { name: "auctionDuration"; docs: ["How many slots the auction lasts"]; type: "u8"; }, { name: "postedSlotTail"; docs: [ "Last 8 bits of the slot the order was posted on-chain (not order slot for signed msg orders)" ]; type: "u8"; }, { name: "bitFlags"; docs: [ "Bitflags for further classification", "0: is_signed_message" ]; type: "u8"; }, { name: "padding"; type: { array: ["u8", 1]; }; } ]; }; }, { name: "swapDirection"; type: { kind: "enum"; variants: [ { name: "add"; }, { name: "remove"; } ]; }; }, { name: "modifyOrderId"; type: { kind: "enum"; variants: [ { name: "userOrderId"; fields: ["u8"]; }, { name: "orderId"; fields: ["u32"]; } ]; }; }, { name: "positionDirection"; type: { kind: "enum"; variants: [ { name: "long"; }, { name: "short"; } ]; }; }, { name: "spotFulfillmentType"; type: { kind: "enum"; variants: [ { name: "serumV3"; }, { name: "match"; }, { name: "phoenixV1"; }, { name: "openbookV2"; } ]; }; }, { name: "swapReduceOnly"; type: { kind: "enum"; variants: [ { name: "in"; }, { name: "out"; } ]; }; }, { name: "twapPeriod"; type: { kind: "enum"; variants: [ { name: "fundingPeriod"; }, { name: "fiveMin"; } ]; }; }, { name: "liquidationMultiplierType"; type: { kind: "enum"; variants: [ { name: "discount"; }, { name: "premium"; } ]; }; }, { name: "marginRequirementType"; type: { kind: "enum"; variants: [ { name: "initial"; }, { name: "fill"; }, { name: "maintenance"; } ]; }; }, { name: "oracleValidity"; type: { kind: "enum"; variants: [ { name: "nonPositive"; }, { name: "tooVolatile"; }, { name: "tooUncertain"; }, { name: "staleForMargin"; }, { name: "insufficientDataPoints"; }, { name: "staleForAmm"; }, { name: "valid"; } ]; }; }, { name: "driftAction"; type: { kind: "enum"; variants: [ { name: "updateFunding"; }, { name: "settlePnl"; }, { name: "triggerOrder"; }, { name: "fillOrderMatch"; }, { name: "fillOrderAmm"; }, { name: "liquidate"; }, { name: "marginCalc"; }, { name: "updateTwap"; }, { name: "updateAmmCurve"; }, { name: "oracleOrderPrice"; } ]; }; }, { name: "positionUpdateType"; type: { kind: "enum"; variants: [ { name: "open"; }, { name: "increase"; }, { name: "reduce"; }, { name: "close"; }, { name: "flip"; } ]; }; }, { name: "depositExplanation"; type: { kind: "enum"; variants: [ { name: "none"; }, { name: "transfer"; }, { name: "borrow"; }, { name: "repayBorrow"; } ]; }; }, { name: "depositDirection"; type: { kind: "enum"; variants: [ { name: "deposit"; }, { name: "withdraw"; } ]; }; }, { name: "orderAction"; type: { kind: "enum"; variants: [ { name: "place"; }, { name: "cancel"; }, { name: "fill"; }, { name: "trigger"; }, { name: "expire"; } ]; }; }, { name: "orderActionExplanation"; type: { kind: "enum"; variants: [ { name: "none"; }, { name: "insufficientFreeCollateral"; }, { name: "oraclePriceBreachedLimitPrice"; }, { name: "marketOrderFilledToLimitPrice"; }, { name: "orderExpired"; }, { name: "liquidation"; }, { name: "orderFilledWithAmm"; }, { name: "orderFilledWithAmmJit"; }, { name: "orderFilledWithMatch"; }, { name: "orderFilledWithMatchJit"; }, { name: "marketExpired"; }, { name: "riskingIncreasingOrder"; }, { name: "reduceOnlyOrderIncreasedPosition"; }, { name: "orderFillWithSerum"; }, { name: "noBorrowLiquidity"; }, { name: "orderFillWithPhoenix"; }, { name: "orderFilledWithAmmJitLpSplit"; }, { name: "orderFilledWithLpJit"; }, { name: "deriskLp"; }, { name: "orderFilledWithOpenbookV2"; }, { name: "transferPerpPosition"; } ]; }; }, { name: "lpAction"; type: { kind: "enum"; variants: [ { name: "addLiquidity"; }, { name: "removeLiquidity"; }, { name: "settleLiquidity"; }, { name: "removeLiquidityDerisk"; } ]; }; }, { name: "liquidationType"; type: { kind: "enum"; variants: [ { name: "liquidatePerp"; }, { name: "liquidateSpot"; }, { name: "liquidateBorrowForPerpPnl"; }, { name: "liquidatePerpPnlForDeposit"; }, { name: "perpBankruptcy"; }, { name: "spotBankruptcy"; } ]; }; }, { name: "settlePnlExplanation"; type: { kind: "enum"; variants: [ { name: "none"; }, { name: "expiredPosition"; } ]; }; }, { name: "stakeAction"; type: { kind: "enum"; variants: [ { name: "stake"; }, { name: "unstakeRequest"; }, { name: "unstakeCancelRequest"; }, { name: "unstake"; }, { name: "unstakeTransfer"; }, { name: "stakeTransfer"; } ]; }; }, { name: "fillMode"; type: { kind: "enum"; variants: [ { name: "fill"; }, { name: "placeAndMake"; }, { name: "placeAndTake"; fields: ["bool", "u8"]; }, { name: "liquidation"; } ]; }; }, { name: "perpFulfillmentMethod"; type: { kind: "enum"; variants: [ { name: "amm"; fields: [ { option: "u64"; } ]; }, { name: "match"; fields: ["pubkey", "u16", "u64"]; } ]; }; }, { name: "spotFulfillmentMethod"; type: { kind: "enum"; variants: [ { name: "externalMarket"; }, { name: "match"; fields: ["pubkey", "u16"]; } ]; }; }, { name: "marginCalculationMode"; type: { kind: "enum"; variants: [ { name: "standard"; fields: [ { name: "trackOpenOrdersFraction"; type: "bool"; } ]; }, { name: "liquidation"; fields: [ { name: "marketToTrackMarginRequirement"; type: { option: { defined: { name: "marketIdentifier"; }; }; }; } ]; } ]; }; }, { name: "oracleSource"; type: { kind: "enum"; variants: [ { name: "pyth"; }, { name: "switchboard"; }, { name: "quoteAsset"; }, { name: "pyth1K"; }, { name: "pyth1M"; }, { name: "pythStableCoin"; }, { name: "prelaunch"; }, { name: "pythPull"; }, { name: "pyth1KPull"; }, { name: "pyth1MPull"; }, { name: "pythStableCoinPull"; }, { name: "switchboardOnDemand"; }, { name: "pythLazer"; }, { name: "pythLazer1K"; }, { name: "pythLazer1M"; }, { name: "pythLazerStableCoin"; } ]; }; }, { name: "postOnlyParam"; type: { kind: "enum"; variants: [ { name: "none"; }, { name: "mustPostOnly"; }, { name: "tryPostOnly"; }, { name: "slide"; } ]; }; }, { name: "modifyOrderPolicy"; type: { kind: "enum"; variants: [ { name: "mustModify"; }, { name: "excludePreviousFill"; } ]; }; }, { name: "placeAndTakeOrderSuccessCondition"; type: { kind: "enum"; variants: [ { name: "partialFill"; }, { name: "fullFill"; } ]; }; }, { name: "perpOperation"; type: { kind: "enum"; variants: [ { name: "updateFunding"; }, { name: "ammFill"; }, { name: "fill"; }, { name: "settlePnl"; }, { name: "settlePnlWithPosition"; }, { name: "liquidation"; }, { name: "ammImmediateFill"; } ]; }; }, { name: "spotOperation"; type: { kind: "enum"; variants: [ { name: "updateCumulativeInterest"; }, { name: "fill"; }, { name: "deposit"; }, { name: "withdraw"; }, { name: "liquidation"; } ]; }; }, { name: "insuranceFundOperation"; type: { kind: "enum"; variants: [ { name: "init"; }, { name: "add"; }, { name: "requestRemove"; }, { name: "remove"; } ]; }; }, { name: "marketStatus"; type: { kind: "enum"; variants: [ { name: "initialized"; }, { name: "active"; }, { name: "fundingPaused"; }, { name: "ammPaused"; }, { name: "fillPaused"; }, { name: "withdrawPaused"; }, { name: "reduceOnly"; }, { name: "settlement"; }, { name: "delisted"; } ]; }; }, { name: "contractType"; type: { kind: "enum"; variants: [ { name: "perpetual"; }, { name: "future"; }, { name: "prediction"; } ]; }; }, { name: "contractTier"; type: { kind: "enum"; variants: [ { name: "a"; }, { name: "b"; }, { name: "c"; }, { name: "speculative"; }, { name: "highlySpeculative"; }, { name: "isolated"; } ]; }; }, { name: "ammLiquiditySplit"; type: { kind: "enum"; variants: [ { name: "protocolOwned"; }, { name: "lpOwned"; }, { name: "shared"; } ]; }; }, { name: "ammAvailability"; type: { kind: "enum"; variants: [ { name: "immediate"; }, { name: "afterMinDuration"; }, { name: "unavailable"; } ]; }; }, { name: "settlePnlMode"; type: { kind: "enum"; variants: [ { name: "mustSettle"; }, { name: "trySettle"; } ]; }; }, { name: "spotBalanceType"; type: { kind: "enum"; variants: [ { name: "deposit"; }, { name: "borrow"; } ]; }; }, { name: "spotFulfillmentConfigStatus"; type: { kind: "enum"; variants: [ { name: "enabled"; }, { name: "disabled"; } ]; }; }, { name: "assetTier"; type: { kind: "enum"; variants: [ { name: "collateral"; }, { name: "protected"; }, { name: "cross"; }, { name: "isolated"; }, { name: "unlisted"; } ]; }; }, { name: "exchangeStatus"; type: { kind: "enum"; variants: [ { name: "depositPaused"; }, { name: "withdrawPaused"; }, { name: "ammPaused"; }, { name: "fillPaused"; }, { name: "liqPaused"; }, { name: "fundingPaused"; }, { name: "settlePnlPaused"; }, { name: "ammImmediateFillPaused"; } ]; }; }, { name: "userStatus"; type: { kind: "enum"; variants: [ { name: "beingLiquidated"; }, { name: "bankrupt"; }, { name: "reduceOnly"; }, { name: "advancedLp"; }, { name: "protectedMakerOrders"; } ]; }; }, { name: "assetType"; type: { kind: "enum"; variants: [ { name: "base"; }, { name: "quote"; } ]; }; }, { name: "orderStatus"; type: { kind: "enum"; variants: [ { name: "init"; }, { name: "open"; }, { name: "filled"; }, { name: "canceled"; } ]; }; }, { name: "orderType"; type: { kind: "enum"; variants: [ { name: "market"; }, { name: "limit"; }, { name: "triggerMarket"; }, { name: "triggerLimit"; }, { name: "oracle"; } ]; }; }, { name: "orderTriggerCondition"; type: { kind: "enum"; variants: [ { name: "above"; }, { name: "below"; }, { name: "triggeredAbove"; }, { name: "triggeredBelow"; } ]; }; }, { name: "marketType"; type: { kind: "enum"; variants: [ { name: "spot"; }, { name: "perp"; } ]; }; }, { name: "referrerStatus"; type: { kind: "enum"; variants: [ { name: "isReferrer"; }, { name: "isReferred"; } ]; }; }, { name: "marginMode"; type: { kind: "enum"; variants: [ { name: "default"; }, { name: "highLeverage"; } ]; }; }, { name: "fuelOverflowStatus"; type: { kind: "enum"; variants: [ { name: "exists"; } ]; }; }, { name: "signatureVerificationError"; type: { kind: "enum"; variants: [ { name: "invalidEd25519InstructionProgramId"; }, { name: "invalidEd25519InstructionDataLength"; }, { name: "invalidSignatureIndex"; }, { name: "invalidSignatureOffset"; }, { name: "invalidPublicKeyOffset"; }, { name: "invalidMessageOffset"; }, { name: "invalidMessageDataSize"; }, { name: "invalidInstructionIndex"; }, { name: "messageOffsetOverflow"; }, { name: "invalidMessageHex"; }, { name: "invalidMessageData"; }, { name: "loadInstructionAtFailed"; } ]; }; }, { name: "openbookV2FulfillmentConfig"; type: { kind: "struct"; fields: [ { name: "pubkey"; type: "pubkey"; }, { name: "openbookV2ProgramId"; type: "pubkey"; }, { name: "openbookV2Market"; type: "pubkey"; }, { name: "openbookV2MarketAuthority"; type: "pubkey"; }, { name: "openbookV2EventHeap"; type: "pubkey"; }, { name: "openbookV2Bids"; type: "pubkey"; }, { name: "openbookV2Asks"; type: "pubkey"; }, { name: "openbookV2BaseVault"; type: "pubkey"; }, { name: "openbookV2QuoteVault"; type: "pubkey"; }, { name: "marketIndex"; type: "u16"; }, { name: "fulfillmentType"; type: { defined: { name: "spotFulfillmentType"; }; }; }, { name: "status"; type: { defined: { name: "spotFulfillmentConfigStatus"; }; }; }, { name: "padding"; type: { array: ["u8", 4]; }; } ]; }; }, { name: "phoenixV1FulfillmentConfig"; type: { kind: "struct"; fields: [ { name: "pubkey"; type: "pubkey"; }, { name: "phoenixProgramId"; type: "pubkey"; }, { name: "phoenixLogAuthority"; type: "pubkey"; }, { name: "phoenixMarket"; type: "pubkey"; }, { name: "phoenixBaseVault"; type: "pubkey"; }, { name: "phoenixQuoteVault"; type: "pubkey"; }, { name: "marketIndex"; type: "u16"; }, { name: "fulfillmentType"; type: { defined: { name: "spotFulfillmentType"; }; }; }, { name: "status"; type: { defined: { name: "spotFulfillmentConfigStatus"; }; }; }, { name: "padding"; type: { array: ["u8", 4]; }; } ]; }; }, { name: "serumV3FulfillmentConfig"; type: { kind: "struct"; fields: [ { name: "pubkey"; type: "pubkey"; }, { name: "serumProgramId"; type: "pubkey"; }, { name: "serumMarket"; type: "pubkey"; }, { name: "serumRequestQueue"; type: "pubkey"; }, { name: "serumEventQueue"; type: "pubkey"; }, { name: "serumBids"; type: "pubkey"; }, { name: "serumAsks"; type: "pubkey"; }, { name: "serumBaseVault"; type: "pubkey"; }, { name: "serumQuoteVault"; type: "pubkey"; }, { name: "serumOpenOrders"; type: "pubkey"; }, { name: "serumSignerNonce"; type: "u64"; }, { name: "marketIndex"; type: "u16"; }, { name: "fulfillmentType"; type: { defined: { name: "spotFulfillmentType"; }; }; }, { name: "status"; type: { defined: { name: "spotFulfillmentConfigStatus"; }; }; }, { name: "padding"; type: { array: ["u8", 4]; }; } ]; }; }, { name: "highLeverageModeConfig"; type: { kind: "struct"; fields: [ { name: "maxUsers"; type: "u32"; }, { name: "currentUsers"; type: "u32"; }, { name: "reduceOnly"; type: "u8"; }, { name: "padding"; type: { array: ["u8", 31]; }; } ]; }; }, { name: "insuranceFundStake"; type: { kind: "struct"; fields: [ { name: "authority"; type: "pubkey"; }, { name: "ifShares"; type: "u128"; }, { name: "lastWithdrawRequestShares"; type: "u128"; }, { name: "ifBase"; type: "u128"; }, { name: "lastValidTs"; type: "i64"; }, { name: "lastWithdrawRequestValue"; type: "u64"; }, { name: "lastWithdrawRequestTs"; type: "i64"; }, { name: "costBasis"; type: "i64"; }, { name: "marketIndex"; type: "u16"; }, { name: "padding"; type: { array: ["u8", 14]; }; } ]; }; }, { name: "protocolIfSharesTransferConfig"; type: { kind: "struct"; fields: [ { name: "whitelistedSigners"; type: { array: ["pubkey", 4]; }; }, { name: "maxTransferPerEpoch"; type: "u128"; }, { name: "currentEpochTransfer"; type: "u128"; }, { name: "nextEpochTs"; type: "i64"; }, { name: "padding"; type: { array: ["u128", 8]; }; } ]; }; }, { name: "prelaunchOracle"; type: { kind: "struct"; fields: [ { name: "price"; type: "i64"; }, { name: "maxPrice"; type: "i64"; }, { name: "confidence"; type: "u64"; }, { name: "lastUpdateSlot"; type: "u64"; }, { name: "ammLastUpdateSlot"; type: "u64"; }, { name: "perpMarketIndex"; type: "u16"; }, { name: "padding"; type: { array: ["u8", 70]; }; } ]; }; }, { name: "perpMarket"; type: { kind: "struct"; fields: [ { name: "pubkey"; docs: [ "The perp market's address. It is a pda of the market index" ]; type: "pubkey"; }, { name: "amm"; docs: ["The automated market maker"]; type: { defined: { name: "amm"; }; }; }, { name: "pnlPool"; docs: [ "The market's pnl pool. When users settle negative pnl, the balance increases.", "When users settle positive pnl, the balance decreases. Can not go negative." ]; type: { defined: { name: "poolBalance"; }; }; }, { name: "name"; docs: ["Encoded display name for the perp market e.g. SOL-PERP"]; type: { array: ["u8", 32]; }; }, { name: "insuranceClaim"; docs: ["The perp market's claim on the insurance fund"]; type: { defined: { name: "insuranceClaim"; }; }; }, { name: "unrealizedPnlMaxImbalance"; docs: [ "The max pnl imbalance before positive pnl asset weight is discounted", "pnl imbalance is the difference between long and short pnl. When it's greater than 0,", "the amm has negative pnl and the initial asset weight for positive pnl is discounted", "precision = QUOTE_PRECISION" ]; type: "u64"; }, { name: "expiryTs"; docs: [ "The ts when the market will be expired. Only set if market is in reduce only mode" ]; type: "i64"; }, { name: "expiryPrice"; docs: [ "The price at which positions will be settled. Only set if market is expired", "precision = PRICE_PRECISION" ]; type: "i64"; }, { name: "nextFillRecordId"; docs: [ "Every trade has a fill record id. This is the next id to be used" ]; type: "u64"; }, { name: "nextFundingRateRecordId"; docs: [ "Every funding rate update has a record id. This is the next id to be used" ]; type: "u64"; }, { name: "nextCurveRecordId"; docs: [ "Every amm k updated has a record id. This is the next id to be used" ]; type: "u64"; }, { name: "imfFactor"; docs: [ "The initial margin fraction factor. Used to increase margin ratio for large positions", "precision: MARGIN_PRECISION" ]; type: "u32"; }, { name: "unrealizedPnlImfFactor"; docs: [ "The imf factor for unrealized pnl. Used to discount asset weight for large positive pnl", "precision: MARGIN_PRECISION" ]; type: "u32"; }, { name: "liquidatorFee"; docs: [ "The fee the liquidator is paid for taking over perp position", "precision: LIQUIDATOR_FEE_PRECISION" ]; type: "u32"; }, { name: "ifLiquidationFee"; docs: [ "The fee the insurance fund receives from liquidation", "precision: LIQUIDATOR_FEE_PRECISION" ]; type: "u32"; }, { name: "marginRatioInitial"; docs: [ "The margin ratio which determines how much collateral is required to open a position", "e.g. margin ratio of .1 means a user must have $100 of total collateral to open a $1000 position", "precision: MARGIN_PRECISION" ]; type: "u32"; }, { name: "marginRatioMaintenance"; docs: [ "The margin ratio which determines when a user will be liquidated", "e.g. margin ratio of .05 means a user must have $50 of total collateral to maintain a $1000 position", "else they will be liquidated", "precision: MARGIN_PRECISION" ]; type: "u32"; }, { name: "unrealizedPnlInitialAssetWeight"; docs: [ "The initial asset weight for positive pnl. Negative pnl always has an asset weight of 1", "precision: SPOT_WEIGHT_PRECISION" ]; type: "u32"; }, { name: "unrealizedPnlMaintenanceAssetWeight"; docs: [ "The maintenance asset weight for positive pnl. Negative pnl always has an asset weight of 1", "precision: SPOT_WEIGHT_PRECISION" ]; type: "u32"; }, { name: "numberOfUsersWithBase"; docs: ["number of users in a position (base)"]; type: "u32"; }, { name: "numberOfUsers"; docs: ["number of users in a position (pnl) or pnl (quote)"]; type: "u32"; }, { name: "marketIndex"; type: "u16"; }, { name: "status"; docs: [ "Whether a market is active, reduce only, expired, etc", "Affects whether users can open/close positions" ]; type: { defined: { name: "marketStatus"; }; }; }, { name: "contractType"; docs: ["Currently only Perpetual markets are supported"]; type: { defined: { name: "contractType"; }; }; }, { name: "contractTier"; docs: [ "The contract tier determines how much insurance a market can receive, with more speculative markets receiving less insurance", "It also influences the order perp markets can be liquidated, with less speculative markets being liquidated first" ]; type: { defined: { name: "contractTier"; }; }; }, { name: "pausedOperations"; type: "u8"; }, { name: "quoteSpotMarketIndex"; docs: ["The spot market that pnl is settled in"]; type: "u16"; }, { name: "feeAdjustment"; docs: [ "Between -100 and 100, represents what % to increase/decrease the fee by", "E.g. if this is -50 and the fee is 5bps, the new fee will be 2.5bps", "if this is 50 and the fee is 5bps, the new fee will be 7.5bps" ]; type: "i16"; }, { name: "fuelBoostPosition"; docs: ["fuel multiplier for perp funding", "precision: 10"]; type: "u8"; }, { name: "fuelBoostTaker"; docs: ["fuel multiplier for perp taker", "precision: 10"]; type: "u8"; }, { name: "fuelBoostMaker"; docs: ["fuel multiplier for perp maker", "precision: 10"]; type: "u8"; }, { name: "poolId"; type: "u8"; }, { name: "highLeverageMarginRatioInitial"; type: "u16"; }, { name: "highLeverageMarginRatioMaintenance"; type: "u16"; }, { name: "padding"; type: { array: ["u8", 38]; }; } ]; }; }, { name: "protectedMakerModeConfig"; type: { kind: "struct"; fields: [ { name: "maxUsers"; type: "u32"; }, { name: "currentUsers"; type: "u32"; }, { name: "reduceOnly"; type: "u8"; }, { name: "padding"; type: { array: ["u8", 31]; }; } ]; }; }, { name: "pythLazerOracle"; type: { kind: "struct"; fields: [ { name: "price"; type: "i64"; }, { name: "publishTime"; type: "u64"; }, { name: "postedSlot"; type: "u64"; }, { name: "exponent"; type: "i32"; }, { name: "padding"; type: { array: ["u8", 4]; }; }, { name: "conf"; type: "u64"; } ]; }; }, { name: "signedMsgUserOrders"; docs: [ "* This struct is a duplicate of SignedMsgUserOrdersZeroCopy\n * It is used to give anchor an struct to generate the idl for clients\n * The struct SignedMsgUserOrdersZeroCopy is used to load the data in efficiently" ]; type: { kind: "struct"; fields: [ { name: "authorityPubkey"; type: "pubkey"; }, { name: "padding"; type: "u32"; }, { name: "signedMsgOrderData"; type: { vec: { defined: { name: "signedMsgOrderId"; }; }; }; } ]; }; }, { name: "signedMsgWsDelegates"; docs: [ "* Used to store authenticated delegates for swift-like ws connections" ]; type: { kind: "struct"; fields: [ { name: "delegates"; type: { vec: "pubkey"; }; } ]; }; }, { name: "spotMarket"; type: { kind: "struct"; fields: [ { name: "pubkey"; docs: [ "The address of the spot market. It is a pda of the market index" ]; type: "pubkey"; }, { name: "oracle"; docs: ["The oracle used to price the markets deposits/borrows"]; type: "pubkey"; }, { name: "mint"; docs: ["The token mint of the market"]; type: "pubkey"; }, { name: "vault"; docs: [ "The vault used to store the market's deposits", "The amount in the vault should be equal to or greater than deposits - borrows" ]; type: "pubkey"; }, { name: "name"; docs: ["The encoded display name for the market e.g. SOL"]; type: { array: ["u8", 32]; }; }, { name: "historicalOracleData"; type: { defined: { name: "historicalOracleData"; }; }; }, { name: "historicalIndexData"; type: { defined: { name: "historicalIndexData"; }; }; }, { name: "revenuePool"; docs: [ "Revenue the protocol has collected in this markets token", "e.g. for SOL-PERP, funds can be settled in usdc and will flow into the USDC revenue pool" ]; type: { defined: { name: "poolBalance"; }; }; }, { name: "spotFeePool"; docs: [ "The fees collected from swaps between this market and the quote market", "Is settled to the quote markets revenue pool" ]; type: { defined: { name: "poolBalance"; }; }; }, { name: "insuranceFund"; docs: [ "Details on the insurance fund covering bankruptcies in this markets token", "Covers bankruptcies for borrows with this markets token and perps settling in this markets token" ]; type: { defined: { name: "insuranceFund"; }; }; }, { name: "totalSpotFee"; docs: [ "The total spot fees collected for this market", "precision: QUOTE_PRECISION" ]; type: "u128"; }, { name: "depositBalance"; docs: [ "The sum of the scaled balances for deposits across users and pool balances", "To convert to the deposit token amount, multiply by the cumulative deposit interest", "precision: SPOT_BALANCE_PRECISION" ]; type: "u128"; }, { name: "borrowBalance"; docs: [ "The sum of the scaled balances for borrows across users and pool balances", "To convert to the borrow token amount, multiply by the cumulative borrow interest", "precision: SPOT_BALANCE_PRECISION" ]; type: "u128"; }, { name: "cumulativeDepositInterest"; docs: [ "The cumulative interest earned by depositors", "Used to calculate the deposit token amount from the deposit balance", "precision: SPOT_CUMULATIVE_INTEREST_PRECISION" ]; type: "u128"; }, { name: "cumulativeBorrowInterest"; docs: [ "The cumulative interest earned by borrowers", "Used to calculate the borrow token amount from the borrow balance", "precision: SPOT_CUMULATIVE_INTEREST_PRECISION" ]; type: "u128"; }, { name: "totalSocialLoss"; docs: [ "The total socialized loss from borrows, in the mint's token", "precision: token mint precision" ]; type: "u128"; }, { name: "totalQuoteSocialLoss"; docs: [ "The total socialized loss from borrows, in the quote market's token", "preicision: QUOTE_PRECISION" ]; type: "u128"; }, { name: "withdrawGuardThreshold"; docs: [ "no withdraw limits/guards when deposits below this threshold", "precision: token mint precision" ]; type: "u64"; }, { name: "maxTokenDeposits"; docs: [ "The max amount of token deposits in this market", "0 if there is no limit", "precision: token mint precision" ]; type: "u64"; }, { name: "depositTokenTwap"; docs: [ "24hr average of deposit token amount", "precision: token mint precision" ]; type: "u64"; }, { name: "borrowTokenTwap"; docs: [ "24hr average of borrow token amount", "precision: token mint precision" ]; type: "u64"; }, { name: "utilizationTwap"; docs: [ "24hr average of utilization", "which is borrow amount over token amount", "precision: SPOT_UTILIZATION_PRECISION" ]; type: "u64"; }, { name: "lastInterestTs"; docs: [ "Last time the cumulative deposit and borrow interest was updated" ]; type: "u64"; }, { name: "lastTwapTs"; docs: [ "Last time the deposit/borrow/utilization averages were updated" ]; type: "u64"; }, { name: "expiryTs"; docs: [ "The time the market is set to expire. Only set if market is in reduce only mode" ]; type: "i64"; }, { name: "orderStepSize"; docs: [ "Spot orders must be a multiple of the step size", "precision: token mint precision" ]; type: "u64"; }, { name: "orderTickSize"; docs: [ "Spot orders must be a multiple of the tick size", "precision: PRICE_PRECISION" ]; type: "u64"; }, { name: "minOrderSize"; docs: ["The minimum order size", "precision: token mint precision"]; type: "u64"; }, { name: "maxPositionSize"; docs: [ "The maximum spot position size", "if the limit is 0, there is no limit", "precision: token mint precision" ]; type: "u64"; }, { name: "nextFillRecordId"; docs: [ "Every spot trade has a fill record id. This is the next id to use" ]; type: "u64"; }, { name: "nextDepositRecordId"; docs: [ "Every deposit has a deposit record id. This is the next id to use" ]; type: "u64"; }, { name: "initialAssetWeight"; docs: [ "The initial asset weight used to calculate a deposits contribution to a users initial total collateral", "e.g. if the asset weight is .8, $100 of deposits contributes $80 to the users initial total collateral", "precision: SPOT_WEIGHT_PRECISION" ]; type: "u32"; }, { name: "maintenanceAssetWeight"; docs: [ "The maintenance asset weight used to calculate a deposits contribution to a users maintenance total collateral", "e.g. if the asset weight is .9, $100 of deposits contributes $90 to the users maintenance total collateral", "precision: SPOT_WEIGHT_PRECISION" ]; type: "u32"; }, { name: "initialLiabilityWeight"; docs: [ "The initial liability weight used to calculate a borrows contribution to a users initial margin requirement", "e.g. if the liability weight is .9, $100 of borrows contributes $90 to the users initial margin requirement", "precision: SPOT_WEIGHT_PRECISION" ]; type: "u32"; }, { name: "maintenanceLiabilityWeight"; docs: [ "The maintenance liability weight used to calculate a borrows contribution to a users maintenance margin requirement", "e.g. if the liability weight is .8, $100 of borrows contributes $80 to the users maintenance margin requirement", "precision: SPOT_WEIGHT_PRECISION" ]; type: "u32"; }, { name: "imfFactor"; docs: [ "The initial margin fraction factor. Used to increase liability weight/decrease asset weight for large positions", "precision: MARGIN_PRECISION" ]; type: "u32"; }, { name: "liquidatorFee"; docs: [ "The fee the liquidator is paid for taking over borrow/deposit", "precision: LIQUIDATOR_FEE_PRECISION" ]; type: "u32"; }, { name: "ifLiquidationFee"; docs: [ "The fee the insurance fund receives from liquidation", "precision: LIQUIDATOR_FEE_PRECISION" ]; type: "u32"; }, { name: "optimalUtilization"; docs: [ "The optimal utilization rate for this market.", "Used to determine the markets borrow rate", "precision: SPOT_UTILIZATION_PRECISION" ]; type: "u32"; }, { name: "optimalBorrowRate"; docs: [ "The borrow rate for this market when the market has optimal utilization", "precision: SPOT_RATE_PRECISION" ]; type: "u32"; }, { name: "maxBorrowRate"; docs: [ "The borrow rate for this market when the market has 1000 utilization", "precision: SPOT_RATE_PRECISION" ]; type: "u32"; }, { name: "decimals"; docs: [ "The market's token mint's decimals. To from decimals to a precision, 10^decimals" ]; type: "u32"; }, { name: "marketIndex"; type: "u16"; }, { name: "ordersEnabled"; docs: ["Whether or not spot trading is enabled"]; type: "bool"; }, { name: "oracleSource"; type: { defined: { name: "oracleSource"; }; }; }, { name: "status"; type: { defined: { name: "marketStatus"; }; }; }, { name: "assetTier"; docs: [ "The asset tier affects how a deposit can be used as collateral and the priority for a borrow being liquidated" ]; type: { defined: { name: "assetTier"; }; }; }, { name: "pausedOperations"; type: "u8"; }, { name: "ifPausedOperations"; type: "u8"; }, { name: "feeAdjustment"; type: "i16"; }, { name: "maxTokenBorrowsFraction"; docs: [ "What fraction of max_token_deposits", "disabled when 0, 1 => 1/10000 => .01% of max_token_deposits", "precision: X/10000" ]; type: "u16"; }, { name: "flashLoanAmount"; docs: [ "For swaps, the amount of token loaned out in the begin_swap ix", "precision: token mint precision" ]; type: "u64"; }, { name: "flashLoanInitialTokenAmount"; docs: [ "For swaps, the amount in the users token account in the begin_swap ix", "Used to calculate how much of the token left the system in end_swap ix", "precision: token mint precision" ]; type: "u64"; }, { name: "totalSwapFee"; docs: [ "The total fees received from swaps", "precision: token mint precision" ]; type: "u64"; }, { name: "scaleInitialAssetWeightStart"; docs: [ "When to begin scaling down the initial asset weight", "disabled when 0", "precision: QUOTE_PRECISION" ]; type: "u64"; }, { name: "minBorrowRate"; docs: [ "The min borrow rate for this market when the market regardless of utilization", "1 => 1/200 => .5%", "precision: X/200" ]; type: "u8"; }, { name: "fuelBoostDeposits"; docs: ["fuel multiplier for spot deposits", "precision: 10"]; type: "u8"; }, { name: "fuelBoostBorrows"; docs: ["fuel multiplier for spot borrows", "precision: 10"]; type: "u8"; }, { name: "fuelBoostTaker"; docs: ["fuel multiplier for spot taker", "precision: 10"]; type: "u8"; }, { name: "fuelBoostMaker"; docs: ["fuel multiplier for spot maker", "precision: 10"]; type: "u8"; }, { name: "fuelBoostInsurance"; docs: ["fuel multiplier for spot insurance stake", "precision: 10"]; type: "u8"; }, { name: "tokenProgram"; type: "u8"; }, { name: "poolId"; type: "u8"; }, { name: "padding"; type: { array: ["u8", 40]; }; } ]; }; }, { name: "state"; type: { kind: "struct"; fields: [ { name: "admin"; type: "pubkey"; }, { name: "whitelistMint"; type: "pubkey"; }, { name: "discountMint"; type: "pubkey"; }, { name: "signer"; type: "pubkey"; }, { name: "srmVault"; type: "pubkey"; }, { name: "perpFeeStructure"; type: { defined: { name: "feeStructure"; }; }; }, { name: "spotFeeStructure"; type: { defined: { name: "feeStructure"; }; }; }, { name: "oracleGuardRails"; type: { defined: { name: "oracleGuardRails"; }; }; }, { name: "numberOfAuthorities"; type: "u64"; }, { name: "numberOfSubAccounts"; type: "u64"; }, { name: "lpCooldownTime"; type: "u64"; }, { name: "liquidationMarginBufferRatio"; type: "u32"; }, { name: "settlementDuration"; type: "u16"; }, { name: "numberOfMarkets"; type: "u16"; }, { name: "numberOfSpotMarkets"; type: "u16"; }, { name: "signerNonce"; type: "u8"; }, { name: "minPerpAuctionDuration"; type: "u8"; }, { name: "defaultMarketOrderTimeInForce"; type: "u8"; }, { name: "defaultSpotAuctionDuration"; type: "u8"; }, { name: "exchangeStatus"; type: "u8"; }, { name: "liquidationDuration"; type: "u8"; }, { name: "initialPctToLiquidate"; type: "u16"; }, { name: "maxNumberOfSubAccounts"; type: "u16"; }, { name: "maxInitializeUserFee"; type: "u16"; }, { name: "padding"; type: { array: ["u8", 10]; }; } ]; }; }, { name: "user"; type: { kind: "struct"; fields: [ { name: "authority"; docs: ["The owner/authority of the account"]; type: "pubkey"; }, { name: "delegate"; docs: [ "An addresses that can control the account on the authority's behalf. Has limited power, cant withdraw" ]; type: "pubkey"; }, { name: "name"; docs: ['Encoded display name e.g. "toly"']; type: { array: ["u8", 32]; }; }, { name: "spotPositions"; docs: ["The user's spot positions"]; type: { array: [ { defined: { name: "spotPosition"; }; }, 8 ]; }; }, { name: "perpPositions"; docs: ["The user's perp positions"]; type: { array: [ { defined: { name: "perpPosition"; }; }, 8 ]; }; }, { name: "orders"; docs: ["The user's orders"]; type: { array: [ { defined: { name: "order"; }; }, 32 ]; }; }, { name: "lastAddPerpLpSharesTs"; docs: ["The last time the user added perp lp positions"]; type: "i64"; }, { name: "totalDeposits"; docs: [ "The total values of deposits the user has made", "precision: QUOTE_PRECISION" ]; type: "u64"; }, { name: "totalWithdraws"; docs: [ "The total values of withdrawals the user has made", "precision: QUOTE_PRECISION" ]; type: "u64"; }, { name: "totalSocialLoss"; docs: [ "The total socialized loss the users has incurred upon the protocol", "precision: QUOTE_PRECISION" ]; type: "u64"; }, { name: "settledPerpPnl"; docs: [ "Fees (taker fees, maker rebate, referrer reward, filler reward) and pnl for perps", "precision: QUOTE_PRECISION" ]; type: "i64"; }, { name: "cumulativeSpotFees"; docs: [ "Fees (taker fees, maker rebate, filler reward) for spot", "precision: QUOTE_PRECISION" ]; type: "i64"; }, { name: "cumulativePerpFunding"; docs: [ "Cumulative funding paid/received for perps", "precision: QUOTE_PRECISION" ]; type: "i64"; }, { name: "liquidationMarginFreed"; docs: [ "The amount of margin freed during liquidation. Used to force the liquidation to occur over a period of time", "Defaults to zero when not being liquidated", "precision: QUOTE_PRECISION" ]; type: "u64"; }, { name: "lastActiveSlot"; docs: [ "The last slot a user was active. Used to determine if a user is idle" ]; type: "u64"; }, { name: "nextOrderId"; docs: [ "Every user order has an order id. This is the next order id to be used" ]; type: "u32"; }, { name: "maxMarginRatio"; docs: ["Custom max initial margin ratio for the user"]; type: "u32"; }, { name: "nextLiquidationId"; docs: ["The next liquidation id to be used for user"]; type: "u16"; }, { name: "subAccountId"; docs: ["The sub account id for this user"]; type: "u16"; }, { name: "status"; docs: ["Whether the user is active, being liquidated or bankrupt"]; type: "u8"; }, { name: "isMarginTradingEnabled"; docs: ["Whether the user has enabled margin trading"]; type: "bool"; }, { name: "idle"; docs: [ "User is idle if they haven't interacted with the protocol in 1 week and they have no orders, perp positions or borrows", "Off-chain keeper bots can ignore users that are idle" ]; type: "bool"; }, { name: "openOrders"; docs: ["number of open orders"]; type: "u8"; }, { name: "hasOpenOrder"; docs: ["Whether or not user has open order"]; type: "bool"; }, { name: "openAuctions"; docs: ["number of open orders with auction"]; type: "u8"; }, { name: "hasOpenAuction"; docs: ["Whether or not user has open order with auction"]; type: "bool"; }, { name: "marginMode"; type: { defined: { name: "marginMode"; }; }; }, { name: "poolId"; type: "u8"; }, { name: "padding1"; type: { array: ["u8", 3]; }; }, { name: "lastFuelBonusUpdateTs"; type: "u32"; }, { name: "padding"; type: { array: ["u8", 12]; }; } ]; }; }, { name: "userStats"; type: { kind: "struct"; fields: [ { name: "authority"; docs: ["The authority for all of a users sub accounts"]; type: "pubkey"; }, { name: "referrer"; docs: ["The address that referred this user"]; type: "pubkey"; }, { name: "fees"; docs: ["Stats on the fees paid by the user"]; type: { defined: { name: "userFees"; }; }; }, { name: "nextEpochTs"; docs: [ "The timestamp of the next epoch", "Epoch is used to limit referrer rewards earned in single epoch" ]; type: "i64"; }, { name: "makerVolume30d"; docs: [ "Rolling 30day maker volume for user", "precision: QUOTE_PRECISION" ]; type: "u64"; }, { name: "takerVolume30d"; docs: [ "Rolling 30day taker volume for user", "precision: QUOTE_PRECISION" ]; type: "u64"; }, { name: "fillerVolume30d"; docs: [ "Rolling 30day filler volume for user", "precision: QUOTE_PRECISION" ]; type: "u64"; }, { name: "lastMakerVolume30dTs"; docs: ["last time the maker volume was updated"]; type: "i64"; }, { name: "lastTakerVolume30dTs"; docs: ["last time the taker volume was updated"]; type: "i64"; }, { name: "lastFillerVolume30dTs"; docs: ["last time the filler volume was updated"]; type: "i64"; }, { name: "ifStakedQuoteAssetAmount"; docs: ["The amount of tokens staked in the quote spot markets if"]; type: "u64"; }, { name: "numberOfSubAccounts"; docs: ["The current number of sub accounts"]; type: "u16"; }, { name: "numberOfSubAccountsCreated"; docs: [ "The number of sub accounts created. Can be greater than the number of sub accounts if user", "has deleted sub accounts" ]; type: "u16"; }, { name: "referrerStatus"; docs: [ "Flags for referrer status:", "First bit (LSB): 1 if user is a referrer, 0 otherwise", "Second bit: 1 if user was referred, 0 otherwise" ]; type: "u8"; }, { name: "disableUpdatePerpBidAskTwap"; type: "bool"; }, { name: "padding1"; type: { array: ["u8", 1]; }; }, { name: "fuelOverflowStatus"; docs: ["whether the user has a FuelOverflow account"]; type: "u8"; }, { name: "fuelInsurance"; docs: ["accumulated fuel for token amounts of insurance"]; type: "u32"; }, { name: "fuelDeposits"; docs: ["accumulated fuel for notional of deposits"]; type: "u32"; }, { name: "fuelBorrows"; docs: ["accumulate fuel bonus for notional of borrows"]; type: "u32"; }, { name: "fuelPositions"; docs: ["accumulated fuel for perp open interest"]; type: "u32"; }, { name: "fuelTaker"; docs: ["accumulate fuel bonus for taker volume"]; type: "u32"; }, { name: "fuelMaker"; docs: ["accumulate fuel bonus for maker volume"]; type: "u32"; }, { name: "ifStakedGovTokenAmount"; docs: [ "The amount of tokens staked in the governance spot markets if" ]; type: "u64"; }, { name: "lastFuelIfBonusUpdateTs"; docs: [ "last unix ts user stats data was used to update if fuel (u32 to save space)" ]; type: "u32"; }, { name: "padding"; type: { array: ["u8", 12]; }; } ]; }; }, { name: "referrerName"; type: { kind: "struct"; fields: [ { name: "authority"; type: "pubkey"; }, { name: "user"; type: "pubkey"; }, { name: "userStats"; type: "pubkey"; }, { name: "name"; type: { array: ["u8", 32]; }; } ]; }; }, { name: "fuelOverflow"; type: { kind: "struct"; fields: [ { name: "authority"; docs: ["The authority of this overflow account"]; type: "pubkey"; }, { name: "fuelInsurance"; type: "u128"; }, { name: "fuelDeposits"; type: "u128"; }, { name: "fuelBorrows"; type: "u128"; }, { name: "fuelPositions"; type: "u128"; }, { name: "fuelTaker"; type: "u128"; }, { name: "fuelMaker"; type: "u128"; }, { name: "lastFuelSweepTs"; type: "u32"; }, { name: "lastResetTs"; type: "u32"; }, { name: "padding"; type: { array: ["u128", 6]; }; } ]; }; }, { name: "newUserRecord"; type: { kind: "struct"; fields: [ { name: "ts"; type: "i64"; }, { name: "userAuthority"; type: "pubkey"; }, { name: "user"; type: "pubkey"; }, { name: "subAccountId"; type: "u16"; }, { name: "name"; type: { array: ["u8", 32]; }; }, { name: "referrer"; type: "pubkey"; } ]; }; }, { name: "depositRecord"; type: { kind: "struct"; fields: [ { name: "ts"; type: "i64"; }, { name: "userAuthority"; type: "pubkey"; }, { name: "user"; type: "pubkey"; }, { name: "direction"; type: { defined: { name: "depositDirection"; }; }; }, { name: "depositRecordId"; type: "u64"; }, { name: "amount"; type: "u64"; }, { name: "marketIndex"; type: "u16"; }, { name: "oraclePrice"; type: "i64"; }, { name: "marketDepositBalance"; type: "u128"; }, { name: "marketWithdrawBalance"; type: "u128"; }, { name: "marketCumulativeDepositInterest"; type: "u128"; }, { name: "marketCumulativeBorrowInterest"; type: "u128"; }, { name: "totalDepositsAfter"; type: "u64"; }, { name: "totalWithdrawsAfter"; type: "u64"; }, { name: "explanation"; type: { defined: { name: "depositExplanation"; }; }; }, { name: "transferUser"; type: { option: "pubkey"; }; } ]; }; }, { name: "spotInterestRecord"; type: { kind: "struct"; fields: [ { name: "ts"; type: "i64"; }, { name: "marketIndex"; type: "u16"; }, { name: "depositBalance"; type: "u128"; }, { name: "cumulativeDepositInterest"; type: "u128"; }, { name: "borrowBalance"; type: "u128"; }, { name: "cumulativeBorrowInterest"; type: "u128"; }, { name: "optimalUtilization"; type: "u32"; }, { name: "optimalBorrowRate"; type: "u32"; }, { name: "maxBorrowRate"; type: "u32"; } ]; }; }, { name: "fundingPaymentRecord"; type: { kind: "struct"; fields: [ { name: "ts"; type: "i64"; }, { name: "userAuthority"; type: "pubkey"; }, { name: "user"; type: "pubkey"; }, { name: "marketIndex"; type: "u16"; }, { name: "fundingPayment"; type: "i64"; }, { name: "baseAssetAmount"; type: "i64"; }, { name: "userLastCumulativeFunding"; type: "i64"; }, { name: "ammCumulativeFundingLong"; type: "i128"; }, { name: "ammCumulativeFundingShort"; type: "i128"; } ]; }; }, { name: "fundingRateRecord"; type: { kind: "struct"; fields: [ { name: "ts"; type: "i64"; }, { name: "recordId"; type: "u64"; }, { name: "marketIndex"; type: "u16"; }, { name: "fundingRate"; type: "i64"; }, { name: "fundingRateLong"; type: "i128"; }, { name: "fundingRateShort"; type: "i128"; }, { name: "cumulativeFundingRateLong"; type: "i128"; }, { name: "cumulativeFundingRateShort"; type: "i128"; }, { name: "oraclePriceTwap"; type: "i64"; }, { name: "markPriceTwap"; type: "u64"; }, { name: "periodRevenue"; type: "i64"; }, { name: "baseAssetAmountWithAmm"; type: "i128"; }, { name: "baseAssetAmountWithUnsettledLp"; type: "i128"; } ]; }; }, { name: "curveRecord"; type: { kind: "struct"; fields: [ { name: "ts"; type: "i64"; }, { name: "recordId"; type: "u64"; }, { name: "pegMultiplierBefore"; type: "u128"; }, { name: "baseAssetReserveBefore"; type: "u128"; }, { name: "quoteAssetReserveBefore"; type: "u128"; }, { name: "sqrtKBefore"; type: "u128"; }, { name: "pegMultiplierAfter"; type: "u128"; }, { name: "baseAssetReserveAfter"; type: "u128"; }, { name: "quoteAssetReserveAfter"; type: "u128"; }, { name: "sqrtKAfter"; type: "u128"; }, { name: "baseAssetAmountLong"; type: "u128"; }, { name: "baseAssetAmountShort"; type: "u128"; }, { name: "baseAssetAmountWithAmm"; type: "i128"; }, { name: "totalFee"; type: "i128"; }, { name: "totalFeeMinusDistributions"; type: "i128"; }, { name: "adjustmentCost"; type: "i128"; }, { name: "oraclePrice"; type: "i64"; }, { name: "fillRecord"; type: "u128"; }, { name: "numberOfUsers"; type: "u32"; }, { name: "marketIndex"; type: "u16"; } ]; }; }, { name: "signedMsgOrderRecord"; type: { kind: "struct"; fields: [ { name: "user"; type: "pubkey"; }, { name: "hash"; type: "string"; }, { name: "matchingOrderParams"; type: { defined: { name: "orderParams"; }; }; }, { name: "userOrderId"; type: "u32"; }, { name: "signedMsgOrderMaxSlot"; type: "u64"; }, { name: "signedMsgOrderUuid"; type: { array: ["u8", 8]; }; }, { name: "ts"; type: "i64"; } ]; }; }, { name: "orderRecord"; type: { kind: "struct"; fields: [ { name: "ts"; type: "i64"; }, { name: "user"; type: "pubkey"; }, { name: "order"; type: { defined: { name: "order"; }; }; } ]; }; }, { name: "orderActionRecord"; type: { kind: "struct"; fields: [ { name: "ts"; type: "i64"; }, { name: "action"; type: { defined: { name: "orderAction"; }; }; }, { name: "actionExplanation"; type: { defined: { name: "orderActionExplanation"; }; }; }, { name: "marketIndex"; type: "u16"; }, { name: "marketType"; type: { defined: { name: "marketType"; }; }; }, { name: "filler"; type: { option: "pubkey"; }; }, { name: "fillerReward"; type: { option: "u64"; }; }, { name: "fillRecordId"; type: { option: "u64"; }; }, { name: "baseAssetAmountFilled"; type: { option: "u64"; }; }, { name: "quoteAssetAmountFilled"; type: { option: "u64"; }; }, { name: "takerFee"; type: { option: "u64"; }; }, { name: "makerFee"; type: { option: "i64"; }; }, { name: "referrerReward"; type: { option: "u32"; }; }, { name: "quoteAssetAmountSurplus"; type: { option: "i64"; }; }, { name: "spotFulfillmentMethodFee"; type: { option: "u64"; }; }, { name: "taker"; type: { option: "pubkey"; }; }, { name: "takerOrderId"; type: { option: "u32"; }; }, { name: "takerOrderDirection"; type: { option: { defined: { name: "positionDirection"; }; }; }; }, { name: "takerOrderBaseAssetAmount"; type: { option: "u64"; }; }, { name: "takerOrderCumulativeBaseAssetAmountFilled"; type: { option: "u64"; }; }, { name: "takerOrderCumulativeQuoteAssetAmountFilled"; type: { option: "u64"; }; }, { name: "maker"; type: { option: "pubkey"; }; }, { name: "makerOrderId"; type: { option: "u32"; }; }, { name: "makerOrderDirection"; type: { option: { defined: { name: "positionDirection"; }; }; }; }, { name: "makerOrderBaseAssetAmount"; type: { option: "u64"; }; }, { name: "makerOrderCumulativeBaseAssetAmountFilled"; type: { option: "u64"; }; }, { name: "makerOrderCumulativeQuoteAssetAmountFilled"; type: { option: "u64"; }; }, { name: "oraclePrice"; type: "i64"; } ]; }; }, { name: "lpRecord"; type: { kind: "struct"; fields: [ { name: "ts"; type: "i64"; }, { name: "user"; type: "pubkey"; }, { name: "action"; type: { defined: { name: "lpAction"; }; }; }, { name: "nShares"; type: "u64"; }, { name: "marketIndex"; type: "u16"; }, { name: "deltaBaseAssetAmount"; type: "i64"; }, { name: "deltaQuoteAssetAmount"; type: "i64"; }, { name: "pnl"; type: "i64"; } ]; }; }, { name: "liquidationRecord"; type: { kind: "struct"; fields: [ { name: "ts"; type: "i64"; }, { name: "liquidationType"; type: { defined: { name: "liquidationType"; }; }; }, { name: "user"; type: "pubkey"; }, { name: "liquidator"; type: "pubkey"; }, { name: "marginRequirement"; type: "u128"; }, { name: "totalCollateral"; type: "i128"; }, { name: "marginFreed"; type: "u64"; }, { name: "liquidationId"; type: "u16"; }, { name: "bankrupt"; type: "bool"; }, { name: "canceledOrderIds"; type: { vec: "u32"; }; }, { name: "liquidatePerp"; type: { defined: { name: "liquidatePerpRecord"; }; }; }, { name: "liquidateSpot"; type: { defined: { name: "liquidateSpotRecord"; }; }; }, { name: "liquidateBorrowForPerpPnl"; type: { defined: { name: "liquidateBorrowForPerpPnlRecord"; }; }; }, { name: "liquidatePerpPnlForDeposit"; type: { defined: { name: "liquidatePerpPnlForDepositRecord"; }; }; }, { name: "perpBankruptcy"; type: { defined: { name: "perpBankruptcyRecord"; }; }; }, { name: "spotBankruptcy"; type: { defined: { name: "spotBankruptcyRecord"; }; }; } ]; }; }, { name: "settlePnlRecord"; type: { kind: "struct"; fields: [ { name: "ts"; type: "i64"; }, { name: "user"; type: "pubkey"; }, { name: "marketIndex"; type: "u16"; }, { name: "pnl"; type: "i128"; }, { name: "baseAssetAmount"; type: "i64"; }, { name: "quoteAssetAmountAfter"; type: "i64"; }, { name: "quoteEntryAmount"; type: "i64"; }, { name: "settlePrice"; type: "i64"; }, { name: "explanation"; type: { defined: { name: "settlePnlExplanation"; }; }; } ]; }; }, { name: "insuranceFundRecord"; type: { kind: "struct"; fields: [ { name: "ts"; type: "i64"; }, { name: "spotMarketIndex"; type: "u16"; }, { name: "perpMarketIndex"; type: "u16"; }, { name: "userIfFactor"; type: "u32"; }, { name: "totalIfFactor"; type: "u32"; }, { name: "vaultAmountBefore"; type: "u64"; }, { name: "insuranceVaultAmountBefore"; type: "u64"; }, { name: "totalIfSharesBefore"; type: "u128"; }, { name: "totalIfSharesAfter"; type: "u128"; }, { name: "amount"; type: "i64"; } ]; }; }, { name: "insuranceFundStakeRecord"; type: { kind: "struct"; fields: [ { name: "ts"; type: "i64"; }, { name: "userAuthority"; type: "pubkey"; }, { name: "action"; type: { defined: { name: "stakeAction"; }; }; }, { name: "amount"; type: "u64"; }, { name: "marketIndex"; type: "u16"; }, { name: "insuranceVaultAmountBefore"; type: "u64"; }, { name: "ifSharesBefore"; type: "u128"; }, { name: "userIfSharesBefore"; type: "u128"; }, { name: "totalIfSharesBefore"; type: "u128"; }, { name: "ifSharesAfter"; type: "u128"; }, { name: "userIfSharesAfter"; type: "u128"; }, { name: "totalIfSharesAfter"; type: "u128"; } ]; }; }, { name: "swapRecord"; type: { kind: "struct"; fields: [ { name: "ts"; type: "i64"; }, { name: "user"; type: "pubkey"; }, { name: "amountOut"; type: "u64"; }, { name: "amountIn"; type: "u64"; }, { name: "outMarketIndex"; type: "u16"; }, { name: "inMarketIndex"; type: "u16"; }, { name: "outOraclePrice"; type: "i64"; }, { name: "inOraclePrice"; type: "i64"; }, { name: "fee"; type: "u64"; } ]; }; }, { name: "spotMarketVaultDepositRecord"; type: { kind: "struct"; fields: [ { name: "ts"; type: "i64"; }, { name: "marketIndex"; type: "u16"; }, { name: "depositBalance"; type: "u128"; }, { name: "cumulativeDepositInterestBefore"; type: "u128"; }, { name: "cumulativeDepositInterestAfter"; type: "u128"; }, { name: "depositTokenAmountBefore"; type: "u64"; }, { name: "amount"; type: "u64"; } ]; }; }, { name: "deleteUserRecord"; type: { kind: "struct"; fields: [ { name: "ts"; type: "i64"; }, { name: "userAuthority"; type: "pubkey"; }, { name: "user"; type: "pubkey"; }, { name: "subAccountId"; type: "u16"; }, { name: "keeper"; type: { option: "pubkey"; }; } ]; }; }, { name: "fuelSweepRecord"; type: { kind: "struct"; fields: [ { name: "ts"; type: "i64"; }, { name: "authority"; type: "pubkey"; }, { name: "userStatsFuelInsurance"; type: "u32"; }, { name: "userStatsFuelDeposits"; type: "u32"; }, { name: "userStatsFuelBorrows"; type: "u32"; }, { name: "userStatsFuelPositions"; type: "u32"; }, { name: "userStatsFuelTaker"; type: "u32"; }, { name: "userStatsFuelMaker"; type: "u32"; }, { name: "fuelOverflowFuelInsurance"; type: "u128"; }, { name: "fuelOverflowFuelDeposits"; type: "u128"; }, { name: "fuelOverflowFuelBorrows"; type: "u128"; }, { name: "fuelOverflowFuelPositions"; type: "u128"; }, { name: "fuelOverflowFuelTaker"; type: "u128"; }, { name: "fuelOverflowFuelMaker"; type: "u128"; } ]; }; }, { name: "fuelSeasonRecord"; type: { kind: "struct"; fields: [ { name: "ts"; type: "i64"; }, { name: "authority"; type: "pubkey"; }, { name: "fuelInsurance"; type: "u128"; }, { name: "fuelDeposits"; type: "u128"; }, { name: "fuelBorrows"; type: "u128"; }, { name: "fuelPositions"; type: "u128"; }, { name: "fuelTaker"; type: "u128"; }, { name: "fuelMaker"; type: "u128"; }, { name: "fuelTotal"; type: "u128"; } ]; }; } ]; }; declare const DRIFT_IDL: Drift; type DriftIdlType = Drift; declare function driftUserStatsRawToDto(userStatsRaw: DriftUserStats): DriftUserStatsJSON; declare function driftUserRawToDto(userRaw: DriftUser): DriftUserJSON; declare function driftStateRawToDto(stateRaw: DriftState): DriftStateJSON; declare function driftSpotMarketRawToDto(spotMarketRaw: DriftSpotMarket | DriftSpotMarketRaw): DriftSpotMarketJSON; declare function driftRewardsRawToDto(rewardsRaw: DriftRewards): DriftRewardsJSON; declare function dtoToDriftUserStatsRaw(userStatsDto: DriftUserStatsJSON): DriftUserStats; declare function dtoToDriftUserRaw(userDto: DriftUserJSON): DriftUser; declare function dtoToDriftStateRaw(stateDto: DriftStateJSON): DriftState; declare function dtoToDriftRewardsRaw(rewardsDto: DriftRewardsJSON): DriftRewards; declare function dtoToDriftSpotMarketRaw(spotMarketDto: DriftSpotMarketJSON): DriftSpotMarket; declare function decodeDriftSpotMarketData(data: Buffer): DriftSpotMarketRaw; declare function decodeDriftStateData(data: Buffer): DriftState; declare function decodeDriftUserData(data: Buffer): DriftUser; declare function decodeDriftUserStatsData(data: Buffer): DriftUserStats; declare const SEED_DRIFT_STATE = "drift_state"; declare const SEED_USER = "user"; declare const SEED_USER_STATS = "user_stats"; declare const SEED_SPOT_MARKET = "spot_market"; declare const SEED_SPOT_MARKET_VAULT = "spot_market_vault"; declare const SEED_DRIFT_SIGNER = "drift_signer"; declare function getAllDerivedDriftAccounts(marketIndex: number): { driftState: PublicKey; driftSigner: PublicKey; driftSpotMarket: PublicKey; driftSpotMarketVault: PublicKey; }; declare function deriveDriftState(programId?: PublicKey): [PublicKey, number]; declare function deriveDriftSigner(programId?: PublicKey): [PublicKey, number]; declare function deriveDriftUser(authority: PublicKey, subAccountId: number, programId?: PublicKey): [PublicKey, number]; declare function deriveDriftUserStats(authority: PublicKey, programId?: PublicKey): [PublicKey, number]; declare function deriveDriftSpotMarket(marketIndex: number, programId?: PublicKey): [PublicKey, number]; declare function deriveDriftSpotMarketVault(marketIndex: number, programId?: PublicKey): [PublicKey, number]; /** * All-in-one APY/APR calculation module for Drift Protocol * * This file contains: * - Constants * - Core rate calculations (APR) * - APY calculations (with compounding) */ declare const ZERO: BN; declare const ONE: BN; declare const TEN: BN; declare const PERCENTAGE_PRECISION_EXP: BN; declare const PERCENTAGE_PRECISION: BN; declare const SPOT_MARKET_RATE_PRECISION_EXP: BN; declare const SPOT_MARKET_RATE_PRECISION: BN; declare const SPOT_MARKET_UTILIZATION_PRECISION_EXP: BN; declare const SPOT_MARKET_UTILIZATION_PRECISION: BN; declare const ONE_YEAR: BN; /** * Calculates the spot token amount including any accumulated interest. */ declare function getDriftTokenAmount(balanceAmount: BN, spotMarket: DriftSpotMarket, balanceType: DriftSpotBalanceType): BN; /** * Calculates the utilization rate of a spot market * Utilization = borrows / deposits */ declare function calculateDriftUtilization(bank: DriftSpotMarket, delta?: BN): BN; /** * Calculates the interest rate based on utilization using a piecewise curve */ declare function calculateDriftInterestRate(bank: DriftSpotMarket, delta?: BN, currentUtilization?: BN | null): BN; /** * Calculates the borrow rate (APR) for a spot market */ declare function calculateDriftBorrowRate(bank: DriftSpotMarket, delta?: BN, currentUtilization?: BN | null): BN; /** * Calculates the deposit rate (APR) for a spot market * This is the annualized interest rate lenders earn */ declare function calculateDriftDepositRate(bank: DriftSpotMarket, delta?: BN, currentUtilization?: BN | null): BN; /** * Calculates the Annual Percentage Yield (APY) for a lending/deposit position. * * APY accounts for compounding effects, unlike the simple deposit rate (APR). * * Formula: APY = e^(rate) - 1 (for continuous compounding approximation) * * @param bank - The SpotMarketAccount for the market * @param delta - Optional delta to simulate a deposit/borrow change (default: ZERO) * @param currentUtilization - Optional pre-calculated utilization (default: null, will be calculated) * @param compoundingPeriodsPerYear - Number of times interest compounds per year (default: 365 for daily) * @returns APY as a percentage scaled by PERCENTAGE_PRECISION (e.g., 5% = 5_000_000) * * @example * ```typescript * const bank = driftClient.getSpotMarketAccount(0); // USDC * const apy = calculateLendingAPY(bank); * const apyPercent = apy.toNumber() / PERCENTAGE_PRECISION.toNumber(); // Convert to decimal * console.log(`Lending APY: ${apyPercent.toFixed(2)}%`); * ``` */ declare function calculateDriftLendingAPY(bank: DriftSpotMarket, delta?: BN, currentUtilization?: BN | null, _compoundingPeriodsPerYear?: number): BN; /** * Calculates a simplified lending APY without compounding (essentially the APR). * This is faster but less accurate than calculateLendingAPY. * * @param bank - The SpotMarketAccount for the market * @param delta - Optional delta to simulate a deposit/borrow change (default: ZERO) * @param currentUtilization - Optional pre-calculated utilization (default: null) * @returns APR as a percentage scaled by PERCENTAGE_PRECISION */ declare function calculateDriftLendingAPR(bank: DriftSpotMarket, delta?: BN, currentUtilization?: BN | null): BN; /** * Calculates the borrowing APY for a borrow position. * * @param bank - The SpotMarketAccount for the market * @param delta - Optional delta to simulate a deposit/borrow change (default: ZERO) * @param currentUtilization - Optional pre-calculated utilization (default: null) * @param compoundingPeriodsPerYear - Number of times interest compounds per year (default: 365) * @returns APY as a percentage scaled by PERCENTAGE_PRECISION */ declare function calculateDriftBorrowAPY(bank: DriftSpotMarket, delta?: BN, currentUtilization?: BN | null, _compoundingPeriodsPerYear?: number): BN; /** * Calculates the borrowing APR (without compounding). * * @param bank - The SpotMarketAccount for the market * @param delta - Optional delta to simulate a deposit/borrow change (default: ZERO) * @param currentUtilization - Optional pre-calculated utilization (default: null) * @returns APR as a percentage scaled by PERCENTAGE_PRECISION */ declare function calculateDriftBorrowAPR(bank: DriftSpotMarket, delta?: BN, currentUtilization?: BN | null): BN; /** * Interest rate curve point for visualization */ interface DriftInterestRateCurvePoint { utilization: number; borrowAPY: number; supplyAPY: number; } /** * Generate complete interest rate curve for a Drift spot market * Creates 101 data points from 0% to 100% utilization * * @param spotMarket - The Drift spot market account * @returns Array of curve points with utilization, borrow APY, and supply APY * * @example * ```typescript * const spotMarket = getDriftSpotMarket(0); // USDC market * const curve = generateDriftReserveCurve(spotMarket); * * curve.forEach(point => { * console.log(`Utilization: ${point.utilization}%`); * console.log(`Borrow APY: ${point.borrowAPY.toFixed(2)}%`); * console.log(`Supply APY: ${point.supplyAPY.toFixed(2)}%`); * }); * ``` */ declare function generateDriftReserveCurve(spotMarket: DriftSpotMarket): DriftInterestRateCurvePoint[]; declare function getDriftRewards(spotMarkets: DriftSpotMarket[], userStates: { bankAddress: PublicKey; marketMint: PublicKey; driftUser: DriftUser; }[], connection: Connection): Promise>; declare function getAllRequiredMarkets(spotMarkets: DriftSpotMarket[], driftUsers: DriftUser[], connection: Connection): Promise; declare const DRIFT_PROGRAM_ID: PublicKey; declare const makeUpdateSpotMarketCumulativeInterestIx: (state: PublicKey, spotMarket: PublicKey, oracle: PublicKey, spotMarketVault: PublicKey) => TransactionInstruction; type MakeUpdateSpotMarketIxParams = { spotMarket: DriftSpotMarket; }; declare function makeUpdateSpotMarketIx({ spotMarket }: MakeUpdateSpotMarketIxParams): _solana_web3_js.TransactionInstruction; /** * Raw on-chain Lending account (integration_acc_1). * * This is the primary state account for a jup-lend market. * It holds the cToken (fToken) and underlying asset exchange rates * and is analogous to a Kamino Reserve or Drift SpotMarket. */ interface JupLendingStateRaw { pubkey: PublicKey; mint: PublicKey; fTokenMint: PublicKey; lendingId: number; /** Number of decimals for the fToken, same as underlying asset */ decimals: number; /** PDA of the rewards rate model used by get_rate instruction */ rewardsRateModel: PublicKey; /** Exchange price for the underlying asset in the liquidity protocol (without rewards) */ liquidityExchangePrice: BN; /** Exchange price between fToken and the underlying asset (with rewards) */ tokenExchangePrice: BN; /** Timestamp when exchange prices were last updated */ lastUpdateTimestamp: BN; tokenReservesLiquidity: PublicKey; supplyPositionOnLiquidity: PublicKey; bump: number; } /** * Raw on-chain TokenReserve account (bytemuck / packed C repr). * * This lives on the jup liquidity layer and contains supply/borrow * exchange prices, utilization, and totals for a given token. */ interface JupTokenReserveRaw { pubkey: PublicKey; mint: PublicKey; vault: PublicKey; borrowRate: number; feeOnInterest: number; lastUtilization: number; lastUpdateTimestamp: BN; supplyExchangePrice: BN; borrowExchangePrice: BN; maxUtilization: number; totalSupplyWithInterest: BN; totalSupplyInterestFree: BN; totalBorrowWithInterest: BN; totalBorrowInterestFree: BN; totalClaimAmount: BN; interactingProtocol: PublicKey; interactingTimestamp: BN; interactingBalance: BN; } /** * Raw on-chain LendingRewardsRateModel account. * * Controls the rewards distribution parameters for a jup-lend market. */ interface JupLendingRewardsRateModelRaw { pubkey: PublicKey; /** Mint address */ mint: PublicKey; /** TVL below which rewards rate is 0 */ startTvl: BN; /** Duration for which current rewards should run */ duration: BN; /** Timestamp when current rewards got started */ startTime: BN; /** Annualized reward based on input params (duration, rewardAmount) */ yearlyReward: BN; /** Duration for the next rewards phase */ nextDuration: BN; /** Amount of rewards for the next phase */ nextRewardAmount: BN; bump: number; } /** * Raw on-chain RateModel account (bytemuck / packed C repr). * * This lives on the jup liquidity layer and contains the piecewise * linear interest rate curve parameters for a given token. * * V1 (version=1): single kink — rateAtZero → rateAtKink1 → rateAtMax * V2 (version=2): dual kink — rateAtZero → rateAtKink1 → rateAtKink2 → rateAtMax * * All rate/utilization values are in bps (100% = 10,000). */ interface JupRateModelRaw { pubkey: PublicKey; mint: PublicKey; version: number; rateAtZero: number; kink1Utilization: number; rateAtKink1: number; rateAtMax: number; kink2Utilization: number; rateAtKink2: number; } declare const JUP_LEND_PROGRAM_ID: PublicKey; declare const JUP_LIQUIDITY_PROGRAM_ID: PublicKey; declare const JUP_REWARDS_PROGRAM_ID: PublicKey; /** * Program IDL in camelCase format in order to be used in JS/TS. * * Note that this is only a type helper and is not the actual IDL. The original * IDL was extracted from https://github.com/jup-ag/jupiter-lend (target/idl/lending.json). */ type JupLend = { address: "jup3YeL8QhtSx1e253b2FDvsMNC87fDrgQZivbrndc9"; metadata: { name: "lending"; version: "0.1.4"; spec: "0.1.0"; description: "Created with Anchor"; }; instructions: [ { name: "deposit"; discriminator: [242, 35, 198, 137, 82, 225, 242, 182]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "depositorTokenAccount"; writable: true; }, { name: "recipientTokenAccount"; writable: true; }, { name: "mint"; relations: ["lending", "rewardsRateModel"]; }, { name: "lendingAdmin"; }, { name: "lending"; writable: true; }, { name: "fTokenMint"; writable: true; relations: ["lending"]; }, { name: "supplyTokenReservesLiquidity"; writable: true; }, { name: "lendingSupplyPositionOnLiquidity"; writable: true; }, { name: "rateModel"; }, { name: "vault"; writable: true; }, { name: "liquidity"; writable: true; }, { name: "liquidityProgram"; relations: ["lendingAdmin"]; }, { name: "rewardsRateModel"; }, { name: "tokenProgram"; }, { name: "associatedTokenProgram"; optional: true; address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; } ]; args: [ { name: "assets"; type: "u64"; } ]; returns: "u64"; }, { name: "depositWithMinAmountOut"; discriminator: [116, 144, 16, 97, 118, 109, 40, 119]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "depositorTokenAccount"; writable: true; }, { name: "recipientTokenAccount"; writable: true; }, { name: "mint"; relations: ["lending", "rewardsRateModel"]; }, { name: "lendingAdmin"; }, { name: "lending"; writable: true; }, { name: "fTokenMint"; writable: true; relations: ["lending"]; }, { name: "supplyTokenReservesLiquidity"; writable: true; }, { name: "lendingSupplyPositionOnLiquidity"; writable: true; }, { name: "rateModel"; }, { name: "vault"; writable: true; }, { name: "liquidity"; writable: true; }, { name: "liquidityProgram"; relations: ["lendingAdmin"]; }, { name: "rewardsRateModel"; }, { name: "tokenProgram"; }, { name: "associatedTokenProgram"; optional: true; address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; } ]; args: [ { name: "assets"; type: "u64"; }, { name: "minAmountOut"; type: "u64"; } ]; }, { name: "initLending"; discriminator: [156, 224, 67, 46, 89, 189, 157, 209]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "lendingAdmin"; writable: true; }, { name: "mint"; relations: ["tokenReservesLiquidity"]; }, { name: "fTokenMint"; writable: true; pda: { seeds: [ { kind: "const"; value: [ 102, 95, 116, 111, 107, 101, 110, 95, 109, 105, 110, 116 ]; }, { kind: "account"; path: "mint"; } ]; }; }, { name: "metadataAccount"; writable: true; pda: { seeds: [ { kind: "const"; value: [109, 101, 116, 97, 100, 97, 116, 97]; }, { kind: "const"; value: [ 11, 112, 101, 177, 227, 209, 124, 69, 56, 157, 82, 127, 107, 4, 195, 205, 88, 184, 108, 115, 26, 160, 253, 181, 73, 182, 209, 188, 3, 248, 41, 70 ]; }, { kind: "account"; path: "fTokenMint"; } ]; program: { kind: "const"; value: [ 11, 112, 101, 177, 227, 209, 124, 69, 56, 157, 82, 127, 107, 4, 195, 205, 88, 184, 108, 115, 26, 160, 253, 181, 73, 182, 209, 188, 3, 248, 41, 70 ]; }; }; }, { name: "lending"; writable: true; pda: { seeds: [ { kind: "const"; value: [108, 101, 110, 100, 105, 110, 103]; }, { kind: "account"; path: "mint"; }, { kind: "account"; path: "fTokenMint"; } ]; }; }, { name: "tokenReservesLiquidity"; }, { name: "tokenProgram"; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; }, { name: "sysvarInstruction"; address: "Sysvar1nstructions1111111111111111111111111"; }, { name: "metadataProgram"; address: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"; }, { name: "rent"; address: "SysvarRent111111111111111111111111111111111"; } ]; args: [ { name: "symbol"; type: "string"; }, { name: "liquidityProgram"; type: "pubkey"; } ]; }, { name: "initLendingAdmin"; discriminator: [203, 185, 241, 165, 56, 254, 33, 9]; accounts: [ { name: "authority"; writable: true; signer: true; }, { name: "lendingAdmin"; writable: true; pda: { seeds: [ { kind: "const"; value: [ 108, 101, 110, 100, 105, 110, 103, 95, 97, 100, 109, 105, 110 ]; } ]; }; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; } ]; args: [ { name: "liquidityProgram"; type: "pubkey"; }, { name: "rebalancer"; type: "pubkey"; }, { name: "authority"; type: "pubkey"; } ]; }, { name: "mint"; discriminator: [51, 57, 225, 47, 182, 146, 137, 166]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "depositorTokenAccount"; writable: true; }, { name: "recipientTokenAccount"; writable: true; }, { name: "mint"; relations: ["lending", "rewardsRateModel"]; }, { name: "lendingAdmin"; }, { name: "lending"; writable: true; }, { name: "fTokenMint"; writable: true; relations: ["lending"]; }, { name: "supplyTokenReservesLiquidity"; writable: true; }, { name: "lendingSupplyPositionOnLiquidity"; writable: true; }, { name: "rateModel"; }, { name: "vault"; writable: true; }, { name: "liquidity"; writable: true; }, { name: "liquidityProgram"; relations: ["lendingAdmin"]; }, { name: "rewardsRateModel"; }, { name: "tokenProgram"; }, { name: "associatedTokenProgram"; optional: true; address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; } ]; args: [ { name: "shares"; type: "u64"; } ]; returns: "u64"; }, { name: "mintWithMaxAssets"; discriminator: [6, 94, 69, 122, 30, 179, 146, 171]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "depositorTokenAccount"; writable: true; }, { name: "recipientTokenAccount"; writable: true; }, { name: "mint"; relations: ["lending", "rewardsRateModel"]; }, { name: "lendingAdmin"; }, { name: "lending"; writable: true; }, { name: "fTokenMint"; writable: true; relations: ["lending"]; }, { name: "supplyTokenReservesLiquidity"; writable: true; }, { name: "lendingSupplyPositionOnLiquidity"; writable: true; }, { name: "rateModel"; }, { name: "vault"; writable: true; }, { name: "liquidity"; writable: true; }, { name: "liquidityProgram"; relations: ["lendingAdmin"]; }, { name: "rewardsRateModel"; }, { name: "tokenProgram"; }, { name: "associatedTokenProgram"; optional: true; address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; } ]; args: [ { name: "shares"; type: "u64"; }, { name: "maxAssets"; type: "u64"; } ]; returns: "u64"; }, { name: "rebalance"; discriminator: [108, 158, 77, 9, 210, 52, 88, 62]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "depositorTokenAccount"; writable: true; pda: { seeds: [ { kind: "account"; path: "signer"; }, { kind: "account"; path: "tokenProgram"; }, { kind: "account"; path: "mint"; } ]; program: { kind: "const"; value: [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { name: "lendingAdmin"; }, { name: "lending"; writable: true; }, { name: "mint"; relations: ["lending", "rewardsRateModel"]; }, { name: "fTokenMint"; writable: true; relations: ["lending"]; }, { name: "supplyTokenReservesLiquidity"; writable: true; }, { name: "lendingSupplyPositionOnLiquidity"; writable: true; }, { name: "rateModel"; writable: true; }, { name: "vault"; writable: true; }, { name: "liquidity"; writable: true; }, { name: "liquidityProgram"; relations: ["lendingAdmin"]; }, { name: "rewardsRateModel"; }, { name: "tokenProgram"; }, { name: "associatedTokenProgram"; address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; } ]; args: []; }, { name: "rebalanceWithAmounts"; discriminator: [190, 33, 144, 182, 86, 4, 141, 73]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "depositorTokenAccount"; writable: true; pda: { seeds: [ { kind: "account"; path: "signer"; }, { kind: "account"; path: "tokenProgram"; }, { kind: "account"; path: "mint"; } ]; program: { kind: "const"; value: [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { name: "lendingAdmin"; }, { name: "lending"; writable: true; }, { name: "mint"; relations: ["lending", "rewardsRateModel"]; }, { name: "fTokenMint"; writable: true; relations: ["lending"]; }, { name: "supplyTokenReservesLiquidity"; writable: true; }, { name: "lendingSupplyPositionOnLiquidity"; writable: true; }, { name: "rateModel"; writable: true; }, { name: "vault"; writable: true; }, { name: "liquidity"; writable: true; }, { name: "liquidityProgram"; relations: ["lendingAdmin"]; }, { name: "rewardsRateModel"; }, { name: "tokenProgram"; }, { name: "associatedTokenProgram"; address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; } ]; args: [ { name: "amount"; type: { option: "u64"; }; } ]; }, { name: "redeem"; discriminator: [184, 12, 86, 149, 70, 196, 97, 225]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "ownerTokenAccount"; writable: true; }, { name: "recipientTokenAccount"; writable: true; }, { name: "lendingAdmin"; }, { name: "lending"; writable: true; }, { name: "mint"; relations: ["lending", "rewardsRateModel"]; }, { name: "fTokenMint"; writable: true; relations: ["lending"]; }, { name: "supplyTokenReservesLiquidity"; writable: true; }, { name: "lendingSupplyPositionOnLiquidity"; writable: true; }, { name: "rateModel"; }, { name: "vault"; writable: true; }, { name: "claimAccount"; writable: true; optional: true; }, { name: "liquidity"; writable: true; }, { name: "liquidityProgram"; relations: ["lendingAdmin"]; }, { name: "rewardsRateModel"; }, { name: "tokenProgram"; }, { name: "associatedTokenProgram"; optional: true; address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; } ]; args: [ { name: "shares"; type: "u64"; } ]; returns: "u64"; }, { name: "redeemWithMinAmountOut"; discriminator: [235, 189, 237, 56, 166, 180, 184, 149]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "ownerTokenAccount"; writable: true; }, { name: "recipientTokenAccount"; writable: true; }, { name: "lendingAdmin"; }, { name: "lending"; writable: true; }, { name: "mint"; relations: ["lending", "rewardsRateModel"]; }, { name: "fTokenMint"; writable: true; relations: ["lending"]; }, { name: "supplyTokenReservesLiquidity"; writable: true; }, { name: "lendingSupplyPositionOnLiquidity"; writable: true; }, { name: "rateModel"; }, { name: "vault"; writable: true; }, { name: "claimAccount"; writable: true; optional: true; }, { name: "liquidity"; writable: true; }, { name: "liquidityProgram"; relations: ["lendingAdmin"]; }, { name: "rewardsRateModel"; }, { name: "tokenProgram"; }, { name: "associatedTokenProgram"; optional: true; address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; } ]; args: [ { name: "shares"; type: "u64"; }, { name: "minAmountOut"; type: "u64"; } ]; }, { name: "setRewardsRateModel"; discriminator: [174, 231, 116, 203, 8, 58, 143, 203]; accounts: [ { name: "signer"; signer: true; }, { name: "lendingAdmin"; }, { name: "lending"; writable: true; }, { name: "fTokenMint"; relations: ["lending"]; }, { name: "newRewardsRateModel"; }, { name: "supplyTokenReservesLiquidity"; } ]; args: [ { name: "mint"; type: "pubkey"; } ]; }, { name: "updateAuthority"; discriminator: [32, 46, 64, 28, 149, 75, 243, 88]; accounts: [ { name: "signer"; signer: true; }, { name: "lendingAdmin"; writable: true; } ]; args: [ { name: "newAuthority"; type: "pubkey"; } ]; }, { name: "updateAuths"; discriminator: [93, 96, 178, 156, 57, 117, 253, 209]; accounts: [ { name: "signer"; signer: true; }, { name: "lendingAdmin"; writable: true; } ]; args: [ { name: "authStatus"; type: { vec: { defined: { name: "addressBool"; }; }; }; } ]; }, { name: "updateRate"; discriminator: [24, 225, 53, 189, 72, 212, 225, 178]; accounts: [ { name: "lending"; writable: true; }, { name: "mint"; relations: ["lending", "supplyTokenReservesLiquidity"]; }, { name: "fTokenMint"; relations: ["lending"]; }, { name: "supplyTokenReservesLiquidity"; }, { name: "rewardsRateModel"; } ]; args: []; }, { name: "updateRebalancer"; discriminator: [206, 187, 54, 228, 145, 8, 203, 111]; accounts: [ { name: "signer"; signer: true; }, { name: "lendingAdmin"; writable: true; } ]; args: [ { name: "newRebalancer"; type: "pubkey"; } ]; }, { name: "withdraw"; discriminator: [183, 18, 70, 156, 148, 109, 161, 34]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "ownerTokenAccount"; writable: true; }, { name: "recipientTokenAccount"; writable: true; }, { name: "lendingAdmin"; }, { name: "lending"; writable: true; }, { name: "mint"; relations: ["lending", "rewardsRateModel"]; }, { name: "fTokenMint"; writable: true; relations: ["lending"]; }, { name: "supplyTokenReservesLiquidity"; writable: true; }, { name: "lendingSupplyPositionOnLiquidity"; writable: true; }, { name: "rateModel"; }, { name: "vault"; writable: true; }, { name: "claimAccount"; writable: true; optional: true; }, { name: "liquidity"; writable: true; }, { name: "liquidityProgram"; relations: ["lendingAdmin"]; }, { name: "rewardsRateModel"; }, { name: "tokenProgram"; }, { name: "associatedTokenProgram"; optional: true; address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; } ]; args: [ { name: "amount"; type: "u64"; } ]; returns: "u64"; }, { name: "withdrawWithMaxSharesBurn"; discriminator: [47, 197, 183, 171, 239, 18, 245, 171]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "ownerTokenAccount"; writable: true; }, { name: "recipientTokenAccount"; writable: true; }, { name: "lendingAdmin"; }, { name: "lending"; writable: true; }, { name: "mint"; relations: ["lending", "rewardsRateModel"]; }, { name: "fTokenMint"; writable: true; relations: ["lending"]; }, { name: "supplyTokenReservesLiquidity"; writable: true; }, { name: "lendingSupplyPositionOnLiquidity"; writable: true; }, { name: "rateModel"; }, { name: "vault"; writable: true; }, { name: "claimAccount"; writable: true; optional: true; }, { name: "liquidity"; writable: true; }, { name: "liquidityProgram"; relations: ["lendingAdmin"]; }, { name: "rewardsRateModel"; }, { name: "tokenProgram"; }, { name: "associatedTokenProgram"; optional: true; address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; } ]; args: [ { name: "amount"; type: "u64"; }, { name: "maxSharesBurn"; type: "u64"; } ]; returns: "u64"; } ]; accounts: [ { name: "lending"; discriminator: [135, 199, 82, 16, 249, 131, 182, 241]; }, { name: "lendingAdmin"; discriminator: [42, 8, 33, 220, 163, 40, 210, 5]; }, { name: "lendingRewardsRateModel"; discriminator: [166, 72, 71, 131, 172, 74, 166, 181]; }, { name: "tokenReserve"; discriminator: [21, 18, 59, 135, 120, 20, 31, 12]; }, { name: "userSupplyPosition"; discriminator: [202, 219, 136, 118, 61, 177, 21, 146]; } ]; events: [ { name: "logDeposit"; discriminator: [176, 243, 1, 56, 142, 206, 1, 106]; }, { name: "logRebalance"; discriminator: [90, 67, 219, 41, 181, 118, 132, 9]; }, { name: "logUpdateAuthority"; discriminator: [150, 152, 157, 143, 6, 135, 193, 101]; }, { name: "logUpdateAuths"; discriminator: [88, 80, 109, 48, 111, 203, 76, 251]; }, { name: "logUpdateRates"; discriminator: [222, 11, 113, 60, 147, 15, 68, 217]; }, { name: "logUpdateRebalancer"; discriminator: [66, 79, 144, 204, 26, 217, 153, 225]; }, { name: "logUpdateRewards"; discriminator: [37, 13, 111, 186, 47, 245, 162, 121]; }, { name: "logWithdraw"; discriminator: [49, 9, 176, 179, 222, 190, 6, 117]; } ]; errors: [ { code: 6000; name: "fTokenDepositInsignificant"; msg: "fTokenDepositInsignificant"; }, { code: 6001; name: "fTokenMinAmountOut"; msg: "fTokenMinAmountOut"; }, { code: 6002; name: "fTokenMaxAmount"; msg: "fTokenMaxAmount"; }, { code: 6003; name: "fTokenInvalidParams"; msg: "fTokenInvalidParams"; }, { code: 6004; name: "fTokenRewardsRateModelAlreadySet"; msg: "fTokenRewardsRateModelAlreadySet"; }, { code: 6005; name: "fTokenMaxAuthCountReached"; msg: "fTokenMaxAuthCount"; }, { code: 6006; name: "fTokenLiquidityExchangePriceUnexpected"; msg: "fTokenLiquidityExchangePriceUnexpected"; }, { code: 6007; name: "fTokenCpiToLiquidityFailed"; msg: "fTokenCpiToLiquidityFailed"; }, { code: 6008; name: "fTokenOnlyAuth"; msg: "fTokenOnlyAuth"; }, { code: 6009; name: "fTokenOnlyAuthority"; msg: "fTokenOnlyAuthority"; }, { code: 6010; name: "fTokenOnlyRebalancer"; msg: "fTokenOnlyRebalancer"; }, { code: 6011; name: "fTokenUserSupplyPositionRequired"; msg: "fTokenUserSupplyPositionRequired"; }, { code: 6012; name: "fTokenLiquidityProgramMismatch"; msg: "fTokenLiquidityProgramMismatch"; } ]; types: [ { name: "addressBool"; type: { kind: "struct"; fields: [ { name: "addr"; type: "pubkey"; }, { name: "value"; type: "bool"; } ]; }; }, { name: "lending"; type: { kind: "struct"; fields: [ { name: "mint"; type: "pubkey"; }, { name: "fTokenMint"; type: "pubkey"; }, { name: "lendingId"; type: "u16"; }, { name: "decimals"; docs: ["@dev number of decimals for the fToken, same as ASSET"]; type: "u8"; }, { name: "rewardsRateModel"; docs: [ "@dev To read PDA of rewards rate model to get_rate instruction" ]; type: "pubkey"; }, { name: "liquidityExchangePrice"; docs: [ "@dev exchange price for the underlying asset in the liquidity protocol (without rewards)" ]; type: "u64"; }, { name: "tokenExchangePrice"; docs: [ "@dev exchange price between fToken and the underlying asset (with rewards)" ]; type: "u64"; }, { name: "lastUpdateTimestamp"; docs: [ "@dev timestamp when exchange prices were updated the last time" ]; type: "u64"; }, { name: "tokenReservesLiquidity"; type: "pubkey"; }, { name: "supplyPositionOnLiquidity"; type: "pubkey"; }, { name: "bump"; type: "u8"; } ]; }; }, { name: "lendingAdmin"; type: { kind: "struct"; fields: [ { name: "authority"; type: "pubkey"; }, { name: "liquidityProgram"; type: "pubkey"; }, { name: "rebalancer"; type: "pubkey"; }, { name: "nextLendingId"; type: "u16"; }, { name: "auths"; type: { vec: "pubkey"; }; }, { name: "bump"; type: "u8"; } ]; }; }, { name: "lendingRewardsRateModel"; type: { kind: "struct"; fields: [ { name: "mint"; docs: ["@dev mint address"]; type: "pubkey"; }, { name: "startTvl"; docs: [ "@dev tvl below which rewards rate is 0. If current TVL is below this value, triggering `update_rate()` on the fToken", "might bring the total TVL above this cut-off." ]; type: "u64"; }, { name: "duration"; docs: ["@dev for how long current rewards should run"]; type: "u64"; }, { name: "startTime"; docs: ["@dev when current rewards got started"]; type: "u64"; }, { name: "yearlyReward"; docs: [ "@dev current annualized reward based on input params (duration, rewardAmount)" ]; type: "u64"; }, { name: "nextDuration"; docs: ["@dev Duration for the next rewards phase"]; type: "u64"; }, { name: "nextRewardAmount"; docs: ["@dev Amount of rewards for the next phase"]; type: "u64"; }, { name: "bump"; type: "u8"; } ]; }; }, { name: "logDeposit"; type: { kind: "struct"; fields: [ { name: "sender"; type: "pubkey"; }, { name: "receiver"; type: "pubkey"; }, { name: "assets"; type: "u64"; }, { name: "sharesMinted"; type: "u64"; } ]; }; }, { name: "logRebalance"; type: { kind: "struct"; fields: [ { name: "assets"; type: "u64"; } ]; }; }, { name: "logUpdateAuthority"; type: { kind: "struct"; fields: [ { name: "newAuthority"; type: "pubkey"; } ]; }; }, { name: "logUpdateAuths"; type: { kind: "struct"; fields: [ { name: "authStatus"; type: { vec: { defined: { name: "addressBool"; }; }; }; } ]; }; }, { name: "logUpdateRates"; type: { kind: "struct"; fields: [ { name: "tokenExchangePrice"; type: "u64"; }, { name: "liquidityExchangePrice"; type: "u64"; } ]; }; }, { name: "logUpdateRebalancer"; type: { kind: "struct"; fields: [ { name: "newRebalancer"; type: "pubkey"; } ]; }; }, { name: "logUpdateRewards"; type: { kind: "struct"; fields: [ { name: "rewardsRateModel"; type: "pubkey"; } ]; }; }, { name: "logWithdraw"; type: { kind: "struct"; fields: [ { name: "sender"; type: "pubkey"; }, { name: "receiver"; type: "pubkey"; }, { name: "owner"; type: "pubkey"; }, { name: "assets"; type: "u64"; }, { name: "sharesBurned"; type: "u64"; } ]; }; }, { name: "tokenReserve"; docs: ["Token configuration and exchange prices"]; serialization: "bytemuck"; repr: { kind: "c"; packed: true; }; type: { kind: "struct"; fields: [ { name: "mint"; type: "pubkey"; }, { name: "vault"; type: "pubkey"; }, { name: "borrowRate"; type: "u16"; }, { name: "feeOnInterest"; type: "u16"; }, { name: "lastUtilization"; type: "u16"; }, { name: "lastUpdateTimestamp"; type: "u64"; }, { name: "supplyExchangePrice"; type: "u64"; }, { name: "borrowExchangePrice"; type: "u64"; }, { name: "maxUtilization"; type: "u16"; }, { name: "totalSupplyWithInterest"; type: "u64"; }, { name: "totalSupplyInterestFree"; type: "u64"; }, { name: "totalBorrowWithInterest"; type: "u64"; }, { name: "totalBorrowInterestFree"; type: "u64"; }, { name: "totalClaimAmount"; type: "u64"; }, { name: "interactingProtocol"; type: "pubkey"; }, { name: "interactingTimestamp"; type: "u64"; }, { name: "interactingBalance"; type: "u64"; } ]; }; }, { name: "userSupplyPosition"; docs: ["User supply position"]; serialization: "bytemuck"; repr: { kind: "c"; packed: true; }; type: { kind: "struct"; fields: [ { name: "protocol"; type: "pubkey"; }, { name: "mint"; type: "pubkey"; }, { name: "withInterest"; type: "u8"; }, { name: "amount"; type: "u64"; }, { name: "withdrawalLimit"; type: "u64"; }, { name: "decayAmount"; type: "u64"; }, { name: "lastUpdate"; type: "u64"; }, { name: "expandPct"; type: "u16"; }, { name: "expandDuration"; type: "u32"; }, { name: "decayDuration"; type: "u32"; }, { name: "baseWithdrawalLimit"; type: "u64"; }, { name: "status"; type: "u8"; } ]; }; } ]; }; /** * Program IDL in camelCase format in order to be used in JS/TS. * * Note that this is only a type helper and is not the actual IDL. The original * IDL was extracted from https://github.com/jup-ag/jupiter-lend (target/idl/liquidity.json). */ type Liquidity = { address: "jupeiUmn818Jg1ekPURTpr4mFo29p46vygyykFJ3wZC"; metadata: { name: "liquidity"; version: "0.1.5"; spec: "0.1.0"; description: "Created with Anchor"; }; instructions: [ { name: "changeStatus"; discriminator: [236, 145, 131, 228, 227, 17, 192, 255]; accounts: [ { name: "authority"; signer: true; }, { name: "liquidity"; writable: true; }, { name: "authList"; } ]; args: [ { name: "status"; type: "bool"; } ]; }, { name: "claim"; discriminator: [62, 198, 214, 193, 213, 159, 108, 210]; accounts: [ { name: "user"; signer: true; relations: ["claimAccount"]; }, { name: "liquidity"; }, { name: "tokenReserve"; writable: true; }, { name: "mint"; relations: ["tokenReserve", "claimAccount"]; }, { name: "recipientTokenAccount"; writable: true; }, { name: "vault"; writable: true; relations: ["tokenReserve"]; }, { name: "claimAccount"; writable: true; }, { name: "tokenProgram"; } ]; args: [ { name: "recipient"; type: "pubkey"; } ]; }, { name: "closeClaimAccount"; discriminator: [241, 146, 203, 216, 58, 222, 91, 118]; accounts: [ { name: "user"; writable: true; signer: true; relations: ["claimAccount"]; }, { name: "claimAccount"; writable: true; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; } ]; args: [ { name: "mint"; type: "pubkey"; } ]; }, { name: "collectRevenue"; discriminator: [87, 96, 211, 36, 240, 43, 246, 87]; accounts: [ { name: "authority"; writable: true; signer: true; }, { name: "liquidity"; }, { name: "authList"; }, { name: "mint"; relations: ["tokenReserve"]; }, { name: "revenueCollectorAccount"; writable: true; pda: { seeds: [ { kind: "account"; path: "revenueCollector"; }, { kind: "account"; path: "tokenProgram"; }, { kind: "account"; path: "mint"; } ]; program: { kind: "const"; value: [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { name: "revenueCollector"; }, { name: "tokenReserve"; writable: true; }, { name: "vault"; writable: true; pda: { seeds: [ { kind: "account"; path: "liquidity"; }, { kind: "account"; path: "tokenProgram"; }, { kind: "account"; path: "mint"; } ]; program: { kind: "const"; value: [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; relations: ["tokenReserve"]; }, { name: "tokenProgram"; }, { name: "associatedTokenProgram"; address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; } ]; args: []; }, { name: "initClaimAccount"; discriminator: [112, 141, 47, 170, 42, 99, 144, 145]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "claimAccount"; writable: true; pda: { seeds: [ { kind: "const"; value: [117, 115, 101, 114, 95, 99, 108, 97, 105, 109]; }, { kind: "arg"; path: "user"; }, { kind: "arg"; path: "mint"; } ]; }; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; } ]; args: [ { name: "mint"; type: "pubkey"; }, { name: "user"; type: "pubkey"; } ]; }, { name: "initLiquidity"; discriminator: [95, 189, 216, 183, 188, 62, 244, 108]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "liquidity"; writable: true; pda: { seeds: [ { kind: "const"; value: [108, 105, 113, 117, 105, 100, 105, 116, 121]; } ]; }; }, { name: "authList"; writable: true; pda: { seeds: [ { kind: "const"; value: [97, 117, 116, 104, 95, 108, 105, 115, 116]; } ]; }; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; } ]; args: [ { name: "authority"; type: "pubkey"; }, { name: "revenueCollector"; type: "pubkey"; } ]; }, { name: "initNewProtocol"; discriminator: [193, 147, 5, 32, 138, 135, 213, 158]; accounts: [ { name: "authority"; writable: true; signer: true; }, { name: "authList"; }, { name: "userSupplyPosition"; writable: true; pda: { seeds: [ { kind: "const"; value: [ 117, 115, 101, 114, 95, 115, 117, 112, 112, 108, 121, 95, 112, 111, 115, 105, 116, 105, 111, 110 ]; }, { kind: "arg"; path: "supplyMint"; }, { kind: "arg"; path: "protocol"; } ]; }; }, { name: "userBorrowPosition"; writable: true; pda: { seeds: [ { kind: "const"; value: [ 117, 115, 101, 114, 95, 98, 111, 114, 114, 111, 119, 95, 112, 111, 115, 105, 116, 105, 111, 110 ]; }, { kind: "arg"; path: "borrowMint"; }, { kind: "arg"; path: "protocol"; } ]; }; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; } ]; args: [ { name: "supplyMint"; type: "pubkey"; }, { name: "borrowMint"; type: "pubkey"; }, { name: "protocol"; type: "pubkey"; } ]; }, { name: "initTokenReserve"; discriminator: [228, 235, 65, 129, 159, 15, 6, 84]; accounts: [ { name: "authority"; writable: true; signer: true; }, { name: "liquidity"; }, { name: "authList"; }, { name: "mint"; }, { name: "vault"; writable: true; pda: { seeds: [ { kind: "account"; path: "liquidity"; }, { kind: "account"; path: "tokenProgram"; }, { kind: "account"; path: "mint"; } ]; program: { kind: "const"; value: [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { name: "rateModel"; writable: true; pda: { seeds: [ { kind: "const"; value: [114, 97, 116, 101, 95, 109, 111, 100, 101, 108]; }, { kind: "account"; path: "mint"; } ]; }; }, { name: "tokenReserve"; writable: true; pda: { seeds: [ { kind: "const"; value: [114, 101, 115, 101, 114, 118, 101]; }, { kind: "account"; path: "mint"; } ]; }; }, { name: "tokenProgram"; }, { name: "associatedTokenProgram"; address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; } ]; args: []; }, { name: "operate"; discriminator: [217, 106, 208, 99, 116, 151, 42, 135]; accounts: [ { name: "protocol"; signer: true; relations: ["userSupplyPosition", "userBorrowPosition"]; }, { name: "liquidity"; }, { name: "tokenReserve"; writable: true; }, { name: "mint"; relations: [ "tokenReserve", "rateModel", "borrowClaimAccount", "withdrawClaimAccount" ]; }, { name: "vault"; writable: true; relations: ["tokenReserve"]; }, { name: "userSupplyPosition"; writable: true; optional: true; }, { name: "userBorrowPosition"; writable: true; optional: true; }, { name: "rateModel"; }, { name: "withdrawToAccount"; writable: true; optional: true; }, { name: "borrowToAccount"; writable: true; optional: true; }, { name: "borrowClaimAccount"; writable: true; optional: true; }, { name: "withdrawClaimAccount"; writable: true; optional: true; }, { name: "tokenProgram"; } ]; args: [ { name: "supplyAmount"; type: "i128"; }, { name: "borrowAmount"; type: "i128"; }, { name: "withdrawTo"; type: "pubkey"; }, { name: "borrowTo"; type: "pubkey"; }, { name: "transferType"; type: { defined: { name: "transferType"; }; }; } ]; }, { name: "pauseToken"; discriminator: [226, 150, 72, 211, 159, 51, 226, 39]; accounts: [ { name: "authority"; signer: true; }, { name: "authList"; }, { name: "tokenReserve"; writable: true; } ]; args: [ { name: "mint"; type: "pubkey"; } ]; }, { name: "pauseUser"; discriminator: [18, 63, 43, 94, 239, 53, 101, 14]; accounts: [ { name: "authority"; signer: true; }, { name: "authList"; }, { name: "userSupplyPosition"; writable: true; }, { name: "userBorrowPosition"; writable: true; } ]; args: [ { name: "protocol"; type: "pubkey"; }, { name: "supplyMint"; type: "pubkey"; }, { name: "borrowMint"; type: "pubkey"; }, { name: "supplyStatus"; type: { option: "u8"; }; }, { name: "borrowStatus"; type: { option: "u8"; }; } ]; }, { name: "preOperate"; discriminator: [129, 205, 158, 155, 198, 155, 72, 133]; accounts: [ { name: "protocol"; signer: true; relations: ["userSupplyPosition", "userBorrowPosition"]; }, { name: "liquidity"; }, { name: "userSupplyPosition"; optional: true; }, { name: "userBorrowPosition"; optional: true; }, { name: "vault"; relations: ["tokenReserve"]; }, { name: "tokenReserve"; writable: true; }, { name: "tokenProgram"; } ]; args: [ { name: "mint"; type: "pubkey"; } ]; }, { name: "unpauseToken"; discriminator: [108, 117, 62, 30, 200, 92, 255, 202]; accounts: [ { name: "authority"; signer: true; }, { name: "authList"; }, { name: "tokenReserve"; writable: true; } ]; args: [ { name: "mint"; type: "pubkey"; } ]; }, { name: "unpauseUser"; discriminator: [71, 115, 128, 252, 182, 126, 234, 62]; accounts: [ { name: "authority"; signer: true; }, { name: "authList"; }, { name: "userSupplyPosition"; writable: true; }, { name: "userBorrowPosition"; writable: true; } ]; args: [ { name: "protocol"; type: "pubkey"; }, { name: "supplyMint"; type: "pubkey"; }, { name: "borrowMint"; type: "pubkey"; }, { name: "supplyStatus"; type: { option: "u8"; }; }, { name: "borrowStatus"; type: { option: "u8"; }; } ]; }, { name: "updateAuthority"; discriminator: [32, 46, 64, 28, 149, 75, 243, 88]; accounts: [ { name: "authority"; signer: true; }, { name: "liquidity"; writable: true; }, { name: "authList"; writable: true; } ]; args: [ { name: "newAuthority"; type: "pubkey"; } ]; }, { name: "updateAuths"; discriminator: [93, 96, 178, 156, 57, 117, 253, 209]; accounts: [ { name: "authority"; signer: true; }, { name: "liquidity"; }, { name: "authList"; writable: true; } ]; args: [ { name: "authStatus"; type: { vec: { defined: { name: "addressBool"; }; }; }; } ]; }, { name: "updateExchangePrice"; discriminator: [239, 244, 10, 248, 116, 25, 53, 150]; accounts: [ { name: "tokenReserve"; writable: true; }, { name: "rateModel"; } ]; args: [ { name: "mint"; type: "pubkey"; } ]; }, { name: "updateGuardians"; discriminator: [43, 62, 250, 138, 141, 117, 132, 97]; accounts: [ { name: "authority"; signer: true; }, { name: "liquidity"; }, { name: "authList"; writable: true; } ]; args: [ { name: "guardianStatus"; type: { vec: { defined: { name: "addressBool"; }; }; }; } ]; }, { name: "updateRateDataV1"; discriminator: [6, 20, 34, 122, 22, 150, 180, 22]; accounts: [ { name: "authority"; signer: true; }, { name: "authList"; }, { name: "rateModel"; writable: true; }, { name: "mint"; relations: ["rateModel", "tokenReserve"]; }, { name: "tokenReserve"; writable: true; } ]; args: [ { name: "rateData"; type: { defined: { name: "rateDataV1Params"; }; }; } ]; }, { name: "updateRateDataV2"; discriminator: [116, 73, 53, 146, 216, 45, 228, 124]; accounts: [ { name: "authority"; signer: true; }, { name: "authList"; }, { name: "rateModel"; writable: true; }, { name: "mint"; relations: ["rateModel", "tokenReserve"]; }, { name: "tokenReserve"; writable: true; } ]; args: [ { name: "rateData"; type: { defined: { name: "rateDataV2Params"; }; }; } ]; }, { name: "updateRevenueCollector"; discriminator: [167, 142, 124, 240, 220, 113, 141, 59]; accounts: [ { name: "authority"; signer: true; }, { name: "liquidity"; writable: true; } ]; args: [ { name: "revenueCollector"; type: "pubkey"; } ]; }, { name: "updateTokenConfig"; discriminator: [231, 122, 181, 79, 255, 79, 144, 167]; accounts: [ { name: "authority"; signer: true; }, { name: "authList"; }, { name: "rateModel"; writable: true; }, { name: "mint"; relations: ["rateModel", "tokenReserve"]; }, { name: "tokenReserve"; writable: true; } ]; args: [ { name: "tokenConfig"; type: { defined: { name: "tokenConfig"; }; }; } ]; }, { name: "updateUserBorrowConfig"; discriminator: [100, 176, 201, 174, 247, 2, 54, 168]; accounts: [ { name: "authority"; signer: true; }, { name: "protocol"; relations: ["userBorrowPosition"]; }, { name: "authList"; }, { name: "rateModel"; }, { name: "mint"; relations: ["rateModel", "tokenReserve", "userBorrowPosition"]; }, { name: "tokenReserve"; writable: true; }, { name: "userBorrowPosition"; writable: true; } ]; args: [ { name: "userBorrowConfig"; type: { defined: { name: "userBorrowConfig"; }; }; } ]; }, { name: "updateUserClass"; discriminator: [12, 206, 68, 135, 63, 212, 48, 119]; accounts: [ { name: "authority"; signer: true; }, { name: "authList"; writable: true; } ]; args: [ { name: "userClass"; type: { vec: { defined: { name: "addressU8"; }; }; }; } ]; }, { name: "updateUserSupplyConfig"; discriminator: [217, 239, 225, 218, 33, 49, 234, 183]; accounts: [ { name: "authority"; signer: true; }, { name: "protocol"; relations: ["userSupplyPosition"]; }, { name: "authList"; }, { name: "rateModel"; }, { name: "mint"; relations: ["rateModel", "tokenReserve", "userSupplyPosition"]; }, { name: "tokenReserve"; writable: true; }, { name: "userSupplyPosition"; writable: true; } ]; args: [ { name: "userSupplyConfig"; type: { defined: { name: "userSupplyConfig"; }; }; } ]; }, { name: "updateUserWithdrawalLimit"; discriminator: [162, 9, 186, 9, 213, 30, 173, 78]; accounts: [ { name: "authority"; signer: true; }, { name: "authList"; }, { name: "userSupplyPosition"; writable: true; } ]; args: [ { name: "newLimit"; type: "u128"; }, { name: "protocol"; type: "pubkey"; }, { name: "mint"; type: "pubkey"; } ]; } ]; accounts: [ { name: "authorizationList"; discriminator: [19, 157, 117, 43, 236, 167, 251, 69]; }, { name: "liquidity"; discriminator: [54, 252, 249, 226, 137, 172, 121, 58]; }, { name: "rateModel"; discriminator: [94, 3, 203, 219, 107, 137, 4, 162]; }, { name: "tokenReserve"; discriminator: [21, 18, 59, 135, 120, 20, 31, 12]; }, { name: "userBorrowPosition"; discriminator: [73, 126, 65, 123, 220, 126, 197, 24]; }, { name: "userClaim"; discriminator: [228, 142, 195, 181, 228, 147, 32, 209]; }, { name: "userSupplyPosition"; discriminator: [202, 219, 136, 118, 61, 177, 21, 146]; } ]; events: [ { name: "logBorrowRateCap"; discriminator: [156, 131, 232, 94, 254, 156, 14, 117]; }, { name: "logChangeStatus"; discriminator: [89, 77, 37, 172, 141, 31, 74, 42]; }, { name: "logClaim"; discriminator: [238, 50, 157, 85, 151, 58, 231, 45]; }, { name: "logCollectRevenue"; discriminator: [64, 198, 22, 194, 123, 87, 166, 82]; }, { name: "logOperate"; discriminator: [180, 8, 81, 71, 19, 132, 173, 8]; }, { name: "logPauseUser"; discriminator: [100, 17, 114, 224, 180, 30, 52, 170]; }, { name: "logTokenLockdown"; discriminator: [2, 103, 171, 11, 0, 27, 20, 40]; }, { name: "logUnpauseUser"; discriminator: [170, 91, 132, 96, 179, 77, 168, 26]; }, { name: "logUpdateAuthority"; discriminator: [150, 152, 157, 143, 6, 135, 193, 101]; }, { name: "logUpdateAuths"; discriminator: [88, 80, 109, 48, 111, 203, 76, 251]; }, { name: "logUpdateExchangePrices"; discriminator: [190, 194, 69, 204, 30, 86, 181, 163]; }, { name: "logUpdateGuardians"; discriminator: [231, 28, 191, 51, 53, 140, 79, 142]; }, { name: "logUpdateRateDataV1"; discriminator: [30, 102, 131, 192, 0, 30, 85, 223]; }, { name: "logUpdateRateDataV2"; discriminator: [206, 53, 195, 70, 113, 211, 92, 129]; }, { name: "logUpdateRevenueCollector"; discriminator: [44, 143, 80, 250, 211, 147, 180, 159]; }, { name: "logUpdateTokenConfigs"; discriminator: [24, 205, 191, 130, 47, 40, 233, 218]; }, { name: "logUpdateUserBorrowConfigs"; discriminator: [210, 251, 242, 159, 205, 33, 154, 74]; }, { name: "logUpdateUserClass"; discriminator: [185, 193, 106, 248, 11, 53, 0, 136]; }, { name: "logUpdateUserSupplyConfigs"; discriminator: [142, 160, 21, 90, 87, 88, 18, 51]; }, { name: "logUpdateUserWithdrawalLimit"; discriminator: [114, 131, 152, 189, 120, 253, 88, 105]; } ]; errors: [ { code: 6000; name: "userClassNotPausable"; msg: "adminModuleUserClassNotPausable"; }, { code: 6001; name: "userClassNotFound"; msg: "adminModuleUserClassNotFound"; }, { code: 6002; name: "userAlreadyPaused"; msg: "adminModuleUserAlreadyPaused"; }, { code: 6003; name: "userAlreadyUnpaused"; msg: "adminModuleUserAlreadyUnpaused"; }, { code: 6004; name: "onlyLiquidityAuthority"; msg: "adminModuleOnlyLiquidityAuthority"; }, { code: 6005; name: "onlyAuth"; msg: "adminModuleOnlyAuth"; }, { code: 6006; name: "onlyGuardians"; msg: "adminModuleOnlyGuardians"; }, { code: 6007; name: "invalidParams"; msg: "adminModuleInvalidParams"; }, { code: 6008; name: "invalidConfigOrder"; msg: "adminModuleInvalidConfigOrder"; }, { code: 6009; name: "statusAlreadySet"; msg: "adminModuleStatusAlreadySet"; }, { code: 6010; name: "limitsCannotBeZero"; msg: "adminModuleLimitsCanNotBeZero"; }, { code: 6011; name: "maxAuthCountReached"; msg: "adminModuleMaxAuthCount"; }, { code: 6012; name: "maxUserClassesReached"; msg: "adminModuleMaxUserClasses"; }, { code: 6013; name: "insufficientBalance"; msg: "userModuleInsufficientBalance"; }, { code: 6014; name: "userSupplyPositionRequired"; msg: "userModuleUserSupplyPositionRequired"; }, { code: 6015; name: "userBorrowPositionRequired"; msg: "userModuleUserBorrowPositionRequired"; }, { code: 6016; name: "claimAccountRequired"; msg: "userModuleClaimAccountRequired"; }, { code: 6017; name: "withdrawToAccountRequired"; msg: "userModuleWithdrawToAccountRequired"; }, { code: 6018; name: "borrowToAccountRequired"; msg: "userModuleBorrowToAccountRequired"; }, { code: 6019; name: "invalidClaimAmount"; msg: "userModuleInvalidClaimAmount"; }, { code: 6020; name: "noAmountToClaim"; msg: "userModuleNoAmountToClaim"; }, { code: 6021; name: "amountNotZero"; msg: "userModuleAmountNotZero"; }, { code: 6022; name: "valueOverflow"; msg: "userModuleValueOverflow"; }, { code: 6023; name: "invalidTransferType"; msg: "userModuleInvalidTransferType"; }, { code: 6024; name: "mintMismatch"; msg: "userModuleMintMismatch"; }, { code: 6025; name: "userNotDefined"; msg: "userModuleUserNotDefined"; }, { code: 6026; name: "invalidUserClaim"; msg: "userModuleInvalidUserClaim"; }, { code: 6027; name: "userPaused"; msg: "userModuleUserPaused"; }, { code: 6028; name: "withdrawalLimitReached"; msg: "userModuleWithdrawalLimitReached"; }, { code: 6029; name: "borrowLimitReached"; msg: "userModuleBorrowLimitReached"; }, { code: 6030; name: "operateAmountsNearlyZero"; msg: "userModuleOperateAmountsZero"; }, { code: 6031; name: "operateAmountTooBig"; msg: "userModuleOperateAmountsTooBig"; }, { code: 6032; name: "operateAmountsInsufficient"; msg: "userModuleOperateAmountsInsufficient"; }, { code: 6033; name: "transferAmountOutOfBounds"; msg: "userModuleTransferAmountOutOfBounds"; }, { code: 6034; name: "forbiddenOperateCall"; msg: "forbiddenOperateCall"; }, { code: 6035; name: "maxUtilizationReached"; msg: "userModuleMaxUtilizationReached"; }, { code: 6036; name: "valueOverflowTotalSupply"; msg: "userModuleValueOverflowTotalSupply"; }, { code: 6037; name: "valueOverflowTotalBorrow"; msg: "userModuleValueOverflowTotalBorrow"; }, { code: 6038; name: "depositExpected"; msg: "userModuleDepositExpected"; }, { code: 6039; name: "exchangePriceZero"; msg: "liquidityCalcsExchangePriceZero"; }, { code: 6040; name: "unsupportedRateVersion"; msg: "liquidityCalcsUnsupportedRateVersion"; }, { code: 6041; name: "borrowRateNegative"; msg: "liquidityCalcsBorrowRateNegative"; }, { code: 6042; name: "protocolLockdown"; msg: "protocolLockdown"; }, { code: 6043; name: "tokenLockDown"; msg: "tokenLockedDown"; }, { code: 6044; name: "tokenAlreadyLocked"; msg: "tokenAlreadyLocked"; }, { code: 6045; name: "tokenAlreadyUnlocked"; msg: "tokenAlreadyUnlocked"; }, { code: 6046; name: "operateSkipTransferInvalid"; msg: "userModuleOperateSkipTransferInvalid"; } ]; types: [ { name: "addressBool"; type: { kind: "struct"; fields: [ { name: "addr"; type: "pubkey"; }, { name: "value"; type: "bool"; } ]; }; }, { name: "addressU8"; type: { kind: "struct"; fields: [ { name: "addr"; type: "pubkey"; }, { name: "value"; type: "u8"; } ]; }; }, { name: "authorizationList"; type: { kind: "struct"; fields: [ { name: "authUsers"; type: { vec: "pubkey"; }; }, { name: "guardians"; type: { vec: "pubkey"; }; }, { name: "userClasses"; type: { vec: { defined: { name: "userClass"; }; }; }; } ]; }; }, { name: "liquidity"; type: { kind: "struct"; fields: [ { name: "authority"; type: "pubkey"; }, { name: "revenueCollector"; type: "pubkey"; }, { name: "status"; type: "bool"; }, { name: "bump"; type: "u8"; } ]; }; }, { name: "logBorrowRateCap"; type: { kind: "struct"; fields: [ { name: "token"; type: "pubkey"; } ]; }; }, { name: "logChangeStatus"; type: { kind: "struct"; fields: [ { name: "newStatus"; type: "bool"; } ]; }; }, { name: "logClaim"; type: { kind: "struct"; fields: [ { name: "user"; type: "pubkey"; }, { name: "token"; type: "pubkey"; }, { name: "recipient"; type: "pubkey"; }, { name: "amount"; type: "u64"; } ]; }; }, { name: "logCollectRevenue"; type: { kind: "struct"; fields: [ { name: "token"; type: "pubkey"; }, { name: "revenueAmount"; type: "u128"; } ]; }; }, { name: "logOperate"; type: { kind: "struct"; fields: [ { name: "user"; type: "pubkey"; }, { name: "token"; type: "pubkey"; }, { name: "supplyAmount"; type: "i128"; }, { name: "borrowAmount"; type: "i128"; }, { name: "withdrawTo"; type: "pubkey"; }, { name: "borrowTo"; type: "pubkey"; }, { name: "supplyExchangePrice"; type: "u64"; }, { name: "borrowExchangePrice"; type: "u64"; } ]; }; }, { name: "logPauseUser"; type: { kind: "struct"; fields: [ { name: "user"; type: "pubkey"; }, { name: "mint"; type: "pubkey"; }, { name: "status"; type: "u8"; } ]; }; }, { name: "logTokenLockdown"; type: { kind: "struct"; fields: [ { name: "mint"; type: "pubkey"; }, { name: "suspend"; type: "bool"; } ]; }; }, { name: "logUnpauseUser"; type: { kind: "struct"; fields: [ { name: "user"; type: "pubkey"; }, { name: "mint"; type: "pubkey"; }, { name: "status"; type: "u8"; } ]; }; }, { name: "logUpdateAuthority"; type: { kind: "struct"; fields: [ { name: "newAuthority"; type: "pubkey"; } ]; }; }, { name: "logUpdateAuths"; type: { kind: "struct"; fields: [ { name: "authStatus"; type: { vec: { defined: { name: "addressBool"; }; }; }; } ]; }; }, { name: "logUpdateExchangePrices"; type: { kind: "struct"; fields: [ { name: "token"; type: "pubkey"; }, { name: "supplyExchangePrice"; type: "u128"; }, { name: "borrowExchangePrice"; type: "u128"; }, { name: "borrowRate"; type: "u16"; }, { name: "utilization"; type: "u16"; } ]; }; }, { name: "logUpdateGuardians"; type: { kind: "struct"; fields: [ { name: "guardianStatus"; type: { vec: { defined: { name: "addressBool"; }; }; }; } ]; }; }, { name: "logUpdateRateDataV1"; type: { kind: "struct"; fields: [ { name: "token"; type: "pubkey"; }, { name: "rateData"; type: { defined: { name: "rateDataV1Params"; }; }; } ]; }; }, { name: "logUpdateRateDataV2"; type: { kind: "struct"; fields: [ { name: "token"; type: "pubkey"; }, { name: "rateData"; type: { defined: { name: "rateDataV2Params"; }; }; } ]; }; }, { name: "logUpdateRevenueCollector"; type: { kind: "struct"; fields: [ { name: "revenueCollector"; type: "pubkey"; } ]; }; }, { name: "logUpdateTokenConfigs"; type: { kind: "struct"; fields: [ { name: "tokenConfig"; type: { defined: { name: "tokenConfig"; }; }; } ]; }; }, { name: "logUpdateUserBorrowConfigs"; type: { kind: "struct"; fields: [ { name: "user"; type: "pubkey"; }, { name: "token"; type: "pubkey"; }, { name: "userBorrowConfig"; type: { defined: { name: "userBorrowConfig"; }; }; } ]; }; }, { name: "logUpdateUserClass"; type: { kind: "struct"; fields: [ { name: "userClass"; type: { vec: { defined: { name: "addressU8"; }; }; }; } ]; }; }, { name: "logUpdateUserSupplyConfigs"; type: { kind: "struct"; fields: [ { name: "user"; type: "pubkey"; }, { name: "token"; type: "pubkey"; }, { name: "userSupplyConfig"; type: { defined: { name: "userSupplyConfig"; }; }; } ]; }; }, { name: "logUpdateUserWithdrawalLimit"; type: { kind: "struct"; fields: [ { name: "user"; type: "pubkey"; }, { name: "token"; type: "pubkey"; }, { name: "newLimit"; type: "u128"; } ]; }; }, { name: "rateDataV1Params"; docs: ["@notice struct to set borrow rate data for version 1"]; type: { kind: "struct"; fields: [ { name: "kink"; docs: [ "", "@param kink in borrow rate. in 1e2: 100% = 10_000; 1% = 100" ]; type: "u128"; }, { name: "rateAtUtilizationZero"; docs: [ "", "@param rateAtUtilizationZero desired borrow rate when utilization is zero. in 1e2: 100% = 10_000; 1% = 100", "i.e. constant minimum borrow rate", "e.g. at utilization = 0.01% rate could still be at least 4% (rateAtUtilizationZero would be 400 then)" ]; type: "u128"; }, { name: "rateAtUtilizationKink"; docs: [ "", "@param rateAtUtilizationKink borrow rate when utilization is at kink. in 1e2: 100% = 10_000; 1% = 100", "e.g. when rate should be 7% at kink then rateAtUtilizationKink would be 700" ]; type: "u128"; }, { name: "rateAtUtilizationMax"; docs: [ "", "@param rateAtUtilizationMax borrow rate when utilization is maximum at 100%. in 1e2: 100% = 10_000; 1% = 100", "e.g. when rate should be 125% at 100% then rateAtUtilizationMax would be 12_500" ]; type: "u128"; } ]; }; }, { name: "rateDataV2Params"; docs: ["@notice struct to set borrow rate data for version 2"]; type: { kind: "struct"; fields: [ { name: "kink1"; docs: [ "", "@param kink1 first kink in borrow rate. in 1e2: 100% = 10_000; 1% = 100", "utilization below kink 1 usually means slow increase in rate, once utilization is above kink 1 borrow rate increases faster" ]; type: "u128"; }, { name: "kink2"; docs: [ "", "@param kink2 second kink in borrow rate. in 1e2: 100% = 10_000; 1% = 100", "utilization below kink 2 usually means slow / medium increase in rate, once utilization is above kink 2 borrow rate increases fast" ]; type: "u128"; }, { name: "rateAtUtilizationZero"; docs: [ "", "@param rateAtUtilizationZero desired borrow rate when utilization is zero. in 1e2: 100% = 10_000; 1% = 100", "i.e. constant minimum borrow rate", "e.g. at utilization = 0.01% rate could still be at least 4% (rateAtUtilizationZero would be 400 then)" ]; type: "u128"; }, { name: "rateAtUtilizationKink1"; docs: [ "", "@param rateAtUtilizationKink1 desired borrow rate when utilization is at first kink. in 1e2: 100% = 10_000; 1% = 100", "e.g. when rate should be 7% at first kink then rateAtUtilizationKink would be 700" ]; type: "u128"; }, { name: "rateAtUtilizationKink2"; docs: [ "", "@param rateAtUtilizationKink2 desired borrow rate when utilization is at second kink. in 1e2: 100% = 10_000; 1% = 100", "e.g. when rate should be 7% at second kink then rateAtUtilizationKink would be 1_200" ]; type: "u128"; }, { name: "rateAtUtilizationMax"; docs: [ "", "@param rateAtUtilizationMax desired borrow rate when utilization is maximum at 100%. in 1e2: 100% = 10_000; 1% = 100", "e.g. when rate should be 125% at 100% then rateAtUtilizationMax would be 12_500" ]; type: "u128"; } ]; }; }, { name: "rateModel"; docs: ["Interest rate model data"]; serialization: "bytemuck"; repr: { kind: "c"; packed: true; }; type: { kind: "struct"; fields: [ { name: "mint"; type: "pubkey"; }, { name: "version"; type: "u8"; }, { name: "rateAtZero"; type: "u16"; }, { name: "kink1Utilization"; type: "u16"; }, { name: "rateAtKink1"; type: "u16"; }, { name: "rateAtMax"; type: "u16"; }, { name: "kink2Utilization"; type: "u16"; }, { name: "rateAtKink2"; type: "u16"; } ]; }; }, { name: "tokenConfig"; docs: ["@notice struct to set token config"]; type: { kind: "struct"; fields: [ { name: "token"; docs: ["", "@param token address"]; type: "pubkey"; }, { name: "fee"; docs: [ "", "@param fee charges on borrower's interest. in 1e2: 100% = 10_000; 1% = 100" ]; type: "u128"; }, { name: "maxUtilization"; docs: [ "", "@param maxUtilization maximum allowed utilization. in 1e2: 100% = 10_000; 1% = 100", "set to 100% to disable and have default limit of 100% (avoiding SLOAD)." ]; type: "u128"; } ]; }; }, { name: "tokenReserve"; docs: ["Token configuration and exchange prices"]; serialization: "bytemuck"; repr: { kind: "c"; packed: true; }; type: { kind: "struct"; fields: [ { name: "mint"; type: "pubkey"; }, { name: "vault"; type: "pubkey"; }, { name: "borrowRate"; type: "u16"; }, { name: "feeOnInterest"; type: "u16"; }, { name: "lastUtilization"; type: "u16"; }, { name: "lastUpdateTimestamp"; type: "u64"; }, { name: "supplyExchangePrice"; type: "u64"; }, { name: "borrowExchangePrice"; type: "u64"; }, { name: "maxUtilization"; type: "u16"; }, { name: "totalSupplyWithInterest"; type: "u64"; }, { name: "totalSupplyInterestFree"; type: "u64"; }, { name: "totalBorrowWithInterest"; type: "u64"; }, { name: "totalBorrowInterestFree"; type: "u64"; }, { name: "totalClaimAmount"; type: "u64"; }, { name: "interactingProtocol"; type: "pubkey"; }, { name: "interactingTimestamp"; type: "u64"; }, { name: "interactingBalance"; type: "u64"; } ]; }; }, { name: "transferType"; type: { kind: "enum"; variants: [ { name: "skip"; }, { name: "direct"; }, { name: "claim"; } ]; }; }, { name: "userBorrowConfig"; docs: ["@notice struct to set user borrow & payback config"]; type: { kind: "struct"; fields: [ { name: "mode"; docs: ["", "@param mode: 0 = without interest. 1 = with interest"]; type: "u8"; }, { name: "expandPercent"; docs: [ "", "@param expandPercent debt limit expand percent. in 1e2: 100% = 10_000; 1% = 100", "Also used to calculate rate at which debt limit should decrease (instant)." ]; type: "u128"; }, { name: "expandDuration"; docs: [ "", "@param expandDuration debt limit expand duration in seconds.", "used to calculate rate together with expandPercent" ]; type: "u128"; }, { name: "baseDebtCeiling"; docs: [ "", "@param baseDebtCeiling base borrow limit. until here, borrow limit remains as baseDebtCeiling", "(user can borrow until this point at once without stepped expansion). Above this, automated limit comes in place.", "amount in raw (to be multiplied with exchange price) or normal depends on configured mode in user config for the token:", "with interest -> raw, without interest -> normal" ]; type: "u128"; }, { name: "maxDebtCeiling"; docs: [ "", "@param maxDebtCeiling max borrow ceiling, maximum amount the user can borrow.", "amount in raw (to be multiplied with exchange price) or normal depends on configured mode in user config for the token:", "with interest -> raw, without interest -> normal" ]; type: "u128"; } ]; }; }, { name: "userBorrowPosition"; docs: ["User borrow position"]; serialization: "bytemuck"; repr: { kind: "c"; packed: true; }; type: { kind: "struct"; fields: [ { name: "protocol"; type: "pubkey"; }, { name: "mint"; type: "pubkey"; }, { name: "withInterest"; type: "u8"; }, { name: "amount"; type: "u64"; }, { name: "debtCeiling"; type: "u64"; }, { name: "lastUpdate"; type: "u64"; }, { name: "expandPct"; type: "u16"; }, { name: "expandDuration"; type: "u32"; }, { name: "baseDebtCeiling"; type: "u64"; }, { name: "maxDebtCeiling"; type: "u64"; }, { name: "status"; type: "u8"; } ]; }; }, { name: "userClaim"; serialization: "bytemuck"; repr: { kind: "c"; packed: true; }; type: { kind: "struct"; fields: [ { name: "user"; type: "pubkey"; }, { name: "amount"; type: "u64"; }, { name: "mint"; type: "pubkey"; } ]; }; }, { name: "userClass"; type: { kind: "struct"; fields: [ { name: "addr"; type: "pubkey"; }, { name: "class"; type: "u8"; } ]; }; }, { name: "userSupplyConfig"; docs: ["@notice struct to set user supply & withdrawal config"]; type: { kind: "struct"; fields: [ { name: "mode"; docs: ["", "@param mode: 0 = without interest. 1 = with interest"]; type: "u8"; }, { name: "expandPercent"; docs: [ "", "@param expandPercent withdrawal limit expand percent. in 1e2: 100% = 10_000; 1% = 100", "Also used to calculate rate at which withdrawal limit should decrease (instant)." ]; type: "u128"; }, { name: "expandDuration"; docs: [ "", "@param expandDuration withdrawal limit expand duration in seconds.", "used to calculate rate together with expandPercent" ]; type: "u128"; }, { name: "baseWithdrawalLimit"; docs: [ "", "@param baseWithdrawalLimit base limit, below this, user can withdraw the entire amount.", "amount in raw (to be multiplied with exchange price) or normal depends on configured mode in user config for the token:", "with interest -> raw, without interest -> normal" ]; type: "u128"; } ]; }; }, { name: "userSupplyPosition"; docs: ["User supply position"]; serialization: "bytemuck"; repr: { kind: "c"; packed: true; }; type: { kind: "struct"; fields: [ { name: "protocol"; type: "pubkey"; }, { name: "mint"; type: "pubkey"; }, { name: "withInterest"; type: "u8"; }, { name: "amount"; type: "u64"; }, { name: "withdrawalLimit"; type: "u64"; }, { name: "decayAmount"; type: "u64"; }, { name: "lastUpdate"; type: "u64"; }, { name: "expandPct"; type: "u16"; }, { name: "expandDuration"; type: "u32"; }, { name: "decayDuration"; type: "u32"; }, { name: "baseWithdrawalLimit"; type: "u64"; }, { name: "status"; type: "u8"; } ]; }; } ]; }; declare const JUP_LEND_IDL: JupLend; type JupLendIdlType = JupLend; declare const JUP_LIQUIDITY_IDL: Liquidity; type JupLiquidityIdlType = Liquidity; declare function jupLendingStateRawToDto(raw: JupLendingState): JupLendingStateJSON; declare function jupTokenReserveRawToDto(raw: JupTokenReserve): JupTokenReserveJSON; declare function jupLendingRewardsRateModelRawToDto(raw: JupLendingRewardsRateModel): JupLendingRewardsRateModelJSON; declare function jupRateModelRawToDto(raw: JupRateModel): JupRateModelJSON; declare function decodeJupLendingStateData(data: Buffer, pubkey: PublicKey): JupLendingStateRaw; declare function decodeJupLendingRewardsRateModelData(data: Buffer, pubkey: PublicKey): JupLendingRewardsRateModelRaw; /** * Decode a TokenReserve account from raw buffer data. * TokenReserve uses bytemuck (packed C repr) — manual fixed-offset reads. * Layout (after 8-byte discriminator): * mint[32] vault[32] borrow_rate[2] fee_on_interest[2] last_utilization[2] * last_update_timestamp[8] supply_exchange_price[8] borrow_exchange_price[8] * max_utilization[2] total_supply_with_interest[8] total_supply_interest_free[8] * total_borrow_with_interest[8] total_borrow_interest_free[8] total_claim_amount[8] * interacting_protocol[32] interacting_timestamp[8] interacting_balance[8] */ declare function decodeJupTokenReserveData(data: Buffer, pubkey: PublicKey): JupTokenReserveRaw; /** * Decode a RateModel account from raw buffer data. * RateModel uses bytemuck (packed C repr) — manual fixed-offset reads. * Layout (after 8-byte discriminator): * mint[32] version[1] rate_at_zero[2] kink1_utilization[2] * rate_at_kink1[2] rate_at_max[2] kink2_utilization[2] rate_at_kink2[2] */ declare function decodeJupRateModelData(data: Buffer, pubkey: PublicKey): JupRateModelRaw; declare function dtoToJupLendingStateRaw(dto: JupLendingStateJSON): JupLendingState; declare function dtoToJupTokenReserveRaw(dto: JupTokenReserveJSON): JupTokenReserve; declare function dtoToJupLendingRewardsRateModelRaw(dto: JupLendingRewardsRateModelJSON): JupLendingRewardsRateModel; declare function dtoToJupRateModelRaw(dto: JupRateModelJSON): JupRateModel; declare const SEED_LENDING_ADMIN = "lending_admin"; declare const SEED_F_TOKEN_MINT = "f_token_mint"; declare const SEED_LENDING = "lending"; declare const SEED_LIQUIDITY = "liquidity"; declare const SEED_RESERVE = "reserve"; declare const SEED_RATE_MODEL = "rate_model"; declare const SEED_USER_SUPPLY_POSITION = "user_supply_position"; declare const SEED_USER_CLAIM = "user_claim"; declare const SEED_LENDING_REWARDS_RATE_MODEL = "lending_rewards_rate_model"; declare function getAllDerivedJupLendAccounts(mint: PublicKey, tokenProgram?: PublicKey): { fTokenMint: PublicKey; lendingAdmin: PublicKey; supplyTokenReservesLiquidity: PublicKey; lendingSupplyPositionOnLiquidity: PublicKey; rateModel: PublicKey; vault: PublicKey; liquidity: PublicKey; rewardsRateModel: PublicKey; }; declare function deriveJupLendLendingPdas(underlyingMint: PublicKey, lendingProgramId?: PublicKey): { lendingAdmin: PublicKey; lendingAdminBump: number; fTokenMint: PublicKey; fTokenMintBump: number; lending: PublicKey; lendingBump: number; }; /** * Derive the fToken mint PDA for a given asset. * Seeds: ["f_token_mint", asset] */ declare function deriveJupLendFTokenMint(asset: PublicKey, lendingProgramId?: PublicKey): [PublicKey, number]; /** * Derive the Lending state PDA for a given asset. * Seeds: ["lending", asset, fTokenMint] */ declare function deriveJupLendLending(asset: PublicKey, fTokenMint?: PublicKey, lendingProgramId?: PublicKey): [PublicKey, number]; /** * Derive the LendingAdmin PDA (singleton). * Seeds: ["lending_admin"] */ declare function deriveJupLendLendingAdmin(lendingProgramId?: PublicKey): [PublicKey, number]; /** * Derive the LendingRewardsRateModel PDA for a given asset. * Seeds: ["lending_rewards_rate_model", asset] * Note: This PDA lives on the rewards program, not the lending program. */ declare function deriveJupLendLendingRewardsRateModel(asset: PublicKey, rewardsProgramId?: PublicKey): [PublicKey, number]; /** * Derive the TokenReserve PDA for a given asset on the liquidity layer. * Seeds: ["reserve", asset] */ declare function deriveJupLendTokenReserve(asset: PublicKey, liquidityProgramId?: PublicKey): [PublicKey, number]; declare function deriveJupLendLiquidityVaultAta(underlyingMint: PublicKey, liquidityPda: PublicKey, tokenProgramId?: PublicKey): PublicKey; /** * Derive the interest rate model PDA for a given asset on the liquidity layer. * Seeds: ["rate_model", asset] */ declare function deriveJupLendRateModel(asset: PublicKey, liquidityProgramId?: PublicKey): [PublicKey, number]; /** * Derive the global Liquidity state PDA (singleton). * Seeds: ["liquidity"] */ declare function deriveJupLendLiquidity(liquidityProgramId?: PublicKey): [PublicKey, number]; /** * Derive the claim account PDA for a given owner and mint on the liquidity program. * Seeds: ["user_claim", owner, mint] */ declare function deriveJupLendClaimAccount(owner: PublicKey, mint: PublicKey, liquidityProgramId?: PublicKey): [PublicKey, number]; declare function deriveJupLendLiquiditySupplyPositionPda(underlyingMint: PublicKey, lendingPda: PublicKey, liquidityProgramId?: PublicKey): [PublicKey, number]; /** * Jup-Lend Interest Rate & Exchange Price Utilities * * Extracted from the compiled @jup-ag/lend SDK (earn/index.mjs). * All functions work on pre-fetched state — no RPC calls. */ declare const JUP_EXCHANGE_PRICES_PRECISION: BN; declare const JUP_SECONDS_PER_YEAR: BN; declare const JUP_MAX_REWARDS_RATE: BN; /** * Calculate total assets for a jup-lend market. * Formula: tokenExchangePrice * fTokenTotalSupply / EXCHANGE_PRICES_PRECISION * * @param lendingState - The on-chain Lending account * @param fTokenTotalSupply - Total supply of the fToken (from getTokenSupply) * @returns Total assets as BN in underlying token lamports */ declare function calculateJupLendTotalAssets(lendingState: JupLendingState, fTokenTotalSupply: BN): BN; interface JupLendRewardsResult { rewardsRate: BN; rewardsEnded: boolean; rewardsStartTime: BN; } /** * Calculate the rewards rate from a LendingRewardsRateModel. * Extracted from compiled SDK's `calculateRewardsRate`. * * @param rewardsModel - The on-chain LendingRewardsRateModel account * @param totalAssets - Total assets in the market (from calculateJupLendTotalAssets) * @param currentTimestamp - Current unix timestamp (seconds) * @returns Rewards rate, whether rewards ended, and start time */ declare function calculateJupLendRewardsRate(rewardsModel: JupLendingRewardsRateModel, totalAssets: BN, currentTimestamp: BN): JupLendRewardsResult; /** * Calculate the rewards rate at 1e12 precision for use in exchange price projection. * Mirrors SDK's `getRewardsRate` (earn/index.mjs line 261), NOT `calculateRewardsRate`. * * This is distinct from `calculateJupLendRewardsRate` which uses 1e4 precision for APR display. * * @param rewardsModel - The on-chain LendingRewardsRateModel account * @param totalAssets - Total assets in the market (from calculateJupLendTotalAssets) * @param currentTimestamp - Current unix timestamp (seconds) * @returns Rate at 1e12 precision and rewards start time */ declare function calculateJupLendRewardsRateForExchangePrice(rewardsModel: JupLendingRewardsRateModel, totalAssets: BN, currentTimestamp: BN): { rate: BN; rewardsStartTime: BN; }; /** * Project the new token exchange price offline (no RPC calls). * Extracted from compiled SDK's `getNewExchangePrice` (earn/index.mjs line 316). * * This combines: * 1. Rewards rate contribution (time-weighted, 1e12 precision via getRewardsRate) * 2. Liquidity exchange price delta (scaled to 1e14) * * Both components are accumulated in 1e14 space before being applied. * * @param lendingState - The on-chain Lending account * @param tokenReserve - The on-chain TokenReserve account (provides current supplyExchangePrice) * @param rewardsModel - The on-chain LendingRewardsRateModel (or null if no rewards) * @param fTokenTotalSupply - Total supply of the fToken (for totalAssets calculation) * @param currentTimestamp - Current unix timestamp (seconds) * @returns Projected token exchange price as BN (1e12 precision) */ declare function calculateJupLendNewExchangePrice(lendingState: JupLendingState, tokenReserve: JupTokenReserve, rewardsModel: JupLendingRewardsRateModel | null, fTokenTotalSupply: BN, currentTimestamp: BN): BN; /** * Calculate the liquidity layer supply rate for an asset. * Extracted from compiled SDK's `getLiquidityAssetSupplyRate`. * * Formula: borrowRate * (1 - fee) * borrowWithInterest / supplyWithInterest * * @param tokenReserve - The on-chain TokenReserve account * @returns Supply rate as BN (in bps-like precision from the liquidity layer) */ declare function calculateJupLendLiquiditySupplyRate(tokenReserve: JupTokenReserve): BN; /** * Calculate the total supply rate (APR) for a jup-lend market, * combining both base liquidity supply rate and rewards rate. * * Returns a number as a decimal (e.g. 0.05 = 5% APR). * * @param lendingState - The on-chain Lending account * @param tokenReserve - The on-chain TokenReserve account * @param rewardsModel - The on-chain LendingRewardsRateModel account (or null if no rewards) * @param fTokenTotalSupply - Total supply of the fToken * @returns Supply rate as decimal number */ declare function calculateJupLendSupplyRate(lendingState: JupLendingState, tokenReserve: JupTokenReserve, rewardsModel: JupLendingRewardsRateModel | null, fTokenTotalSupply: BN): number; /** * Calculate the supply APY for a jup-lend market (base rate only, no rewards). * * Uses hourly compounding: (1 + apr/HOURS_PER_YEAR)^HOURS_PER_YEAR - 1 * * @param tokenReserve - The on-chain TokenReserve account * @returns Supply APY as decimal (e.g. 0.0512 = 5.12% APY) */ declare function calculateJupLendSupplyAPY(tokenReserve: JupTokenReserve): number; /** * Calculate the borrow rate at a given utilization using the on-chain RateModel. * * V1 (version=1, single kink): * [0, kink1] → linear rateAtZero → rateAtKink1 * [kink1, 10000] → linear rateAtKink1 → rateAtMax * * V2 (version=2, dual kink): * [0, kink1] → linear rateAtZero → rateAtKink1 * [kink1, kink2] → linear rateAtKink1 → rateAtKink2 * [kink2, 10000] → linear rateAtKink2 → rateAtMax * * @param rateModel - The on-chain RateModel account * @param utilizationBps - Utilization in bps (0–10000) * @returns Borrow rate in bps */ declare function calculateJupLendBorrowRate(rateModel: JupRateModel, utilizationBps: number): number; /** * Interest rate curve point for visualization (supply only). */ interface JupLendInterestRateCurvePoint { utilization: number; supplyAPY: number; } /** * Generate a supply interest rate curve for a JupLend reserve using the on-chain RateModel. * * Uses the piecewise linear borrow rate curve from the RateModel account: * borrowAPR(U) = calculateJupLendBorrowRate(rateModel, U * 10000) * supplyAPR(U) = borrowAPR(U) * (1 - feeOnInterest / 1e4) * U * supplyAPY(U) = aprToApy(supplyAPR(U)) * * @param rateModel - The on-chain RateModel account (from liquidity program) * @param feeOnInterest - Fee on interest in bps (from TokenReserve.feeOnInterest) * @returns 101 curve points (utilization 0–100%) */ declare function generateJupLendSupplyCurve(rateModel: JupRateModel, feeOnInterest: number): JupLendInterestRateCurvePoint[]; /** * Calculate the rewards info for a jup-lend market from pre-fetched state. * * @param lendingState - The on-chain Lending account * @param rewardsModel - The on-chain LendingRewardsRateModel account * @param fTokenTotalSupply - Total supply of the fToken * @returns Rewards result with rate, ended flag, and start time */ declare function getJupLendRewards(lendingState: JupLendingState, rewardsModel: JupLendingRewardsRateModel, fTokenTotalSupply: BN): JupLendRewardsResult; declare const makeUpdateJupLendRateIx: (lending: PublicKey, mint: PublicKey, fTokenMint: PublicKey, supplyTokenReservesLiquidity: PublicKey, rewardsRateModel: PublicKey) => TransactionInstruction; type MakeUpdateJupLendRateParams = { lendingState: JupLendingState; }; declare function makeUpdateJupLendRate({ lendingState }: MakeUpdateJupLendRateParams): _solana_web3_js.TransactionInstruction; /** * Program IDL in camelCase format in order to be used in JS/TS. * * Note that this is only a type helper and is not the actual IDL. The original * IDL can be found at `target/idl/farms.json`. */ type Farms = { address: "FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr"; metadata: { name: "farms"; version: "0.1.0"; spec: "0.1.0"; }; instructions: [ { name: "initializeGlobalConfig"; discriminator: [113, 216, 122, 131, 225, 209, 22, 55]; accounts: [ { name: "globalAdmin"; writable: true; signer: true; }, { name: "globalConfig"; writable: true; }, { name: "treasuryVaultsAuthority"; }, { name: "systemProgram"; } ]; args: []; }, { name: "updateGlobalConfig"; discriminator: [164, 84, 130, 189, 111, 58, 250, 200]; accounts: [ { name: "globalAdmin"; signer: true; }, { name: "globalConfig"; writable: true; } ]; args: [ { name: "mode"; type: "u8"; }, { name: "value"; type: { array: ["u8", 32]; }; } ]; }, { name: "initializeFarm"; discriminator: [252, 28, 185, 172, 244, 74, 117, 165]; accounts: [ { name: "farmAdmin"; writable: true; signer: true; }, { name: "farmState"; writable: true; }, { name: "globalConfig"; }, { name: "farmVault"; writable: true; }, { name: "farmVaultsAuthority"; }, { name: "tokenMint"; }, { name: "tokenProgram"; }, { name: "systemProgram"; }, { name: "rent"; } ]; args: []; }, { name: "initializeFarmDelegated"; discriminator: [250, 84, 101, 25, 51, 77, 204, 91]; accounts: [ { name: "farmAdmin"; writable: true; signer: true; }, { name: "farmDelegate"; signer: true; }, { name: "farmState"; writable: true; }, { name: "globalConfig"; }, { name: "farmVaultsAuthority"; }, { name: "systemProgram"; }, { name: "rent"; } ]; args: []; }, { name: "initializeReward"; discriminator: [95, 135, 192, 196, 242, 129, 230, 68]; accounts: [ { name: "farmAdmin"; writable: true; signer: true; }, { name: "farmState"; writable: true; }, { name: "globalConfig"; }, { name: "rewardMint"; }, { name: "rewardVault"; writable: true; }, { name: "rewardTreasuryVault"; writable: true; }, { name: "farmVaultsAuthority"; }, { name: "treasuryVaultsAuthority"; }, { name: "tokenProgram"; }, { name: "systemProgram"; }, { name: "rent"; } ]; args: []; }, { name: "addRewards"; discriminator: [88, 186, 25, 227, 38, 137, 81, 23]; accounts: [ { name: "payer"; writable: true; signer: true; }, { name: "farmState"; writable: true; }, { name: "rewardMint"; }, { name: "rewardVault"; writable: true; }, { name: "farmVaultsAuthority"; }, { name: "payerRewardTokenAta"; writable: true; }, { name: "scopePrices"; optional: true; }, { name: "tokenProgram"; } ]; args: [ { name: "amount"; type: "u64"; }, { name: "rewardIndex"; type: "u64"; } ]; }, { name: "updateFarmConfig"; discriminator: [214, 176, 188, 244, 203, 59, 230, 207]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "farmState"; writable: true; }, { name: "scopePrices"; optional: true; } ]; args: [ { name: "mode"; type: "u16"; }, { name: "data"; type: "bytes"; } ]; }, { name: "initializeUser"; discriminator: [111, 17, 185, 250, 60, 122, 38, 254]; accounts: [ { name: "authority"; signer: true; }, { name: "payer"; writable: true; signer: true; }, { name: "owner"; }, { name: "delegatee"; }, { name: "userState"; writable: true; }, { name: "farmState"; writable: true; }, { name: "systemProgram"; }, { name: "rent"; } ]; args: []; }, { name: "transferOwnership"; discriminator: [65, 177, 215, 73, 53, 45, 99, 47]; accounts: [ { name: "owner"; signer: true; }, { name: "userState"; writable: true; } ]; args: [ { name: "newOwner"; type: "pubkey"; } ]; }, { name: "rewardUserOnce"; discriminator: [219, 137, 57, 22, 94, 186, 96, 114]; accounts: [ { name: "farmAdmin"; writable: true; signer: true; }, { name: "farmState"; writable: true; }, { name: "userState"; writable: true; } ]; args: [ { name: "rewardIndex"; type: "u64"; }, { name: "amount"; type: "u64"; } ]; }, { name: "refreshFarm"; discriminator: [214, 131, 138, 183, 144, 194, 172, 42]; accounts: [ { name: "farmState"; writable: true; }, { name: "scopePrices"; optional: true; } ]; args: []; }, { name: "stake"; discriminator: [206, 176, 202, 18, 200, 209, 179, 108]; accounts: [ { name: "owner"; signer: true; }, { name: "userState"; writable: true; }, { name: "farmState"; writable: true; }, { name: "farmVault"; writable: true; }, { name: "userAta"; writable: true; }, { name: "tokenMint"; }, { name: "scopePrices"; optional: true; }, { name: "tokenProgram"; } ]; args: [ { name: "amount"; type: "u64"; } ]; }, { name: "setStakeDelegated"; discriminator: [73, 171, 184, 75, 30, 56, 198, 223]; accounts: [ { name: "delegateAuthority"; signer: true; }, { name: "userState"; writable: true; }, { name: "farmState"; writable: true; } ]; args: [ { name: "newAmount"; type: "u64"; } ]; }, { name: "harvestReward"; discriminator: [68, 200, 228, 233, 184, 32, 226, 188]; accounts: [ { name: "owner"; writable: true; signer: true; }, { name: "userState"; writable: true; }, { name: "farmState"; writable: true; }, { name: "globalConfig"; }, { name: "rewardMint"; }, { name: "userRewardAta"; writable: true; }, { name: "rewardsVault"; writable: true; }, { name: "rewardsTreasuryVault"; writable: true; }, { name: "farmVaultsAuthority"; }, { name: "scopePrices"; optional: true; }, { name: "tokenProgram"; } ]; args: [ { name: "rewardIndex"; type: "u64"; } ]; }, { name: "unstake"; discriminator: [90, 95, 107, 42, 205, 124, 50, 225]; accounts: [ { name: "owner"; writable: true; signer: true; }, { name: "userState"; writable: true; }, { name: "farmState"; writable: true; }, { name: "scopePrices"; optional: true; } ]; args: [ { name: "stakeSharesScaled"; type: "u128"; } ]; }, { name: "refreshUserState"; discriminator: [1, 135, 12, 62, 243, 140, 77, 108]; accounts: [ { name: "userState"; writable: true; }, { name: "farmState"; writable: true; }, { name: "scopePrices"; optional: true; } ]; args: []; }, { name: "withdrawUnstakedDeposits"; discriminator: [36, 102, 187, 49, 220, 36, 132, 67]; accounts: [ { name: "owner"; writable: true; signer: true; }, { name: "userState"; writable: true; }, { name: "farmState"; writable: true; }, { name: "userAta"; writable: true; }, { name: "farmVault"; writable: true; }, { name: "farmVaultsAuthority"; }, { name: "tokenProgram"; } ]; args: []; }, { name: "withdrawTreasury"; discriminator: [40, 63, 122, 158, 144, 216, 83, 96]; accounts: [ { name: "globalAdmin"; writable: true; signer: true; }, { name: "globalConfig"; }, { name: "rewardMint"; }, { name: "rewardTreasuryVault"; writable: true; }, { name: "treasuryVaultAuthority"; }, { name: "withdrawDestinationTokenAccount"; writable: true; }, { name: "tokenProgram"; } ]; args: [ { name: "amount"; type: "u64"; } ]; }, { name: "depositToFarmVault"; discriminator: [131, 166, 64, 94, 108, 213, 114, 183]; accounts: [ { name: "depositor"; signer: true; }, { name: "farmState"; writable: true; }, { name: "farmVault"; writable: true; }, { name: "depositorAta"; writable: true; }, { name: "tokenProgram"; } ]; args: [ { name: "amount"; type: "u64"; } ]; }, { name: "withdrawFromFarmVault"; discriminator: [22, 82, 128, 250, 86, 79, 124, 78]; accounts: [ { name: "withdrawAuthority"; writable: true; signer: true; }, { name: "farmState"; writable: true; }, { name: "withdrawerTokenAccount"; writable: true; }, { name: "farmVault"; writable: true; }, { name: "farmVaultsAuthority"; }, { name: "tokenProgram"; } ]; args: [ { name: "amount"; type: "u64"; } ]; }, { name: "withdrawSlashedAmount"; discriminator: [202, 217, 67, 74, 172, 22, 140, 216]; accounts: [ { name: "crank"; writable: true; signer: true; }, { name: "farmState"; writable: true; }, { name: "slashedAmountSpillAddress"; writable: true; }, { name: "farmVault"; writable: true; }, { name: "farmVaultsAuthority"; }, { name: "tokenProgram"; } ]; args: []; }, { name: "updateFarmAdmin"; discriminator: [20, 37, 136, 19, 122, 239, 36, 130]; accounts: [ { name: "pendingFarmAdmin"; writable: true; signer: true; }, { name: "farmState"; writable: true; } ]; args: []; }, { name: "updateGlobalConfigAdmin"; discriminator: [184, 87, 23, 193, 156, 238, 175, 119]; accounts: [ { name: "pendingGlobalAdmin"; signer: true; }, { name: "globalConfig"; writable: true; } ]; args: []; }, { name: "withdrawReward"; discriminator: [191, 187, 176, 137, 9, 25, 187, 244]; accounts: [ { name: "farmAdmin"; writable: true; signer: true; }, { name: "farmState"; writable: true; }, { name: "rewardMint"; }, { name: "rewardVault"; writable: true; }, { name: "farmVaultsAuthority"; }, { name: "adminRewardTokenAta"; writable: true; }, { name: "scopePrices"; optional: true; }, { name: "tokenProgram"; } ]; args: [ { name: "amount"; type: "u64"; }, { name: "rewardIndex"; type: "u64"; } ]; }, { name: "updateSecondDelegatedAuthority"; discriminator: [127, 26, 6, 181, 203, 248, 117, 64]; accounts: [ { name: "globalAdmin"; writable: true; signer: true; }, { name: "farmState"; writable: true; }, { name: "globalConfig"; }, { name: "newSecondDelegatedAuthority"; } ]; args: []; }, { name: "idlMissingTypes"; discriminator: [130, 80, 38, 153, 80, 212, 182, 253]; accounts: [ { name: "globalAdmin"; signer: true; }, { name: "globalConfig"; writable: true; } ]; args: [ { name: "globalConfigOptionKind"; type: { defined: { name: "globalConfigOption"; }; }; }, { name: "farmConfigOptionKind"; type: { defined: { name: "farmConfigOption"; }; }; }, { name: "timeUnit"; type: { defined: { name: "timeUnit"; }; }; }, { name: "lockingMode"; type: { defined: { name: "lockingMode"; }; }; }, { name: "rewardType"; type: { defined: { name: "rewardType"; }; }; } ]; } ]; accounts: [ { name: "farmState"; discriminator: [198, 102, 216, 74, 63, 66, 163, 190]; }, { name: "globalConfig"; discriminator: [149, 8, 156, 202, 160, 252, 176, 217]; }, { name: "userState"; discriminator: [72, 177, 85, 249, 76, 167, 186, 126]; }, { name: "oraclePrices"; discriminator: [89, 128, 118, 221, 6, 72, 180, 146]; } ]; errors: [ { code: 6000; name: "stakeZero"; msg: "Cannot stake 0 amount"; }, { code: 6001; name: "unstakeZero"; msg: "Cannot unstake 0 amount"; }, { code: 6002; name: "nothingToUnstake"; msg: "Nothing to unstake"; }, { code: 6003; name: "noRewardToHarvest"; msg: "No reward to harvest"; }, { code: 6004; name: "noRewardInList"; msg: "Reward not present in reward list"; }, { code: 6005; name: "rewardAlreadyInitialized"; msg: "Reward already initialized"; }, { code: 6006; name: "maxRewardNumberReached"; msg: "Max number of reward tokens reached"; }, { code: 6007; name: "rewardDoesNotExist"; msg: "Reward does not exist"; }, { code: 6008; name: "wrongRewardVaultAccount"; msg: "Reward vault exists but the account is wrong"; }, { code: 6009; name: "rewardVaultMismatch"; msg: "Reward vault pubkey does not match staking pool vault"; }, { code: 6010; name: "rewardVaultAuthorityMismatch"; msg: "Reward vault authority pubkey does not match staking pool vault"; }, { code: 6011; name: "nothingStaked"; msg: "Nothing staked, cannot collect any rewards"; }, { code: 6012; name: "integerOverflow"; msg: "Integer overflow"; }, { code: 6013; name: "conversionFailure"; msg: "Conversion failure"; }, { code: 6014; name: "unexpectedAccount"; msg: "Unexpected account in instruction"; }, { code: 6015; name: "operationForbidden"; msg: "Operation forbidden"; }, { code: 6016; name: "mathOverflow"; msg: "Mathematical operation with overflow"; }, { code: 6017; name: "minClaimDurationNotReached"; msg: "Minimum claim duration has not been reached"; }, { code: 6018; name: "rewardsVaultHasDelegate"; msg: "Reward vault has a delegate"; }, { code: 6019; name: "rewardsVaultHasCloseAuthority"; msg: "Reward vault has a close authority"; }, { code: 6020; name: "farmVaultHasDelegate"; msg: "Farm vault has a delegate"; }, { code: 6021; name: "farmVaultHasCloseAuthority"; msg: "Farm vault has a close authority"; }, { code: 6022; name: "rewardsTreasuryVaultHasDelegate"; msg: "Reward vault has a delegate"; }, { code: 6023; name: "rewardsTreasuryVaultHasCloseAuthority"; msg: "Reward vault has a close authority"; }, { code: 6024; name: "userAtaRewardVaultMintMissmatch"; msg: "User ata and reward vault have different mints"; }, { code: 6025; name: "userAtaFarmTokenMintMissmatch"; msg: "User ata and farm token have different mints"; }, { code: 6026; name: "tokenFarmTokenMintMissmatch"; msg: "Token mint and farm token have different mints"; }, { code: 6027; name: "rewardAtaRewardMintMissmatch"; msg: "Reward ata mint is different than reward mint"; }, { code: 6028; name: "rewardAtaOwnerNotPayer"; msg: "Reward ata owner is different than payer"; }, { code: 6029; name: "invalidGlobalConfigMode"; msg: "Mode to update global_config is invalid"; }, { code: 6030; name: "rewardIndexOutOfRange"; msg: "Reward Index is higher than number of rewards"; }, { code: 6031; name: "nothingToWithdraw"; msg: "No tokens available to withdraw"; }, { code: 6032; name: "userDelegatedFarmNonDelegatedMissmatch"; msg: "user, user_ref, authority and payer must match for non-delegated farm"; }, { code: 6033; name: "authorityFarmDelegateMissmatch"; msg: "Authority must match farm delegate authority"; }, { code: 6034; name: "farmNotDelegated"; msg: "Farm not delegated, can not set stake"; }, { code: 6035; name: "farmDelegated"; msg: "Operation not allowed for delegated farm"; }, { code: 6036; name: "unstakeNotElapsed"; msg: "Unstake lockup period is not elapsed. Deposit is locked until end of unstake period"; }, { code: 6037; name: "pendingWithdrawalNotWithdrawnYet"; msg: "Pending withdrawal already exist and not withdrawn yet"; }, { code: 6038; name: "depositZero"; msg: "Cannot deposit zero amount directly to farm vault"; }, { code: 6039; name: "invalidConfigValue"; msg: "Invalid config value"; }, { code: 6040; name: "invalidPenaltyPercentage"; msg: "Invalid penalty percentage"; }, { code: 6041; name: "earlyWithdrawalNotAllowed"; msg: "Early withdrawal not allowed"; }, { code: 6042; name: "invalidLockingTimestamps"; msg: "Invalid locking timestamps"; }, { code: 6043; name: "invalidRpsCurvePoint"; msg: "Invalid reward rate curve point"; }, { code: 6044; name: "invalidTimestamp"; msg: "Invalid timestamp"; }, { code: 6045; name: "depositCapReached"; msg: "Deposit cap reached"; }, { code: 6046; name: "missingScopePrices"; msg: "Missing Scope Prices"; }, { code: 6047; name: "scopeOraclePriceTooOld"; msg: "Scope Oracle Price Too Old"; }, { code: 6048; name: "invalidOracleConfig"; msg: "Invalid Oracle Config"; }, { code: 6049; name: "couldNotDeserializeScope"; msg: "Could not deserialize scope"; }, { code: 6050; name: "rewardAtaOwnerNotAdmin"; msg: "Reward ata owner is different than farm admin"; }, { code: 6051; name: "withdrawRewardZeroAvailable"; msg: "Cannot withdraw reward as available amount is zero"; }, { code: 6052; name: "rewardScheduleCurveSet"; msg: "Cannot withdraw reward as reward schedule is set"; }, { code: 6053; name: "unsupportedTokenExtension"; msg: "Cannot initialize farm while having a mint with token22 and requested extensions"; }, { code: 6054; name: "invalidFarmConfigUpdateAuthority"; msg: "Invalid authority for updating farm config"; } ]; types: [ { name: "farmConfigOption"; type: { kind: "enum"; variants: [ { name: "updateRewardRps"; }, { name: "updateRewardMinClaimDuration"; }, { name: "withdrawAuthority"; }, { name: "depositWarmupPeriod"; }, { name: "withdrawCooldownPeriod"; }, { name: "rewardType"; }, { name: "rpsDecimals"; }, { name: "lockingMode"; }, { name: "lockingStartTimestamp"; }, { name: "lockingDuration"; }, { name: "lockingEarlyWithdrawalPenaltyBps"; }, { name: "depositCapAmount"; }, { name: "slashedAmountSpillAddress"; }, { name: "scopePricesAccount"; }, { name: "scopeOraclePriceId"; }, { name: "scopeOracleMaxAge"; }, { name: "updateRewardScheduleCurvePoints"; }, { name: "updatePendingFarmAdmin"; }, { name: "updateStrategyId"; }, { name: "updateDelegatedRpsAdmin"; }, { name: "updateVaultId"; }, { name: "updateExtraDelegatedAuthority"; } ]; }; }, { name: "globalConfigOption"; type: { kind: "enum"; variants: [ { name: "setPendingGlobalAdmin"; }, { name: "setTreasuryFeeBps"; } ]; }; }, { name: "lockingMode"; type: { kind: "enum"; variants: [ { name: "none"; }, { name: "continuous"; }, { name: "withExpiry"; } ]; }; }, { name: "rewardInfo"; type: { kind: "struct"; fields: [ { name: "token"; type: { defined: { name: "tokenInfo"; }; }; }, { name: "rewardsVault"; type: "pubkey"; }, { name: "rewardsAvailable"; type: "u64"; }, { name: "rewardScheduleCurve"; type: { defined: { name: "rewardScheduleCurve"; }; }; }, { name: "minClaimDurationSeconds"; type: "u64"; }, { name: "lastIssuanceTs"; type: "u64"; }, { name: "rewardsIssuedUnclaimed"; type: "u64"; }, { name: "rewardsIssuedCumulative"; type: "u64"; }, { name: "rewardPerShareScaled"; type: "u128"; }, { name: "placeholder0"; type: "u64"; }, { name: "rewardType"; type: "u8"; }, { name: "rewardsPerSecondDecimals"; type: "u8"; }, { name: "padding0"; type: { array: ["u8", 6]; }; }, { name: "padding1"; type: { array: ["u64", 20]; }; } ]; }; }, { name: "rewardPerTimeUnitPoint"; type: { kind: "struct"; fields: [ { name: "tsStart"; type: "u64"; }, { name: "rewardPerTimeUnit"; type: "u64"; } ]; }; }, { name: "rewardScheduleCurve"; type: { kind: "struct"; fields: [ { name: "points"; type: { array: [ { defined: { name: "rewardPerTimeUnitPoint"; }; }, 20 ]; }; } ]; }; }, { name: "rewardType"; type: { kind: "enum"; variants: [ { name: "proportional"; }, { name: "constant"; } ]; }; }, { name: "timeUnit"; type: { kind: "enum"; variants: [ { name: "seconds"; }, { name: "slots"; } ]; }; }, { name: "tokenInfo"; type: { kind: "struct"; fields: [ { name: "mint"; type: "pubkey"; }, { name: "decimals"; type: "u64"; }, { name: "tokenProgram"; type: "pubkey"; }, { name: "padding"; type: { array: ["u64", 6]; }; } ]; }; }, { name: "datedPrice"; type: { kind: "struct"; fields: [ { name: "price"; type: { defined: { name: "price"; }; }; }, { name: "lastUpdatedSlot"; type: "u64"; }, { name: "unixTimestamp"; type: "u64"; }, { name: "reserved"; type: { array: ["u64", 2]; }; }, { name: "reserved2"; type: { array: ["u16", 3]; }; }, { name: "index"; type: "u16"; } ]; }; }, { name: "price"; type: { kind: "struct"; fields: [ { name: "value"; type: "u64"; }, { name: "exp"; type: "u64"; } ]; }; }, { name: "farmState"; type: { kind: "struct"; fields: [ { name: "farmAdmin"; type: "pubkey"; }, { name: "globalConfig"; type: "pubkey"; }, { name: "token"; type: { defined: { name: "tokenInfo"; }; }; }, { name: "rewardInfos"; type: { array: [ { defined: { name: "rewardInfo"; }; }, 10 ]; }; }, { name: "numRewardTokens"; type: "u64"; }, { name: "numUsers"; type: "u64"; }, { name: "totalStakedAmount"; type: "u64"; }, { name: "farmVault"; type: "pubkey"; }, { name: "farmVaultsAuthority"; type: "pubkey"; }, { name: "farmVaultsAuthorityBump"; type: "u64"; }, { name: "delegateAuthority"; type: "pubkey"; }, { name: "timeUnit"; type: "u8"; }, { name: "isFarmFrozen"; type: "u8"; }, { name: "isFarmDelegated"; type: "u8"; }, { name: "padding0"; type: { array: ["u8", 5]; }; }, { name: "withdrawAuthority"; type: "pubkey"; }, { name: "depositWarmupPeriod"; type: "u32"; }, { name: "withdrawalCooldownPeriod"; type: "u32"; }, { name: "totalActiveStakeScaled"; type: "u128"; }, { name: "totalPendingStakeScaled"; type: "u128"; }, { name: "totalPendingAmount"; type: "u64"; }, { name: "slashedAmountCurrent"; type: "u64"; }, { name: "slashedAmountCumulative"; type: "u64"; }, { name: "slashedAmountSpillAddress"; type: "pubkey"; }, { name: "lockingMode"; type: "u64"; }, { name: "lockingStartTimestamp"; type: "u64"; }, { name: "lockingDuration"; type: "u64"; }, { name: "lockingEarlyWithdrawalPenaltyBps"; type: "u64"; }, { name: "depositCapAmount"; type: "u64"; }, { name: "scopePrices"; type: "pubkey"; }, { name: "scopeOraclePriceId"; type: "u64"; }, { name: "scopeOracleMaxAge"; type: "u64"; }, { name: "pendingFarmAdmin"; type: "pubkey"; }, { name: "strategyId"; type: "pubkey"; }, { name: "delegatedRpsAdmin"; type: "pubkey"; }, { name: "vaultId"; type: "pubkey"; }, { name: "secondDelegatedAuthority"; type: "pubkey"; }, { name: "padding"; type: { array: ["u64", 74]; }; } ]; }; }, { name: "globalConfig"; type: { kind: "struct"; fields: [ { name: "globalAdmin"; type: "pubkey"; }, { name: "treasuryFeeBps"; type: "u64"; }, { name: "treasuryVaultsAuthority"; type: "pubkey"; }, { name: "treasuryVaultsAuthorityBump"; type: "u64"; }, { name: "pendingGlobalAdmin"; type: "pubkey"; }, { name: "padding1"; type: { array: ["u128", 126]; }; } ]; }; }, { name: "userState"; type: { kind: "struct"; fields: [ { name: "userId"; type: "u64"; }, { name: "farmState"; type: "pubkey"; }, { name: "owner"; type: "pubkey"; }, { name: "isFarmDelegated"; type: "u8"; }, { name: "padding0"; type: { array: ["u8", 7]; }; }, { name: "rewardsTallyScaled"; type: { array: ["u128", 10]; }; }, { name: "rewardsIssuedUnclaimed"; type: { array: ["u64", 10]; }; }, { name: "lastClaimTs"; type: { array: ["u64", 10]; }; }, { name: "activeStakeScaled"; type: "u128"; }, { name: "pendingDepositStakeScaled"; type: "u128"; }, { name: "pendingDepositStakeTs"; type: "u64"; }, { name: "pendingWithdrawalUnstakeScaled"; type: "u128"; }, { name: "pendingWithdrawalUnstakeTs"; type: "u64"; }, { name: "bump"; type: "u64"; }, { name: "delegatee"; type: "pubkey"; }, { name: "lastStakeTs"; type: "u64"; }, { name: "padding1"; type: { array: ["u64", 50]; }; } ]; }; }, { name: "oraclePrices"; type: { kind: "struct"; fields: [ { name: "oracleMappings"; type: "pubkey"; }, { name: "prices"; type: { array: [ { defined: { name: "datedPrice"; }; }, 512 ]; }; } ]; }; } ]; }; /** * Program IDL in camelCase format in order to be used in JS/TS. * * Note that this is only a type helper and is not the actual IDL. The original * IDL can be found at `target/idl/kamino_lending.json`. */ type KaminoLending = { "address": "KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"; "metadata": { "name": "kaminoLending"; "version": "1.11.0"; "spec": "0.1.0"; }; "instructions": [ { "name": "initLendingMarket"; "discriminator": [ 34, 162, 116, 14, 101, 137, 94, 239 ]; "accounts": [ { "name": "lendingMarketOwner"; "writable": true; "signer": true; }, { "name": "lendingMarket"; "writable": true; }, { "name": "lendingMarketAuthority"; }, { "name": "systemProgram"; }, { "name": "rent"; } ]; "args": [ { "name": "quoteCurrency"; "type": { "array": [ "u8", 32 ]; }; } ]; }, { "name": "updateLendingMarket"; "discriminator": [ 209, 157, 53, 210, 97, 180, 31, 45 ]; "accounts": [ { "name": "lendingMarketOwner"; "signer": true; }, { "name": "lendingMarket"; "writable": true; } ]; "args": [ { "name": "mode"; "type": "u64"; }, { "name": "value"; "type": { "array": [ "u8", 72 ]; }; } ]; }, { "name": "updateLendingMarketOwner"; "discriminator": [ 118, 224, 10, 62, 196, 230, 184, 89 ]; "accounts": [ { "name": "lendingMarketOwnerCached"; "signer": true; }, { "name": "lendingMarket"; "writable": true; } ]; "args": []; }, { "name": "initReserve"; "discriminator": [ 138, 245, 71, 225, 153, 4, 3, 43 ]; "accounts": [ { "name": "lendingMarketOwner"; "writable": true; "signer": true; }, { "name": "lendingMarket"; }, { "name": "lendingMarketAuthority"; }, { "name": "reserve"; "writable": true; }, { "name": "reserveLiquidityMint"; }, { "name": "reserveLiquiditySupply"; "writable": true; }, { "name": "feeReceiver"; "writable": true; }, { "name": "reserveCollateralMint"; "writable": true; }, { "name": "reserveCollateralSupply"; "writable": true; }, { "name": "initialLiquiditySource"; "writable": true; }, { "name": "rent"; }, { "name": "liquidityTokenProgram"; }, { "name": "collateralTokenProgram"; }, { "name": "systemProgram"; } ]; "args": []; }, { "name": "initFarmsForReserve"; "discriminator": [ 218, 6, 62, 233, 1, 33, 232, 82 ]; "accounts": [ { "name": "lendingMarketOwner"; "writable": true; "signer": true; }, { "name": "lendingMarket"; }, { "name": "lendingMarketAuthority"; }, { "name": "reserve"; "writable": true; }, { "name": "farmsProgram"; }, { "name": "farmsGlobalConfig"; }, { "name": "farmState"; "writable": true; }, { "name": "farmsVaultAuthority"; }, { "name": "rent"; }, { "name": "systemProgram"; } ]; "args": [ { "name": "mode"; "type": "u8"; } ]; }, { "name": "updateReserveConfig"; "discriminator": [ 61, 148, 100, 70, 143, 107, 17, 13 ]; "accounts": [ { "name": "signer"; "signer": true; }, { "name": "globalConfig"; }, { "name": "lendingMarket"; }, { "name": "reserve"; "writable": true; } ]; "args": [ { "name": "mode"; "type": { "defined": { "name": "updateConfigMode"; }; }; }, { "name": "value"; "type": "bytes"; }, { "name": "skipConfigIntegrityValidation"; "type": "bool"; } ]; }, { "name": "redeemFees"; "discriminator": [ 215, 39, 180, 41, 173, 46, 248, 220 ]; "accounts": [ { "name": "reserve"; "writable": true; }, { "name": "reserveLiquidityMint"; }, { "name": "reserveLiquidityFeeReceiver"; "writable": true; }, { "name": "reserveSupplyLiquidity"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "lendingMarketAuthority"; }, { "name": "tokenProgram"; } ]; "args": []; }, { "name": "withdrawProtocolFee"; "discriminator": [ 158, 201, 158, 189, 33, 93, 162, 103 ]; "accounts": [ { "name": "globalConfig"; }, { "name": "lendingMarket"; }, { "name": "reserve"; }, { "name": "reserveLiquidityMint"; }, { "name": "lendingMarketAuthority"; }, { "name": "feeVault"; "writable": true; }, { "name": "feeCollectorAta"; "writable": true; }, { "name": "tokenProgram"; } ]; "args": [ { "name": "amount"; "type": "u64"; } ]; }, { "name": "socializeLoss"; "discriminator": [ 245, 75, 91, 0, 236, 97, 19, 3 ]; "accounts": [ { "name": "riskCouncil"; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "reserve"; "writable": true; }, { "name": "instructionSysvarAccount"; } ]; "args": [ { "name": "liquidityAmount"; "type": "u64"; } ]; }, { "name": "socializeLossV2"; "discriminator": [ 238, 95, 98, 220, 187, 40, 204, 154 ]; "accounts": [ { "name": "socializeLossAccounts"; "accounts": [ { "name": "riskCouncil"; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "reserve"; "writable": true; }, { "name": "instructionSysvarAccount"; } ]; }, { "name": "farmsAccounts"; "accounts": [ { "name": "obligationFarmUserState"; "writable": true; "optional": true; }, { "name": "reserveFarmState"; "writable": true; "optional": true; } ]; }, { "name": "lendingMarketAuthority"; }, { "name": "farmsProgram"; } ]; "args": [ { "name": "liquidityAmount"; "type": "u64"; } ]; }, { "name": "markObligationForDeleveraging"; "discriminator": [ 164, 35, 182, 19, 0, 116, 243, 127 ]; "accounts": [ { "name": "riskCouncil"; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; } ]; "args": [ { "name": "autodeleverageTargetLtvPct"; "type": "u8"; } ]; }, { "name": "refreshReserve"; "discriminator": [ 2, 218, 138, 235, 79, 201, 25, 102 ]; "accounts": [ { "name": "reserve"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "pythOracle"; "optional": true; }, { "name": "switchboardPriceOracle"; "optional": true; }, { "name": "switchboardTwapOracle"; "optional": true; }, { "name": "scopePrices"; "optional": true; } ]; "args": []; }, { "name": "refreshReservesBatch"; "discriminator": [ 144, 110, 26, 103, 162, 204, 252, 147 ]; "accounts": []; "args": [ { "name": "skipPriceUpdates"; "type": "bool"; } ]; }, { "name": "depositReserveLiquidity"; "discriminator": [ 169, 201, 30, 126, 6, 205, 102, 68 ]; "accounts": [ { "name": "owner"; "signer": true; }, { "name": "reserve"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "lendingMarketAuthority"; }, { "name": "reserveLiquidityMint"; }, { "name": "reserveLiquiditySupply"; "writable": true; }, { "name": "reserveCollateralMint"; "writable": true; }, { "name": "userSourceLiquidity"; "writable": true; }, { "name": "userDestinationCollateral"; "writable": true; }, { "name": "collateralTokenProgram"; }, { "name": "liquidityTokenProgram"; }, { "name": "instructionSysvarAccount"; } ]; "args": [ { "name": "liquidityAmount"; "type": "u64"; } ]; }, { "name": "redeemReserveCollateral"; "discriminator": [ 234, 117, 181, 125, 185, 142, 220, 29 ]; "accounts": [ { "name": "owner"; "signer": true; }, { "name": "lendingMarket"; }, { "name": "reserve"; "writable": true; }, { "name": "lendingMarketAuthority"; }, { "name": "reserveLiquidityMint"; }, { "name": "reserveCollateralMint"; "writable": true; }, { "name": "reserveLiquiditySupply"; "writable": true; }, { "name": "userSourceCollateral"; "writable": true; }, { "name": "userDestinationLiquidity"; "writable": true; }, { "name": "collateralTokenProgram"; }, { "name": "liquidityTokenProgram"; }, { "name": "instructionSysvarAccount"; } ]; "args": [ { "name": "collateralAmount"; "type": "u64"; } ]; }, { "name": "initObligation"; "discriminator": [ 251, 10, 231, 76, 27, 11, 159, 96 ]; "accounts": [ { "name": "obligationOwner"; "signer": true; }, { "name": "feePayer"; "writable": true; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "seed1Account"; }, { "name": "seed2Account"; }, { "name": "ownerUserMetadata"; }, { "name": "rent"; }, { "name": "systemProgram"; } ]; "args": [ { "name": "args"; "type": { "defined": { "name": "initObligationArgs"; }; }; } ]; }, { "name": "initObligationFarmsForReserve"; "discriminator": [ 136, 63, 15, 186, 211, 152, 168, 164 ]; "accounts": [ { "name": "payer"; "writable": true; "signer": true; }, { "name": "owner"; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarketAuthority"; }, { "name": "reserve"; "writable": true; }, { "name": "reserveFarmState"; "writable": true; }, { "name": "obligationFarm"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "farmsProgram"; }, { "name": "rent"; }, { "name": "systemProgram"; } ]; "args": [ { "name": "mode"; "type": "u8"; } ]; }, { "name": "refreshObligationFarmsForReserve"; "discriminator": [ 140, 144, 253, 21, 10, 74, 248, 3 ]; "accounts": [ { "name": "crank"; "signer": true; }, { "name": "baseAccounts"; "accounts": [ { "name": "obligation"; }, { "name": "lendingMarketAuthority"; }, { "name": "reserve"; }, { "name": "reserveFarmState"; "writable": true; }, { "name": "obligationFarmUserState"; "writable": true; }, { "name": "lendingMarket"; } ]; }, { "name": "farmsProgram"; }, { "name": "rent"; }, { "name": "systemProgram"; } ]; "args": [ { "name": "mode"; "type": "u8"; } ]; }, { "name": "refreshObligation"; "discriminator": [ 33, 132, 147, 228, 151, 192, 72, 89 ]; "accounts": [ { "name": "lendingMarket"; }, { "name": "obligation"; "writable": true; } ]; "args": []; }, { "name": "depositObligationCollateral"; "discriminator": [ 108, 209, 4, 72, 21, 22, 118, 133 ]; "accounts": [ { "name": "owner"; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "depositReserve"; "writable": true; }, { "name": "reserveDestinationCollateral"; "writable": true; }, { "name": "userSourceCollateral"; "writable": true; }, { "name": "tokenProgram"; }, { "name": "instructionSysvarAccount"; } ]; "args": [ { "name": "collateralAmount"; "type": "u64"; } ]; }, { "name": "depositObligationCollateralV2"; "discriminator": [ 137, 145, 151, 94, 167, 113, 4, 145 ]; "accounts": [ { "name": "depositAccounts"; "accounts": [ { "name": "owner"; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "depositReserve"; "writable": true; }, { "name": "reserveDestinationCollateral"; "writable": true; }, { "name": "userSourceCollateral"; "writable": true; }, { "name": "tokenProgram"; }, { "name": "instructionSysvarAccount"; } ]; }, { "name": "lendingMarketAuthority"; }, { "name": "farmsAccounts"; "accounts": [ { "name": "obligationFarmUserState"; "writable": true; "optional": true; }, { "name": "reserveFarmState"; "writable": true; "optional": true; } ]; }, { "name": "farmsProgram"; } ]; "args": [ { "name": "collateralAmount"; "type": "u64"; } ]; }, { "name": "withdrawObligationCollateral"; "discriminator": [ 37, 116, 205, 103, 243, 192, 92, 198 ]; "accounts": [ { "name": "owner"; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "lendingMarketAuthority"; }, { "name": "withdrawReserve"; "writable": true; }, { "name": "reserveSourceCollateral"; "writable": true; }, { "name": "userDestinationCollateral"; "writable": true; }, { "name": "tokenProgram"; }, { "name": "instructionSysvarAccount"; } ]; "args": [ { "name": "collateralAmount"; "type": "u64"; } ]; }, { "name": "withdrawObligationCollateralV2"; "discriminator": [ 202, 249, 117, 114, 231, 192, 47, 138 ]; "accounts": [ { "name": "withdrawAccounts"; "accounts": [ { "name": "owner"; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "lendingMarketAuthority"; }, { "name": "withdrawReserve"; "writable": true; }, { "name": "reserveSourceCollateral"; "writable": true; }, { "name": "userDestinationCollateral"; "writable": true; }, { "name": "tokenProgram"; }, { "name": "instructionSysvarAccount"; } ]; }, { "name": "farmsAccounts"; "accounts": [ { "name": "obligationFarmUserState"; "writable": true; "optional": true; }, { "name": "reserveFarmState"; "writable": true; "optional": true; } ]; }, { "name": "farmsProgram"; } ]; "args": [ { "name": "collateralAmount"; "type": "u64"; } ]; }, { "name": "borrowObligationLiquidity"; "discriminator": [ 121, 127, 18, 204, 73, 245, 225, 65 ]; "accounts": [ { "name": "owner"; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "lendingMarketAuthority"; }, { "name": "borrowReserve"; "writable": true; }, { "name": "borrowReserveLiquidityMint"; }, { "name": "reserveSourceLiquidity"; "writable": true; }, { "name": "borrowReserveLiquidityFeeReceiver"; "writable": true; }, { "name": "userDestinationLiquidity"; "writable": true; }, { "name": "referrerTokenState"; "writable": true; "optional": true; }, { "name": "tokenProgram"; }, { "name": "instructionSysvarAccount"; } ]; "args": [ { "name": "liquidityAmount"; "type": "u64"; } ]; }, { "name": "borrowObligationLiquidityV2"; "discriminator": [ 161, 128, 143, 245, 171, 199, 194, 6 ]; "accounts": [ { "name": "borrowAccounts"; "accounts": [ { "name": "owner"; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "lendingMarketAuthority"; }, { "name": "borrowReserve"; "writable": true; }, { "name": "borrowReserveLiquidityMint"; }, { "name": "reserveSourceLiquidity"; "writable": true; }, { "name": "borrowReserveLiquidityFeeReceiver"; "writable": true; }, { "name": "userDestinationLiquidity"; "writable": true; }, { "name": "referrerTokenState"; "writable": true; "optional": true; }, { "name": "tokenProgram"; }, { "name": "instructionSysvarAccount"; } ]; }, { "name": "farmsAccounts"; "accounts": [ { "name": "obligationFarmUserState"; "writable": true; "optional": true; }, { "name": "reserveFarmState"; "writable": true; "optional": true; } ]; }, { "name": "farmsProgram"; } ]; "args": [ { "name": "liquidityAmount"; "type": "u64"; } ]; }, { "name": "repayObligationLiquidity"; "discriminator": [ 145, 178, 13, 225, 76, 240, 147, 72 ]; "accounts": [ { "name": "owner"; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "repayReserve"; "writable": true; }, { "name": "reserveLiquidityMint"; }, { "name": "reserveDestinationLiquidity"; "writable": true; }, { "name": "userSourceLiquidity"; "writable": true; }, { "name": "tokenProgram"; }, { "name": "instructionSysvarAccount"; } ]; "args": [ { "name": "liquidityAmount"; "type": "u64"; } ]; }, { "name": "repayObligationLiquidityV2"; "discriminator": [ 116, 174, 213, 76, 180, 53, 210, 144 ]; "accounts": [ { "name": "repayAccounts"; "accounts": [ { "name": "owner"; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "repayReserve"; "writable": true; }, { "name": "reserveLiquidityMint"; }, { "name": "reserveDestinationLiquidity"; "writable": true; }, { "name": "userSourceLiquidity"; "writable": true; }, { "name": "tokenProgram"; }, { "name": "instructionSysvarAccount"; } ]; }, { "name": "farmsAccounts"; "accounts": [ { "name": "obligationFarmUserState"; "writable": true; "optional": true; }, { "name": "reserveFarmState"; "writable": true; "optional": true; } ]; }, { "name": "lendingMarketAuthority"; }, { "name": "farmsProgram"; } ]; "args": [ { "name": "liquidityAmount"; "type": "u64"; } ]; }, { "name": "repayAndWithdrawAndRedeem"; "discriminator": [ 2, 54, 152, 3, 148, 96, 109, 218 ]; "accounts": [ { "name": "repayAccounts"; "accounts": [ { "name": "owner"; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "repayReserve"; "writable": true; }, { "name": "reserveLiquidityMint"; }, { "name": "reserveDestinationLiquidity"; "writable": true; }, { "name": "userSourceLiquidity"; "writable": true; }, { "name": "tokenProgram"; }, { "name": "instructionSysvarAccount"; } ]; }, { "name": "withdrawAccounts"; "accounts": [ { "name": "owner"; "writable": true; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "lendingMarketAuthority"; }, { "name": "withdrawReserve"; "writable": true; }, { "name": "reserveLiquidityMint"; }, { "name": "reserveSourceCollateral"; "writable": true; }, { "name": "reserveCollateralMint"; "writable": true; }, { "name": "reserveLiquiditySupply"; "writable": true; }, { "name": "userDestinationLiquidity"; "writable": true; }, { "name": "placeholderUserDestinationCollateral"; "optional": true; }, { "name": "collateralTokenProgram"; }, { "name": "liquidityTokenProgram"; }, { "name": "instructionSysvarAccount"; } ]; }, { "name": "collateralFarmsAccounts"; "accounts": [ { "name": "obligationFarmUserState"; "writable": true; "optional": true; }, { "name": "reserveFarmState"; "writable": true; "optional": true; } ]; }, { "name": "debtFarmsAccounts"; "accounts": [ { "name": "obligationFarmUserState"; "writable": true; "optional": true; }, { "name": "reserveFarmState"; "writable": true; "optional": true; } ]; }, { "name": "farmsProgram"; } ]; "args": [ { "name": "repayAmount"; "type": "u64"; }, { "name": "withdrawCollateralAmount"; "type": "u64"; } ]; }, { "name": "depositAndWithdraw"; "discriminator": [ 141, 153, 39, 15, 64, 61, 88, 84 ]; "accounts": [ { "name": "depositAccounts"; "accounts": [ { "name": "owner"; "writable": true; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "lendingMarketAuthority"; }, { "name": "reserve"; "writable": true; }, { "name": "reserveLiquidityMint"; }, { "name": "reserveLiquiditySupply"; "writable": true; }, { "name": "reserveCollateralMint"; "writable": true; }, { "name": "reserveDestinationDepositCollateral"; "writable": true; }, { "name": "userSourceLiquidity"; "writable": true; }, { "name": "placeholderUserDestinationCollateral"; "optional": true; }, { "name": "collateralTokenProgram"; }, { "name": "liquidityTokenProgram"; }, { "name": "instructionSysvarAccount"; } ]; }, { "name": "withdrawAccounts"; "accounts": [ { "name": "owner"; "writable": true; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "lendingMarketAuthority"; }, { "name": "withdrawReserve"; "writable": true; }, { "name": "reserveLiquidityMint"; }, { "name": "reserveSourceCollateral"; "writable": true; }, { "name": "reserveCollateralMint"; "writable": true; }, { "name": "reserveLiquiditySupply"; "writable": true; }, { "name": "userDestinationLiquidity"; "writable": true; }, { "name": "placeholderUserDestinationCollateral"; "optional": true; }, { "name": "collateralTokenProgram"; }, { "name": "liquidityTokenProgram"; }, { "name": "instructionSysvarAccount"; } ]; }, { "name": "depositFarmsAccounts"; "accounts": [ { "name": "obligationFarmUserState"; "writable": true; "optional": true; }, { "name": "reserveFarmState"; "writable": true; "optional": true; } ]; }, { "name": "withdrawFarmsAccounts"; "accounts": [ { "name": "obligationFarmUserState"; "writable": true; "optional": true; }, { "name": "reserveFarmState"; "writable": true; "optional": true; } ]; }, { "name": "farmsProgram"; } ]; "args": [ { "name": "liquidityAmount"; "type": "u64"; }, { "name": "withdrawCollateralAmount"; "type": "u64"; } ]; }, { "name": "depositReserveLiquidityAndObligationCollateral"; "discriminator": [ 129, 199, 4, 2, 222, 39, 26, 46 ]; "accounts": [ { "name": "owner"; "writable": true; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "lendingMarketAuthority"; }, { "name": "reserve"; "writable": true; }, { "name": "reserveLiquidityMint"; }, { "name": "reserveLiquiditySupply"; "writable": true; }, { "name": "reserveCollateralMint"; "writable": true; }, { "name": "reserveDestinationDepositCollateral"; "writable": true; }, { "name": "userSourceLiquidity"; "writable": true; }, { "name": "placeholderUserDestinationCollateral"; "optional": true; }, { "name": "collateralTokenProgram"; }, { "name": "liquidityTokenProgram"; }, { "name": "instructionSysvarAccount"; } ]; "args": [ { "name": "liquidityAmount"; "type": "u64"; } ]; }, { "name": "depositReserveLiquidityAndObligationCollateralV2"; "discriminator": [ 216, 224, 191, 27, 204, 151, 102, 175 ]; "accounts": [ { "name": "depositAccounts"; "accounts": [ { "name": "owner"; "writable": true; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "lendingMarketAuthority"; }, { "name": "reserve"; "writable": true; }, { "name": "reserveLiquidityMint"; }, { "name": "reserveLiquiditySupply"; "writable": true; }, { "name": "reserveCollateralMint"; "writable": true; }, { "name": "reserveDestinationDepositCollateral"; "writable": true; }, { "name": "userSourceLiquidity"; "writable": true; }, { "name": "placeholderUserDestinationCollateral"; "optional": true; }, { "name": "collateralTokenProgram"; }, { "name": "liquidityTokenProgram"; }, { "name": "instructionSysvarAccount"; } ]; }, { "name": "farmsAccounts"; "accounts": [ { "name": "obligationFarmUserState"; "writable": true; "optional": true; }, { "name": "reserveFarmState"; "writable": true; "optional": true; } ]; }, { "name": "farmsProgram"; } ]; "args": [ { "name": "liquidityAmount"; "type": "u64"; } ]; }, { "name": "withdrawObligationCollateralAndRedeemReserveCollateral"; "discriminator": [ 75, 93, 93, 220, 34, 150, 218, 196 ]; "accounts": [ { "name": "owner"; "writable": true; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "lendingMarketAuthority"; }, { "name": "withdrawReserve"; "writable": true; }, { "name": "reserveLiquidityMint"; }, { "name": "reserveSourceCollateral"; "writable": true; }, { "name": "reserveCollateralMint"; "writable": true; }, { "name": "reserveLiquiditySupply"; "writable": true; }, { "name": "userDestinationLiquidity"; "writable": true; }, { "name": "placeholderUserDestinationCollateral"; "optional": true; }, { "name": "collateralTokenProgram"; }, { "name": "liquidityTokenProgram"; }, { "name": "instructionSysvarAccount"; } ]; "args": [ { "name": "collateralAmount"; "type": "u64"; } ]; }, { "name": "withdrawObligationCollateralAndRedeemReserveCollateralV2"; "discriminator": [ 235, 52, 119, 152, 149, 197, 20, 7 ]; "accounts": [ { "name": "withdrawAccounts"; "accounts": [ { "name": "owner"; "writable": true; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "lendingMarketAuthority"; }, { "name": "withdrawReserve"; "writable": true; }, { "name": "reserveLiquidityMint"; }, { "name": "reserveSourceCollateral"; "writable": true; }, { "name": "reserveCollateralMint"; "writable": true; }, { "name": "reserveLiquiditySupply"; "writable": true; }, { "name": "userDestinationLiquidity"; "writable": true; }, { "name": "placeholderUserDestinationCollateral"; "optional": true; }, { "name": "collateralTokenProgram"; }, { "name": "liquidityTokenProgram"; }, { "name": "instructionSysvarAccount"; } ]; }, { "name": "farmsAccounts"; "accounts": [ { "name": "obligationFarmUserState"; "writable": true; "optional": true; }, { "name": "reserveFarmState"; "writable": true; "optional": true; } ]; }, { "name": "farmsProgram"; } ]; "args": [ { "name": "collateralAmount"; "type": "u64"; } ]; }, { "name": "liquidateObligationAndRedeemReserveCollateral"; "discriminator": [ 177, 71, 154, 188, 226, 133, 74, 55 ]; "accounts": [ { "name": "liquidator"; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "lendingMarketAuthority"; }, { "name": "repayReserve"; "writable": true; }, { "name": "repayReserveLiquidityMint"; }, { "name": "repayReserveLiquiditySupply"; "writable": true; }, { "name": "withdrawReserve"; "writable": true; }, { "name": "withdrawReserveLiquidityMint"; }, { "name": "withdrawReserveCollateralMint"; "writable": true; }, { "name": "withdrawReserveCollateralSupply"; "writable": true; }, { "name": "withdrawReserveLiquiditySupply"; "writable": true; }, { "name": "withdrawReserveLiquidityFeeReceiver"; "writable": true; }, { "name": "userSourceLiquidity"; "writable": true; }, { "name": "userDestinationCollateral"; "writable": true; }, { "name": "userDestinationLiquidity"; "writable": true; }, { "name": "collateralTokenProgram"; }, { "name": "repayLiquidityTokenProgram"; }, { "name": "withdrawLiquidityTokenProgram"; }, { "name": "instructionSysvarAccount"; } ]; "args": [ { "name": "liquidityAmount"; "type": "u64"; }, { "name": "minAcceptableReceivedLiquidityAmount"; "type": "u64"; }, { "name": "maxAllowedLtvOverridePercent"; "type": "u64"; } ]; }, { "name": "liquidateObligationAndRedeemReserveCollateralV2"; "discriminator": [ 162, 161, 35, 143, 30, 187, 185, 103 ]; "accounts": [ { "name": "liquidationAccounts"; "accounts": [ { "name": "liquidator"; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "lendingMarketAuthority"; "writable": true; }, { "name": "repayReserve"; "writable": true; }, { "name": "repayReserveLiquidityMint"; }, { "name": "repayReserveLiquiditySupply"; "writable": true; }, { "name": "withdrawReserve"; "writable": true; }, { "name": "withdrawReserveLiquidityMint"; }, { "name": "withdrawReserveCollateralMint"; "writable": true; }, { "name": "withdrawReserveCollateralSupply"; "writable": true; }, { "name": "withdrawReserveLiquiditySupply"; "writable": true; }, { "name": "withdrawReserveLiquidityFeeReceiver"; "writable": true; }, { "name": "userSourceLiquidity"; "writable": true; }, { "name": "userDestinationCollateral"; "writable": true; }, { "name": "userDestinationLiquidity"; "writable": true; }, { "name": "collateralTokenProgram"; }, { "name": "repayLiquidityTokenProgram"; }, { "name": "withdrawLiquidityTokenProgram"; }, { "name": "instructionSysvarAccount"; } ]; }, { "name": "collateralFarmsAccounts"; "accounts": [ { "name": "obligationFarmUserState"; "writable": true; "optional": true; }, { "name": "reserveFarmState"; "writable": true; "optional": true; } ]; }, { "name": "debtFarmsAccounts"; "accounts": [ { "name": "obligationFarmUserState"; "writable": true; "optional": true; }, { "name": "reserveFarmState"; "writable": true; "optional": true; } ]; }, { "name": "farmsProgram"; } ]; "args": [ { "name": "liquidityAmount"; "type": "u64"; }, { "name": "minAcceptableReceivedLiquidityAmount"; "type": "u64"; }, { "name": "maxAllowedLtvOverridePercent"; "type": "u64"; } ]; }, { "name": "flashRepayReserveLiquidity"; "discriminator": [ 185, 117, 0, 203, 96, 245, 180, 186 ]; "accounts": [ { "name": "userTransferAuthority"; "signer": true; }, { "name": "lendingMarketAuthority"; }, { "name": "lendingMarket"; }, { "name": "reserve"; "writable": true; }, { "name": "reserveLiquidityMint"; }, { "name": "reserveDestinationLiquidity"; "writable": true; }, { "name": "userSourceLiquidity"; "writable": true; }, { "name": "reserveLiquidityFeeReceiver"; "writable": true; }, { "name": "referrerTokenState"; "writable": true; "optional": true; }, { "name": "referrerAccount"; "writable": true; "optional": true; }, { "name": "sysvarInfo"; }, { "name": "tokenProgram"; } ]; "args": [ { "name": "liquidityAmount"; "type": "u64"; }, { "name": "borrowInstructionIndex"; "type": "u8"; } ]; }, { "name": "flashBorrowReserveLiquidity"; "discriminator": [ 135, 231, 52, 167, 7, 52, 212, 193 ]; "accounts": [ { "name": "userTransferAuthority"; "signer": true; }, { "name": "lendingMarketAuthority"; }, { "name": "lendingMarket"; }, { "name": "reserve"; "writable": true; }, { "name": "reserveLiquidityMint"; }, { "name": "reserveSourceLiquidity"; "writable": true; }, { "name": "userDestinationLiquidity"; "writable": true; }, { "name": "reserveLiquidityFeeReceiver"; "writable": true; }, { "name": "referrerTokenState"; "writable": true; "optional": true; }, { "name": "referrerAccount"; "writable": true; "optional": true; }, { "name": "sysvarInfo"; }, { "name": "tokenProgram"; } ]; "args": [ { "name": "liquidityAmount"; "type": "u64"; } ]; }, { "name": "requestElevationGroup"; "discriminator": [ 36, 119, 251, 129, 34, 240, 7, 147 ]; "accounts": [ { "name": "owner"; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; } ]; "args": [ { "name": "elevationGroup"; "type": "u8"; } ]; }, { "name": "initReferrerTokenState"; "discriminator": [ 116, 45, 66, 148, 58, 13, 218, 115 ]; "accounts": [ { "name": "payer"; "writable": true; "signer": true; }, { "name": "lendingMarket"; }, { "name": "reserve"; }, { "name": "referrer"; }, { "name": "referrerTokenState"; "writable": true; }, { "name": "rent"; }, { "name": "systemProgram"; } ]; "args": []; }, { "name": "initUserMetadata"; "discriminator": [ 117, 169, 176, 69, 197, 23, 15, 162 ]; "accounts": [ { "name": "owner"; "signer": true; }, { "name": "feePayer"; "writable": true; "signer": true; }, { "name": "userMetadata"; "writable": true; }, { "name": "referrerUserMetadata"; "optional": true; }, { "name": "rent"; }, { "name": "systemProgram"; } ]; "args": [ { "name": "userLookupTable"; "type": "pubkey"; } ]; }, { "name": "withdrawReferrerFees"; "discriminator": [ 171, 118, 121, 201, 233, 140, 23, 228 ]; "accounts": [ { "name": "referrer"; "writable": true; "signer": true; }, { "name": "referrerTokenState"; "writable": true; }, { "name": "reserve"; "writable": true; }, { "name": "reserveLiquidityMint"; }, { "name": "reserveSupplyLiquidity"; "writable": true; }, { "name": "referrerTokenAccount"; "writable": true; }, { "name": "lendingMarket"; }, { "name": "lendingMarketAuthority"; }, { "name": "tokenProgram"; } ]; "args": []; }, { "name": "initReferrerStateAndShortUrl"; "discriminator": [ 165, 19, 25, 127, 100, 55, 31, 90 ]; "accounts": [ { "name": "referrer"; "writable": true; "signer": true; }, { "name": "referrerState"; "writable": true; }, { "name": "referrerShortUrl"; "writable": true; }, { "name": "referrerUserMetadata"; }, { "name": "rent"; }, { "name": "systemProgram"; } ]; "args": [ { "name": "shortUrl"; "type": "string"; } ]; }, { "name": "deleteReferrerStateAndShortUrl"; "discriminator": [ 153, 185, 99, 28, 228, 179, 187, 150 ]; "accounts": [ { "name": "referrer"; "writable": true; "signer": true; }, { "name": "referrerState"; "writable": true; }, { "name": "shortUrl"; "writable": true; }, { "name": "rent"; }, { "name": "systemProgram"; } ]; "args": []; }, { "name": "setObligationOrder"; "discriminator": [ 81, 1, 99, 156, 211, 83, 78, 46 ]; "accounts": [ { "name": "owner"; "signer": true; }, { "name": "obligation"; "writable": true; }, { "name": "lendingMarket"; } ]; "args": [ { "name": "index"; "type": "u8"; }, { "name": "order"; "type": { "defined": { "name": "obligationOrder"; }; }; } ]; }, { "name": "initGlobalConfig"; "discriminator": [ 140, 136, 214, 48, 87, 0, 120, 255 ]; "accounts": [ { "name": "payer"; "writable": true; "signer": true; }, { "name": "globalConfig"; "writable": true; }, { "name": "programData"; }, { "name": "systemProgram"; }, { "name": "rent"; } ]; "args": []; }, { "name": "updateGlobalConfig"; "discriminator": [ 164, 84, 130, 189, 111, 58, 250, 200 ]; "accounts": [ { "name": "globalAdmin"; "signer": true; }, { "name": "globalConfig"; "writable": true; } ]; "args": [ { "name": "mode"; "type": { "defined": { "name": "updateGlobalConfigMode"; }; }; }, { "name": "value"; "type": "bytes"; } ]; }, { "name": "updateGlobalConfigAdmin"; "discriminator": [ 184, 87, 23, 193, 156, 238, 175, 119 ]; "accounts": [ { "name": "pendingAdmin"; "signer": true; }, { "name": "globalConfig"; "writable": true; } ]; "args": []; }, { "name": "idlMissingTypes"; "discriminator": [ 130, 80, 38, 153, 80, 212, 182, 253 ]; "accounts": [ { "name": "signer"; "signer": true; }, { "name": "globalConfig"; }, { "name": "lendingMarket"; }, { "name": "reserve"; "writable": true; } ]; "args": [ { "name": "reserveFarmKind"; "type": { "defined": { "name": "reserveFarmKind"; }; }; }, { "name": "assetTier"; "type": { "defined": { "name": "assetTier"; }; }; }, { "name": "feeCalculation"; "type": { "defined": { "name": "feeCalculation"; }; }; }, { "name": "reserveStatus"; "type": { "defined": { "name": "reserveStatus"; }; }; }, { "name": "updateConfigMode"; "type": { "defined": { "name": "updateConfigMode"; }; }; }, { "name": "updateLendingMarketConfigValue"; "type": { "defined": { "name": "updateLendingMarketConfigValue"; }; }; }, { "name": "updateLendingMarketConfigMode"; "type": { "defined": { "name": "updateLendingMarketMode"; }; }; } ]; } ]; "accounts": [ { "name": "userState"; "discriminator": [ 72, 177, 85, 249, 76, 167, 186, 126 ]; }, { "name": "globalConfig"; "discriminator": [ 149, 8, 156, 202, 160, 252, 176, 217 ]; }, { "name": "lendingMarket"; "discriminator": [ 246, 114, 50, 98, 72, 157, 28, 120 ]; }, { "name": "obligation"; "discriminator": [ 168, 206, 141, 106, 88, 76, 172, 167 ]; }, { "name": "referrerState"; "discriminator": [ 194, 81, 217, 103, 12, 19, 12, 66 ]; }, { "name": "referrerTokenState"; "discriminator": [ 39, 15, 208, 77, 32, 195, 105, 56 ]; }, { "name": "shortUrl"; "discriminator": [ 28, 89, 174, 25, 226, 124, 126, 212 ]; }, { "name": "userMetadata"; "discriminator": [ 157, 214, 220, 235, 98, 135, 171, 28 ]; }, { "name": "reserve"; "discriminator": [ 43, 242, 204, 202, 26, 247, 59, 127 ]; } ]; "errors": [ { "code": 6000; "name": "invalidMarketAuthority"; "msg": "Market authority is invalid"; }, { "code": 6001; "name": "invalidMarketOwner"; "msg": "Market owner is invalid"; }, { "code": 6002; "name": "invalidAccountOwner"; "msg": "Input account owner is not the program address"; }, { "code": 6003; "name": "invalidAmount"; "msg": "Input amount is invalid"; }, { "code": 6004; "name": "invalidConfig"; "msg": "Input config value is invalid"; }, { "code": 6005; "name": "invalidSigner"; "msg": "Input account must be a signer"; }, { "code": 6006; "name": "invalidAccountInput"; "msg": "Invalid account input"; }, { "code": 6007; "name": "mathOverflow"; "msg": "Math operation overflow"; }, { "code": 6008; "name": "insufficientLiquidity"; "msg": "Insufficient liquidity available"; }, { "code": 6009; "name": "reserveStale"; "msg": "Reserve state needs to be refreshed"; }, { "code": 6010; "name": "withdrawTooSmall"; "msg": "Withdraw amount too small"; }, { "code": 6011; "name": "withdrawTooLarge"; "msg": "Withdraw amount too large"; }, { "code": 6012; "name": "borrowTooSmall"; "msg": "Borrow amount too small to receive liquidity after fees"; }, { "code": 6013; "name": "borrowTooLarge"; "msg": "Borrow amount too large for deposited collateral"; }, { "code": 6014; "name": "repayTooSmall"; "msg": "Repay amount too small to transfer liquidity"; }, { "code": 6015; "name": "liquidationTooSmall"; "msg": "Liquidation amount too small to receive collateral"; }, { "code": 6016; "name": "obligationHealthy"; "msg": "Cannot liquidate healthy obligations"; }, { "code": 6017; "name": "obligationStale"; "msg": "Obligation state needs to be refreshed"; }, { "code": 6018; "name": "obligationReserveLimit"; "msg": "Obligation reserve limit exceeded"; }, { "code": 6019; "name": "invalidObligationOwner"; "msg": "Obligation owner is invalid"; }, { "code": 6020; "name": "obligationDepositsEmpty"; "msg": "Obligation deposits are empty"; }, { "code": 6021; "name": "obligationBorrowsEmpty"; "msg": "Obligation borrows are empty"; }, { "code": 6022; "name": "obligationDepositsZero"; "msg": "Obligation deposits have zero value"; }, { "code": 6023; "name": "obligationBorrowsZero"; "msg": "Obligation borrows have zero value"; }, { "code": 6024; "name": "invalidObligationCollateral"; "msg": "Invalid obligation collateral"; }, { "code": 6025; "name": "invalidObligationLiquidity"; "msg": "Invalid obligation liquidity"; }, { "code": 6026; "name": "obligationCollateralEmpty"; "msg": "Obligation collateral is empty"; }, { "code": 6027; "name": "obligationLiquidityEmpty"; "msg": "Obligation liquidity is empty"; }, { "code": 6028; "name": "negativeInterestRate"; "msg": "Interest rate is negative"; }, { "code": 6029; "name": "invalidOracleConfig"; "msg": "Input oracle config is invalid"; }, { "code": 6030; "name": "insufficientProtocolFeesToRedeem"; "msg": "Insufficient protocol fees to claim or no liquidity available"; }, { "code": 6031; "name": "flashBorrowCpi"; "msg": "No cpi flash borrows allowed"; }, { "code": 6032; "name": "noFlashRepayFound"; "msg": "No corresponding repay found for flash borrow"; }, { "code": 6033; "name": "invalidFlashRepay"; "msg": "Invalid repay found"; }, { "code": 6034; "name": "flashRepayCpi"; "msg": "No cpi flash repays allowed"; }, { "code": 6035; "name": "multipleFlashBorrows"; "msg": "Multiple flash borrows not allowed in the same transaction"; }, { "code": 6036; "name": "flashLoansDisabled"; "msg": "Flash loans are disabled for this reserve"; }, { "code": 6037; "name": "switchboardV2Error"; "msg": "Switchboard error"; }, { "code": 6038; "name": "couldNotDeserializeScope"; "msg": "Cannot deserialize the scope price account"; }, { "code": 6039; "name": "priceTooOld"; "msg": "Price too old"; }, { "code": 6040; "name": "priceTooDivergentFromTwap"; "msg": "Price too divergent from twap"; }, { "code": 6041; "name": "invalidTwapPrice"; "msg": "Invalid twap price"; }, { "code": 6042; "name": "globalEmergencyMode"; "msg": "Emergency mode is enabled"; }, { "code": 6043; "name": "invalidFlag"; "msg": "Invalid lending market config"; }, { "code": 6044; "name": "priceNotValid"; "msg": "Price is not valid"; }, { "code": 6045; "name": "priceIsBiggerThanHeuristic"; "msg": "Price is bigger than allowed by heuristic"; }, { "code": 6046; "name": "priceIsLowerThanHeuristic"; "msg": "Price lower than allowed by heuristic"; }, { "code": 6047; "name": "priceIsZero"; "msg": "Price is zero"; }, { "code": 6048; "name": "priceConfidenceTooWide"; "msg": "Price confidence too wide"; }, { "code": 6049; "name": "integerOverflow"; "msg": "Conversion between integers failed"; }, { "code": 6050; "name": "noFarmForReserve"; "msg": "This reserve does not have a farm"; }, { "code": 6051; "name": "incorrectInstructionInPosition"; "msg": "Wrong instruction at expected position"; }, { "code": 6052; "name": "noPriceFound"; "msg": "No price found"; }, { "code": 6053; "name": "invalidTwapConfig"; "msg": "Invalid Twap configuration: Twap is enabled but one of the enabled price doesn't have a twap"; }, { "code": 6054; "name": "invalidPythPriceAccount"; "msg": "Pyth price account does not match configuration"; }, { "code": 6055; "name": "invalidSwitchboardAccount"; "msg": "Switchboard account(s) do not match configuration"; }, { "code": 6056; "name": "invalidScopePriceAccount"; "msg": "Scope price account does not match configuration"; }, { "code": 6057; "name": "obligationCollateralLtvZero"; "msg": "The obligation has one collateral with an LTV set to 0. Withdraw it before withdrawing other collaterals"; }, { "code": 6058; "name": "invalidObligationSeedsValue"; "msg": "Seeds must be default pubkeys for tag 0, and mint addresses for tag 1 or 2"; }, { "code": 6059; "name": "deprecatedInvalidObligationId"; "msg": "[DEPRECATED] Obligation id must be 0"; }, { "code": 6060; "name": "invalidBorrowRateCurvePoint"; "msg": "Invalid borrow rate curve point"; }, { "code": 6061; "name": "invalidUtilizationRate"; "msg": "Invalid utilization rate"; }, { "code": 6062; "name": "cannotSocializeObligationWithCollateral"; "msg": "Obligation hasn't been fully liquidated and debt cannot be socialized."; }, { "code": 6063; "name": "obligationEmpty"; "msg": "Obligation has no borrows or deposits."; }, { "code": 6064; "name": "withdrawalCapReached"; "msg": "Withdrawal cap is reached"; }, { "code": 6065; "name": "lastTimestampGreaterThanCurrent"; "msg": "The last interval start timestamp is greater than the current timestamp"; }, { "code": 6066; "name": "liquidationRewardTooSmall"; "msg": "The reward amount is less than the minimum acceptable received liquidity"; }, { "code": 6067; "name": "isolatedAssetTierViolation"; "msg": "Isolated Asset Tier Violation"; }, { "code": 6068; "name": "inconsistentElevationGroup"; "msg": "The obligation's elevation group and the reserve's are not the same"; }, { "code": 6069; "name": "invalidElevationGroup"; "msg": "The elevation group chosen for the reserve does not exist in the lending market"; }, { "code": 6070; "name": "invalidElevationGroupConfig"; "msg": "The elevation group updated has wrong parameters set"; }, { "code": 6071; "name": "unhealthyElevationGroupLtv"; "msg": "The current obligation must have most or all its debt repaid before changing the elevation group"; }, { "code": 6072; "name": "elevationGroupNewLoansDisabled"; "msg": "Elevation group does not accept any new loans or any new borrows/withdrawals"; }, { "code": 6073; "name": "reserveDeprecated"; "msg": "Reserve was deprecated, no longer usable"; }, { "code": 6074; "name": "referrerAccountNotInitialized"; "msg": "Referrer account not initialized"; }, { "code": 6075; "name": "referrerAccountMintMissmatch"; "msg": "Referrer account mint does not match the operation reserve mint"; }, { "code": 6076; "name": "referrerAccountWrongAddress"; "msg": "Referrer account address is not a valid program address"; }, { "code": 6077; "name": "referrerAccountReferrerMissmatch"; "msg": "Referrer account referrer does not match the owner referrer"; }, { "code": 6078; "name": "referrerAccountMissing"; "msg": "Referrer account missing for obligation with referrer"; }, { "code": 6079; "name": "insufficientReferralFeesToRedeem"; "msg": "Insufficient referral fees to claim or no liquidity available"; }, { "code": 6080; "name": "cpiDisabled"; "msg": "CPI disabled for this instruction"; }, { "code": 6081; "name": "shortUrlNotAsciiAlphanumeric"; "msg": "Referrer short_url is not ascii alphanumeric"; }, { "code": 6082; "name": "reserveObsolete"; "msg": "Reserve is marked as obsolete"; }, { "code": 6083; "name": "elevationGroupAlreadyActivated"; "msg": "Obligation already part of the same elevation group"; }, { "code": 6084; "name": "obligationInObsoleteReserve"; "msg": "Obligation has a deposit or borrow in an obsolete reserve"; }, { "code": 6085; "name": "referrerStateOwnerMismatch"; "msg": "Referrer state owner does not match the given signer"; }, { "code": 6086; "name": "userMetadataOwnerAlreadySet"; "msg": "User metadata owner is already set"; }, { "code": 6087; "name": "collateralNonLiquidatable"; "msg": "This collateral cannot be liquidated (LTV set to 0)"; }, { "code": 6088; "name": "borrowingDisabled"; "msg": "Borrowing is disabled"; }, { "code": 6089; "name": "borrowLimitExceeded"; "msg": "Cannot borrow above borrow limit"; }, { "code": 6090; "name": "depositLimitExceeded"; "msg": "Cannot deposit above deposit limit"; }, { "code": 6091; "name": "borrowingDisabledOutsideElevationGroup"; "msg": "Reserve does not accept any new borrows outside elevation group"; }, { "code": 6092; "name": "netValueRemainingTooSmall"; "msg": "Net value remaining too small"; }, { "code": 6093; "name": "worseLtvBlocked"; "msg": "Cannot get the obligation in a worse position"; }, { "code": 6094; "name": "liabilitiesBiggerThanAssets"; "msg": "Cannot have more liabilities than assets in a position"; }, { "code": 6095; "name": "reserveTokenBalanceMismatch"; "msg": "Reserve state and token account cannot drift"; }, { "code": 6096; "name": "reserveVaultBalanceMismatch"; "msg": "Reserve token account has been unexpectedly modified"; }, { "code": 6097; "name": "reserveAccountingMismatch"; "msg": "Reserve internal state accounting has been unexpectedly modified"; }, { "code": 6098; "name": "borrowingAboveUtilizationRateDisabled"; "msg": "Borrowing above set utilization rate is disabled"; }, { "code": 6099; "name": "liquidationBorrowFactorPriority"; "msg": "Liquidation must prioritize the debt with the highest borrow factor"; }, { "code": 6100; "name": "liquidationLowestLiquidationLtvPriority"; "msg": "Liquidation must prioritize the collateral with the lowest liquidation LTV"; }, { "code": 6101; "name": "elevationGroupBorrowLimitExceeded"; "msg": "Elevation group borrow limit exceeded"; }, { "code": 6102; "name": "elevationGroupWithoutDebtReserve"; "msg": "The elevation group does not have a debt reserve defined"; }, { "code": 6103; "name": "elevationGroupMaxCollateralReserveZero"; "msg": "The elevation group does not allow any collateral reserves"; }, { "code": 6104; "name": "elevationGroupHasAnotherDebtReserve"; "msg": "In elevation group attempt to borrow from a reserve that is not the debt reserve"; }, { "code": 6105; "name": "elevationGroupDebtReserveAsCollateral"; "msg": "The elevation group's debt reserve cannot be used as a collateral reserve"; }, { "code": 6106; "name": "obligationCollateralExceedsElevationGroupLimit"; "msg": "Obligation have more collateral than the maximum allowed by the elevation group"; }, { "code": 6107; "name": "obligationElevationGroupMultipleDebtReserve"; "msg": "Obligation is an elevation group but have more than one debt reserve"; }, { "code": 6108; "name": "unsupportedTokenExtension"; "msg": "Mint has a token (2022) extension that is not supported"; }, { "code": 6109; "name": "invalidTokenAccount"; "msg": "Can't have an spl token mint with a t22 account"; }, { "code": 6110; "name": "depositDisabledOutsideElevationGroup"; "msg": "Can't deposit into this reserve outside elevation group"; }, { "code": 6111; "name": "cannotCalculateReferralAmountDueToSlotsMismatch"; "msg": "Cannot calculate referral amount due to slots mismatch"; }, { "code": 6112; "name": "obligationOwnersMustMatch"; "msg": "Obligation owners must match"; }, { "code": 6113; "name": "obligationsMustMatch"; "msg": "Obligations must match"; }, { "code": 6114; "name": "lendingMarketsMustMatch"; "msg": "Lending markets must match"; }, { "code": 6115; "name": "obligationCurrentlyMarkedForDeleveraging"; "msg": "Obligation is already marked for deleveraging"; }, { "code": 6116; "name": "maximumWithdrawValueZero"; "msg": "Maximum withdrawable value of this collateral is zero, LTV needs improved"; }, { "code": 6117; "name": "zeroMaxLtvAssetsInDeposits"; "msg": "No max LTV 0 assets allowed in deposits for repay and withdraw"; }, { "code": 6118; "name": "lowestLtvAssetsPriority"; "msg": "Withdrawing must prioritize the collateral with the lowest reserve max-LTV"; }, { "code": 6119; "name": "worseLtvThanUnhealthyLtv"; "msg": "Cannot get the obligation liquidatable"; }, { "code": 6120; "name": "farmAccountsMissing"; "msg": "Farm accounts to refresh are missing"; }, { "code": 6121; "name": "repayTooSmallForFullLiquidation"; "msg": "Repay amount is too small to satisfy the mandatory full liquidation"; }, { "code": 6122; "name": "insufficientRepayAmount"; "msg": "Liquidator provided repay amount lower than required by liquidation rules"; }, { "code": 6123; "name": "orderIndexOutOfBounds"; "msg": "Obligation order of the given index cannot exist"; }, { "code": 6124; "name": "invalidOrderConfiguration"; "msg": "Given order configuration has wrong parameters"; }, { "code": 6125; "name": "orderConfigurationNotSupportedByObligation"; "msg": "Given order configuration cannot be used with the current state of the obligation"; }, { "code": 6126; "name": "operationNotPermittedWithCurrentObligationOrders"; "msg": "Single debt, single collateral obligation orders have to be cancelled before changing the deposit/borrow count"; }, { "code": 6127; "name": "operationNotPermittedMarketImmutable"; "msg": "Cannot update lending market because it is set as immutable"; }, { "code": 6128; "name": "orderCreationDisabled"; "msg": "Creation of new orders is disabled"; }, { "code": 6129; "name": "noUpgradeAuthority"; "msg": "Cannot initialize global config because there is no upgrade authority to the program"; } ]; "types": [ { "name": "updateConfigMode"; "type": { "kind": "enum"; "variants": [ { "name": "updateLoanToValuePct"; }, { "name": "updateMaxLiquidationBonusBps"; }, { "name": "updateLiquidationThresholdPct"; }, { "name": "updateProtocolLiquidationFee"; }, { "name": "updateProtocolTakeRate"; }, { "name": "updateFeesBorrowFee"; }, { "name": "updateFeesFlashLoanFee"; }, { "name": "deprecatedUpdateFeesReferralFeeBps"; }, { "name": "updateDepositLimit"; }, { "name": "updateBorrowLimit"; }, { "name": "updateTokenInfoLowerHeuristic"; }, { "name": "updateTokenInfoUpperHeuristic"; }, { "name": "updateTokenInfoExpHeuristic"; }, { "name": "updateTokenInfoTwapDivergence"; }, { "name": "updateTokenInfoScopeTwap"; }, { "name": "updateTokenInfoScopeChain"; }, { "name": "updateTokenInfoName"; }, { "name": "updateTokenInfoPriceMaxAge"; }, { "name": "updateTokenInfoTwapMaxAge"; }, { "name": "updateScopePriceFeed"; }, { "name": "updatePythPrice"; }, { "name": "updateSwitchboardFeed"; }, { "name": "updateSwitchboardTwapFeed"; }, { "name": "updateBorrowRateCurve"; }, { "name": "updateEntireReserveConfig"; }, { "name": "updateDebtWithdrawalCap"; }, { "name": "updateDepositWithdrawalCap"; }, { "name": "deprecatedUpdateDebtWithdrawalCapCurrentTotal"; }, { "name": "deprecatedUpdateDepositWithdrawalCapCurrentTotal"; }, { "name": "updateBadDebtLiquidationBonusBps"; }, { "name": "updateMinLiquidationBonusBps"; }, { "name": "updateDeleveragingMarginCallPeriod"; }, { "name": "updateBorrowFactor"; }, { "name": "updateAssetTier"; }, { "name": "updateElevationGroup"; }, { "name": "updateDeleveragingThresholdDecreaseBpsPerDay"; }, { "name": "deprecatedUpdateMultiplierSideBoost"; }, { "name": "deprecatedUpdateMultiplierTagBoost"; }, { "name": "updateReserveStatus"; }, { "name": "updateFarmCollateral"; }, { "name": "updateFarmDebt"; }, { "name": "updateDisableUsageAsCollateralOutsideEmode"; }, { "name": "updateBlockBorrowingAboveUtilizationPct"; }, { "name": "updateBlockPriceUsage"; }, { "name": "updateBorrowLimitOutsideElevationGroup"; }, { "name": "updateBorrowLimitsInElevationGroupAgainstThisReserve"; }, { "name": "updateHostFixedInterestRateBps"; }, { "name": "updateAutodeleverageEnabled"; }, { "name": "updateDeleveragingBonusIncreaseBpsPerDay"; }, { "name": "updateProtocolOrderExecutionFee"; } ]; }; }, { "name": "updateLendingMarketConfigValue"; "type": { "kind": "enum"; "variants": [ { "name": "bool"; "fields": [ "bool" ]; }, { "name": "u8"; "fields": [ "u8" ]; }, { "name": "u8Array"; "fields": [ { "array": [ "u8", 8 ]; } ]; }, { "name": "u16"; "fields": [ "u16" ]; }, { "name": "u64"; "fields": [ "u64" ]; }, { "name": "u128"; "fields": [ "u128" ]; }, { "name": "pubkey"; "fields": [ "pubkey" ]; }, { "name": "elevationGroup"; "fields": [ { "defined": { "name": "elevationGroup"; }; } ]; }, { "name": "name"; "fields": [ { "array": [ "u8", 32 ]; } ]; } ]; }; }, { "name": "updateLendingMarketMode"; "type": { "kind": "enum"; "variants": [ { "name": "updateOwner"; }, { "name": "updateEmergencyMode"; }, { "name": "updateLiquidationCloseFactor"; }, { "name": "updateLiquidationMaxValue"; }, { "name": "deprecatedUpdateGlobalUnhealthyBorrow"; }, { "name": "updateGlobalAllowedBorrow"; }, { "name": "updateRiskCouncil"; }, { "name": "updateMinFullLiquidationThreshold"; }, { "name": "updateInsolvencyRiskLtv"; }, { "name": "updateElevationGroup"; }, { "name": "updateReferralFeeBps"; }, { "name": "deprecatedUpdateMultiplierPoints"; }, { "name": "updatePriceRefreshTriggerToMaxAgePct"; }, { "name": "updateAutodeleverageEnabled"; }, { "name": "updateBorrowingDisabled"; }, { "name": "updateMinNetValueObligationPostAction"; }, { "name": "updateMinValueLtvSkipPriorityLiqCheck"; }, { "name": "updateMinValueBfSkipPriorityLiqCheck"; }, { "name": "updatePaddingFields"; }, { "name": "updateName"; }, { "name": "updateIndividualAutodeleverageMarginCallPeriodSecs"; }, { "name": "updateInitialDepositAmount"; }, { "name": "updateObligationOrderExecutionEnabled"; }, { "name": "updateImmutableFlag"; }, { "name": "updateObligationOrderCreationEnabled"; } ]; }; }, { "name": "updateGlobalConfigMode"; "type": { "kind": "enum"; "variants": [ { "name": "pendingAdmin"; }, { "name": "feeCollector"; } ]; }; }, { "name": "lastUpdate"; "docs": [ "Last update state" ]; "type": { "kind": "struct"; "fields": [ { "name": "slot"; "docs": [ "Last slot when updated" ]; "type": "u64"; }, { "name": "stale"; "docs": [ "True when marked stale, false when slot updated" ]; "type": "u8"; }, { "name": "priceStatus"; "docs": [ "Status of the prices used to calculate the last update" ]; "type": "u8"; }, { "name": "placeholder"; "type": { "array": [ "u8", 6 ]; }; } ]; }; }, { "name": "elevationGroup"; "type": { "kind": "struct"; "fields": [ { "name": "maxLiquidationBonusBps"; "type": "u16"; }, { "name": "id"; "type": "u8"; }, { "name": "ltvPct"; "type": "u8"; }, { "name": "liquidationThresholdPct"; "type": "u8"; }, { "name": "allowNewLoans"; "type": "u8"; }, { "name": "maxReservesAsCollateral"; "type": "u8"; }, { "name": "padding0"; "type": "u8"; }, { "name": "debtReserve"; "docs": [ "Mandatory debt reserve for this elevation group" ]; "type": "pubkey"; }, { "name": "padding1"; "type": { "array": [ "u64", 4 ]; }; } ]; }; }, { "name": "initObligationArgs"; "type": { "kind": "struct"; "fields": [ { "name": "tag"; "type": "u8"; }, { "name": "id"; "type": "u8"; } ]; }; }, { "name": "obligationCollateral"; "docs": [ "Obligation collateral state" ]; "type": { "kind": "struct"; "fields": [ { "name": "depositReserve"; "docs": [ "Reserve collateral is deposited to" ]; "type": "pubkey"; }, { "name": "depositedAmount"; "docs": [ "Amount of collateral deposited" ]; "type": "u64"; }, { "name": "marketValueSf"; "docs": [ "Collateral market value in quote currency (scaled fraction)" ]; "type": "u128"; }, { "name": "borrowedAmountAgainstThisCollateralInElevationGroup"; "docs": [ "Debt amount (lamport) taken against this collateral.", "(only meaningful if this obligation is part of an elevation group, otherwise 0)", "This is only indicative of the debt computed on the last refresh obligation.", "If the obligation have multiple collateral this value is the same for all of them." ]; "type": "u64"; }, { "name": "padding"; "type": { "array": [ "u64", 9 ]; }; } ]; }; }, { "name": "obligationLiquidity"; "docs": [ "Obligation liquidity state" ]; "type": { "kind": "struct"; "fields": [ { "name": "borrowReserve"; "docs": [ "Reserve liquidity is borrowed from" ]; "type": "pubkey"; }, { "name": "cumulativeBorrowRateBsf"; "docs": [ "Borrow rate used for calculating interest (big scaled fraction)" ]; "type": { "defined": { "name": "bigFractionBytes"; }; }; }, { "name": "padding"; "type": "u64"; }, { "name": "borrowedAmountSf"; "docs": [ "Amount of liquidity borrowed plus interest (scaled fraction)" ]; "type": "u128"; }, { "name": "marketValueSf"; "docs": [ "Liquidity market value in quote currency (scaled fraction)" ]; "type": "u128"; }, { "name": "borrowFactorAdjustedMarketValueSf"; "docs": [ "Risk adjusted liquidity market value in quote currency - DEBUG ONLY - use market_value instead" ]; "type": "u128"; }, { "name": "borrowedAmountOutsideElevationGroups"; "docs": [ "Amount of liquidity borrowed outside of an elevation group" ]; "type": "u64"; }, { "name": "padding2"; "type": { "array": [ "u64", 7 ]; }; } ]; }; }, { "name": "obligationOrder"; "docs": [ "A single obligation order.", "See [Obligation::orders]." ]; "type": { "kind": "struct"; "fields": [ { "name": "conditionThresholdSf"; "docs": [ "A threshold value used by the condition (scaled [Fraction]).", "The exact meaning depends on the specific [Self::condition_type].", "", "Examples:", "- when `condition_type == 2 (UserLtvBelow)`:", "then a value of `0.455` here means that the order is active only when the obligation's", "user LTV is less than `0.455` (i.e. < 45.5%).", "- when `condition_type == 3 (DebtCollPriceRatioAbove)`:", "assuming the obligation uses BTC collateral for SOL debt, then a value of `491.3` here", "means that the order is active only when the BTC-SOL price is greater than `491.3` (i.e.", "> 491.3 SOL per BTC)." ]; "type": "u128"; }, { "name": "opportunityParameterSf"; "docs": [ "A configuration parameter used by the opportunity (scaled [Fraction]).", "The exact meaning depends on the specific [Self::opportunity_type].", "", "Examples:", "- when `opportunity_type == 0 (DeleverageSingleDebtAmount)`:", "Assuming the obligation uses BTC collateral for SOL debt, then a value of `1_234_000_000`", "here means that a liquidator may repay up to 1234000000 lamports (i.e. 1.234 SOL) on this", "obligation.", "Note: the special value of [Fraction::MAX] is *not* allowed in this case.", "- when `opportunity_type == 1 (DeleverageAllDebtAmount)`:", "The only allowed value in this case is [Fraction::MAX] (to emphasize that *all* debt", "should be repaid)." ]; "type": "u128"; }, { "name": "minExecutionBonusBps"; "docs": [ "A *minimum* additional fraction of collateral transferred to the liquidator, in bps.", "", "The minimum bonus is applied exactly when the [Self::condition_threshold_sf] is met, and", "grows linearly towards the [Self::max_execution_bonus_bps].", "", "Example: a value of `50` here means 50bps == 0.5% bonus for an \"LTV > 65%\" order, when", "executed precisely at the moment LTV exceeds 65%." ]; "type": "u16"; }, { "name": "maxExecutionBonusBps"; "docs": [ "A *maximum* additional fraction of collateral transferred to the liquidator, in bps.", "", "The maximum bonus is applied at the relevant \"extreme\" state of the obligation, i.e.:", "- for a stop-loss condition, it is a point at which the obligation becomes liquidatable;", "- for a take-profit condition, it is a point at which obligation has 0% LTV.", "", "In non-extreme states, the actual bonus value is interpolated linearly, starting from", "[Self::min_execution_bonus_bps] (at the point specified by the order's condition).", "", "Example: a value of `300` here means 300bps == 3.0% bonus for a \"debt/coll price > 140\"", "order, when executed at a higher price = 200, at which the obligation's LTV happens to", "be equal to its liquidation LTV." ]; "type": "u16"; }, { "name": "conditionType"; "docs": [ "Serialized [ConditionType].", "The entire order is void when this is zeroed (i.e. representing [ConditionType::Never]).", "", "Example: a value of `2` here denotes `UserLtvBelow` condition type. Of course, to", "interpret this condition, we also need to take the [Self::condition_threshold_sf] into", "account." ]; "type": "u8"; }, { "name": "opportunityType"; "docs": [ "Serialized [OpportunityType].", "", "Example: a value of `0` here denotes `DeleverageSingleDebtAmount` opportunity. Of course, to", "interpret this opportunity, we also need to take the [Self::opportunity_parameter_sf] into", "account." ]; "type": "u8"; }, { "name": "padding1"; "docs": [ "Internal padding.", "The fields above take up 2+2+1+1 bytes = 48 bits, which means we need 80 bits = 10 bytes to", "align with `u128`s." ]; "type": { "array": [ "u8", 10 ]; }; }, { "name": "padding2"; "docs": [ "End padding.", "The total size of a single instance is 8*u128 = 128 bytes." ]; "type": { "array": [ "u128", 5 ]; }; } ]; }; }, { "name": "assetTier"; "type": { "kind": "enum"; "variants": [ { "name": "regular"; }, { "name": "isolatedCollateral"; }, { "name": "isolatedDebt"; } ]; }; }, { "name": "bigFractionBytes"; "type": { "kind": "struct"; "fields": [ { "name": "value"; "type": { "array": [ "u64", 4 ]; }; }, { "name": "padding"; "type": { "array": [ "u64", 2 ]; }; } ]; }; }, { "name": "feeCalculation"; "docs": [ "Calculate fees exlusive or inclusive of an amount" ]; "type": { "kind": "enum"; "variants": [ { "name": "exclusive"; }, { "name": "inclusive"; } ]; }; }, { "name": "reserveCollateral"; "docs": [ "Reserve collateral" ]; "type": { "kind": "struct"; "fields": [ { "name": "mintPubkey"; "docs": [ "Reserve collateral mint address" ]; "type": "pubkey"; }, { "name": "mintTotalSupply"; "docs": [ "Reserve collateral mint supply, used for exchange rate" ]; "type": "u64"; }, { "name": "supplyVault"; "docs": [ "Reserve collateral supply address" ]; "type": "pubkey"; }, { "name": "padding1"; "type": { "array": [ "u128", 32 ]; }; }, { "name": "padding2"; "type": { "array": [ "u128", 32 ]; }; } ]; }; }, { "name": "reserveConfig"; "docs": [ "Reserve configuration values" ]; "type": { "kind": "struct"; "fields": [ { "name": "status"; "docs": [ "Status of the reserve Active/Obsolete/Hidden" ]; "type": "u8"; }, { "name": "assetTier"; "docs": [ "Asset tier -> 0 - regular (collateral & debt), 1 - isolated collateral, 2 - isolated debt" ]; "type": "u8"; }, { "name": "hostFixedInterestRateBps"; "docs": [ "Flat rate that goes to the host" ]; "type": "u16"; }, { "name": "reserved2"; "docs": [ "[DEPRECATED] Space that used to hold 2 fields:", "- Boost for side (debt or collateral)", "- Reward points multiplier per obligation type", "Can be re-used after making sure all underlying production account data is zeroed." ]; "type": { "array": [ "u8", 9 ]; }; }, { "name": "protocolOrderExecutionFeePct"; "docs": [ "Cut of the order execution bonus that the protocol receives, as a percentage" ]; "type": "u8"; }, { "name": "protocolTakeRatePct"; "docs": [ "Protocol take rate is the amount borrowed interest protocol receives, as a percentage" ]; "type": "u8"; }, { "name": "protocolLiquidationFeePct"; "docs": [ "Cut of the liquidation bonus that the protocol receives, as a percentage" ]; "type": "u8"; }, { "name": "loanToValuePct"; "docs": [ "Target ratio of the value of borrows to deposits, as a percentage", "0 if use as collateral is disabled" ]; "type": "u8"; }, { "name": "liquidationThresholdPct"; "docs": [ "Loan to value ratio at which an obligation can be liquidated, as percentage" ]; "type": "u8"; }, { "name": "minLiquidationBonusBps"; "docs": [ "Minimum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps" ]; "type": "u16"; }, { "name": "maxLiquidationBonusBps"; "docs": [ "Maximum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps" ]; "type": "u16"; }, { "name": "badDebtLiquidationBonusBps"; "docs": [ "Bad debt liquidation bonus for an undercollateralized obligation, as bps" ]; "type": "u16"; }, { "name": "deleveragingMarginCallPeriodSecs"; "docs": [ "Time in seconds that must pass before redemptions are enabled after the deposit limit is", "crossed.", "Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case." ]; "type": "u64"; }, { "name": "deleveragingThresholdDecreaseBpsPerDay"; "docs": [ "The rate at which the deleveraging threshold decreases, in bps per day.", "Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case." ]; "type": "u64"; }, { "name": "fees"; "docs": [ "Program owner fees assessed, separate from gains due to interest accrual" ]; "type": { "defined": { "name": "reserveFees"; }; }; }, { "name": "borrowRateCurve"; "docs": [ "Borrow rate curve based on utilization" ]; "type": { "defined": { "name": "borrowRateCurve"; }; }; }, { "name": "borrowFactorPct"; "docs": [ "Borrow factor in percentage - used for risk adjustment" ]; "type": "u64"; }, { "name": "depositLimit"; "docs": [ "Maximum deposit limit of liquidity in native units, u64::MAX for inf" ]; "type": "u64"; }, { "name": "borrowLimit"; "docs": [ "Maximum amount borrowed, u64::MAX for inf, 0 to disable borrows (protected deposits)" ]; "type": "u64"; }, { "name": "tokenInfo"; "docs": [ "Token id from TokenInfos struct" ]; "type": { "defined": { "name": "tokenInfo"; }; }; }, { "name": "depositWithdrawalCap"; "docs": [ "Deposit withdrawal caps - deposit & redeem" ]; "type": { "defined": { "name": "withdrawalCaps"; }; }; }, { "name": "debtWithdrawalCap"; "docs": [ "Debt withdrawal caps - borrow & repay" ]; "type": { "defined": { "name": "withdrawalCaps"; }; }; }, { "name": "elevationGroups"; "type": { "array": [ "u8", 20 ]; }; }, { "name": "disableUsageAsCollOutsideEmode"; "type": "u8"; }, { "name": "utilizationLimitBlockBorrowingAbovePct"; "docs": [ "Utilization (in percentage) above which borrowing is blocked. 0 to disable." ]; "type": "u8"; }, { "name": "autodeleverageEnabled"; "docs": [ "Whether this reserve should be subject to auto-deleveraging after deposit or borrow limit is", "crossed.", "Besides this flag, the lending market's flag also needs to be enabled (logical `AND`).", "**NOTE:** the manual \"target LTV\" deleveraging (enabled by the risk council for individual", "obligations) is NOT affected by this flag." ]; "type": "u8"; }, { "name": "reserved1"; "type": { "array": [ "u8", 1 ]; }; }, { "name": "borrowLimitOutsideElevationGroup"; "docs": [ "Maximum amount liquidity of this reserve borrowed outside all elevation groups", "- u64::MAX for inf", "- 0 to disable borrows outside elevation groups" ]; "type": "u64"; }, { "name": "borrowLimitAgainstThisCollateralInElevationGroup"; "docs": [ "Defines the maximum amount (in lamports of elevation group debt asset)", "that can be borrowed when this reserve is used as collateral.", "- u64::MAX for inf", "- 0 to disable borrows in this elevation group (expected value for the debt asset)" ]; "type": { "array": [ "u64", 32 ]; }; }, { "name": "deleveragingBonusIncreaseBpsPerDay"; "docs": [ "The rate at which the deleveraging-related liquidation bonus increases, in bps per day.", "Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case." ]; "type": "u64"; } ]; }; }, { "name": "reserveFarmKind"; "type": { "kind": "enum"; "variants": [ { "name": "collateral"; }, { "name": "debt"; } ]; }; }, { "name": "reserveFees"; "docs": [ "Additional fee information on a reserve", "", "These exist separately from interest accrual fees, and are specifically for the program owner", "and referral fee. The fees are paid out as a percentage of liquidity token amounts during", "repayments and liquidations." ]; "type": { "kind": "struct"; "fields": [ { "name": "borrowFeeSf"; "docs": [ "Fee assessed on `BorrowObligationLiquidity`, as scaled fraction (60 bits fractional part)", "Must be between `0` and `2^60`, such that `2^60 = 1`. A few examples for", "clarity:", "1% = (1 << 60) / 100 = 11529215046068470", "0.01% (1 basis point) = 115292150460685", "0.00001% (Aave borrow fee) = 115292150461" ]; "type": "u64"; }, { "name": "flashLoanFeeSf"; "docs": [ "Fee for flash loan, expressed as scaled fraction.", "0.3% (Aave flash loan fee) = 0.003 * 2^60 = 3458764513820541" ]; "type": "u64"; }, { "name": "padding"; "docs": [ "Used for allignment" ]; "type": { "array": [ "u8", 8 ]; }; } ]; }; }, { "name": "reserveLiquidity"; "docs": [ "Reserve liquidity" ]; "type": { "kind": "struct"; "fields": [ { "name": "mintPubkey"; "docs": [ "Reserve liquidity mint address" ]; "type": "pubkey"; }, { "name": "supplyVault"; "docs": [ "Reserve liquidity supply address" ]; "type": "pubkey"; }, { "name": "feeVault"; "docs": [ "Reserve liquidity fee collection address" ]; "type": "pubkey"; }, { "name": "availableAmount"; "docs": [ "Reserve liquidity available" ]; "type": "u64"; }, { "name": "borrowedAmountSf"; "docs": [ "Reserve liquidity borrowed (scaled fraction)" ]; "type": "u128"; }, { "name": "marketPriceSf"; "docs": [ "Reserve liquidity market price in quote currency (scaled fraction)" ]; "type": "u128"; }, { "name": "marketPriceLastUpdatedTs"; "docs": [ "Unix timestamp of the market price (from the oracle)" ]; "type": "u64"; }, { "name": "mintDecimals"; "docs": [ "Reserve liquidity mint decimals" ]; "type": "u64"; }, { "name": "depositLimitCrossedTimestamp"; "docs": [ "Timestamp when the last refresh reserve detected that the liquidity amount is above the deposit cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.", "If the threshold is not crossed, then the timestamp is set to 0" ]; "type": "u64"; }, { "name": "borrowLimitCrossedTimestamp"; "docs": [ "Timestamp when the last refresh reserve detected that the borrowed amount is above the borrow cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.", "If the threshold is not crossed, then the timestamp is set to 0" ]; "type": "u64"; }, { "name": "cumulativeBorrowRateBsf"; "docs": [ "Reserve liquidity cumulative borrow rate (scaled fraction)" ]; "type": { "defined": { "name": "bigFractionBytes"; }; }; }, { "name": "accumulatedProtocolFeesSf"; "docs": [ "Reserve cumulative protocol fees (scaled fraction)" ]; "type": "u128"; }, { "name": "accumulatedReferrerFeesSf"; "docs": [ "Reserve cumulative referrer fees (scaled fraction)" ]; "type": "u128"; }, { "name": "pendingReferrerFeesSf"; "docs": [ "Reserve pending referrer fees, to be claimed in refresh_obligation by referrer or protocol (scaled fraction)" ]; "type": "u128"; }, { "name": "absoluteReferralRateSf"; "docs": [ "Reserve referrer fee absolute rate calculated at each refresh_reserve operation (scaled fraction)" ]; "type": "u128"; }, { "name": "tokenProgram"; "docs": [ "Token program of the liquidity mint" ]; "type": "pubkey"; }, { "name": "padding2"; "type": { "array": [ "u64", 51 ]; }; }, { "name": "padding3"; "type": { "array": [ "u128", 32 ]; }; } ]; }; }, { "name": "reserveStatus"; "type": { "kind": "enum"; "variants": [ { "name": "active"; }, { "name": "obsolete"; }, { "name": "hidden"; } ]; }; }, { "name": "withdrawalCaps"; "docs": [ "Reserve Withdrawal Caps State" ]; "type": { "kind": "struct"; "fields": [ { "name": "configCapacity"; "type": "i64"; }, { "name": "currentTotal"; "type": "i64"; }, { "name": "lastIntervalStartTimestamp"; "type": "u64"; }, { "name": "configIntervalLengthSeconds"; "type": "u64"; } ]; }; }, { "name": "priceHeuristic"; "type": { "kind": "struct"; "fields": [ { "name": "lower"; "docs": [ "Lower value of acceptable price" ]; "type": "u64"; }, { "name": "upper"; "docs": [ "Upper value of acceptable price" ]; "type": "u64"; }, { "name": "exp"; "docs": [ "Number of decimals of the previously defined values" ]; "type": "u64"; } ]; }; }, { "name": "pythConfiguration"; "type": { "kind": "struct"; "fields": [ { "name": "price"; "docs": [ "Pubkey of the base price feed (disabled if `null` or `default`)" ]; "type": "pubkey"; } ]; }; }, { "name": "scopeConfiguration"; "type": { "kind": "struct"; "fields": [ { "name": "priceFeed"; "docs": [ "Pubkey of the scope price feed (disabled if `null` or `default`)" ]; "type": "pubkey"; }, { "name": "priceChain"; "docs": [ "This is the scope_id price chain that results in a price for the token" ]; "type": { "array": [ "u16", 4 ]; }; }, { "name": "twapChain"; "docs": [ "This is the scope_id price chain for the twap" ]; "type": { "array": [ "u16", 4 ]; }; } ]; }; }, { "name": "switchboardConfiguration"; "type": { "kind": "struct"; "fields": [ { "name": "priceAggregator"; "docs": [ "Pubkey of the base price feed (disabled if `null` or `default`)" ]; "type": "pubkey"; }, { "name": "twapAggregator"; "type": "pubkey"; } ]; }; }, { "name": "tokenInfo"; "type": { "kind": "struct"; "fields": [ { "name": "name"; "docs": [ "UTF-8 encoded name of the token (null-terminated)" ]; "type": { "array": [ "u8", 32 ]; }; }, { "name": "heuristic"; "docs": [ "Heuristics limits of acceptable price" ]; "type": { "defined": { "name": "priceHeuristic"; }; }; }, { "name": "maxTwapDivergenceBps"; "docs": [ "Max divergence between twap and price in bps" ]; "type": "u64"; }, { "name": "maxAgePriceSeconds"; "type": "u64"; }, { "name": "maxAgeTwapSeconds"; "type": "u64"; }, { "name": "scopeConfiguration"; "docs": [ "Scope price configuration" ]; "type": { "defined": { "name": "scopeConfiguration"; }; }; }, { "name": "switchboardConfiguration"; "docs": [ "Switchboard configuration" ]; "type": { "defined": { "name": "switchboardConfiguration"; }; }; }, { "name": "pythConfiguration"; "docs": [ "Pyth configuration" ]; "type": { "defined": { "name": "pythConfiguration"; }; }; }, { "name": "blockPriceUsage"; "type": "u8"; }, { "name": "reserved"; "type": { "array": [ "u8", 7 ]; }; }, { "name": "padding"; "type": { "array": [ "u64", 19 ]; }; } ]; }; }, { "name": "borrowRateCurve"; "type": { "kind": "struct"; "fields": [ { "name": "points"; "type": { "array": [ { "defined": { "name": "curvePoint"; }; }, 11 ]; }; } ]; }; }, { "name": "curvePoint"; "type": { "kind": "struct"; "fields": [ { "name": "utilizationRateBps"; "type": "u32"; }, { "name": "borrowRateBps"; "type": "u32"; } ]; }; }, { "name": "userState"; "type": { "kind": "struct"; "fields": [ { "name": "userId"; "type": "u64"; }, { "name": "farmState"; "type": "pubkey"; }, { "name": "owner"; "type": "pubkey"; }, { "name": "isFarmDelegated"; "docs": [ "Indicate if this user state is part of a delegated farm" ]; "type": "u8"; }, { "name": "padding0"; "type": { "array": [ "u8", 7 ]; }; }, { "name": "rewardsTallyScaled"; "docs": [ "Rewards tally used for computation of gained rewards", "(scaled from `Decimal` representation)." ]; "type": { "array": [ "u128", 10 ]; }; }, { "name": "rewardsIssuedUnclaimed"; "docs": [ "Number of reward tokens ready for claim" ]; "type": { "array": [ "u64", 10 ]; }; }, { "name": "lastClaimTs"; "type": { "array": [ "u64", 10 ]; }; }, { "name": "activeStakeScaled"; "docs": [ "User stake deposited and usable, generating rewards and fees.", "(scaled from `Decimal` representation)." ]; "type": "u128"; }, { "name": "pendingDepositStakeScaled"; "docs": [ "User stake deposited but not usable and not generating rewards yet.", "(scaled from `Decimal` representation)." ]; "type": "u128"; }, { "name": "pendingDepositStakeTs"; "docs": [ "After this timestamp, pending user stake can be moved to user stake", "Initialized to now() + delayed user stake period" ]; "type": "u64"; }, { "name": "pendingWithdrawalUnstakeScaled"; "docs": [ "User deposits unstaked, pending for withdrawal, not usable and not generating rewards.", "(scaled from `Decimal` representation)." ]; "type": "u128"; }, { "name": "pendingWithdrawalUnstakeTs"; "docs": [ "After this timestamp, user can withdraw their deposit." ]; "type": "u64"; }, { "name": "bump"; "docs": [ "User bump used for account address validation" ]; "type": "u64"; }, { "name": "delegatee"; "docs": [ "Delegatee used for initialisation - useful to check against" ]; "type": "pubkey"; }, { "name": "lastStakeTs"; "type": "u64"; }, { "name": "padding1"; "type": { "array": [ "u64", 50 ]; }; } ]; }; }, { "name": "globalConfig"; "type": { "kind": "struct"; "fields": [ { "name": "globalAdmin"; "docs": [ "Global admin of the program" ]; "type": "pubkey"; }, { "name": "pendingAdmin"; "docs": [ "Pending admin must sign a specific transaction to become the global admin" ]; "type": "pubkey"; }, { "name": "feeCollector"; "docs": [ "Fee collector is the only allowed owner of token accounts receiving protocol fees" ]; "type": "pubkey"; }, { "name": "padding"; "docs": [ "Padding to make the struct size 1024 bytes" ]; "type": { "array": [ "u8", 928 ]; }; } ]; }; }, { "name": "lendingMarket"; "type": { "kind": "struct"; "fields": [ { "name": "version"; "docs": [ "Version of lending market" ]; "type": "u64"; }, { "name": "bumpSeed"; "docs": [ "Bump seed for derived authority address" ]; "type": "u64"; }, { "name": "lendingMarketOwner"; "docs": [ "Owner authority which can add new reserves" ]; "type": "pubkey"; }, { "name": "lendingMarketOwnerCached"; "docs": [ "Temporary cache of the lending market owner, used in update_lending_market_owner" ]; "type": "pubkey"; }, { "name": "quoteCurrency"; "docs": [ "Currency market prices are quoted in", "e.g. \"USD\" null padded (`*b\"USD\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"`) or a SPL token mint pubkey" ]; "type": { "array": [ "u8", 32 ]; }; }, { "name": "referralFeeBps"; "docs": [ "Referral fee for the lending market, as bps out of the total protocol fee" ]; "type": "u16"; }, { "name": "emergencyMode"; "type": "u8"; }, { "name": "autodeleverageEnabled"; "docs": [ "Whether the obligations on this market should be subject to auto-deleveraging after deposit", "or borrow limit is crossed.", "Besides this flag, the particular reserve's flag also needs to be enabled (logical `AND`).", "**NOTE:** this also affects the individual \"target LTV\" deleveraging." ]; "type": "u8"; }, { "name": "borrowDisabled"; "type": "u8"; }, { "name": "priceRefreshTriggerToMaxAgePct"; "docs": [ "Refresh price from oracle only if it's older than this percentage of the price max age.", "e.g. if the max age is set to 100s and this is set to 80%, the price will be refreshed if it's older than 80s.", "Price is always refreshed if this set to 0." ]; "type": "u8"; }, { "name": "liquidationMaxDebtCloseFactorPct"; "docs": [ "Percentage of the total borrowed value in an obligation available for liquidation" ]; "type": "u8"; }, { "name": "insolvencyRiskUnhealthyLtvPct"; "docs": [ "Minimum acceptable unhealthy LTV before max_debt_close_factor_pct becomes 100%" ]; "type": "u8"; }, { "name": "minFullLiquidationValueThreshold"; "docs": [ "Minimum liquidation value threshold triggering full liquidation for an obligation" ]; "type": "u64"; }, { "name": "maxLiquidatableDebtMarketValueAtOnce"; "docs": [ "Max allowed liquidation value in one ix call" ]; "type": "u64"; }, { "name": "reserved0"; "docs": [ "[DEPRECATED] Global maximum unhealthy borrow value allowed for any obligation" ]; "type": { "array": [ "u8", 8 ]; }; }, { "name": "globalAllowedBorrowValue"; "docs": [ "Global maximum allowed borrow value allowed for any obligation" ]; "type": "u64"; }, { "name": "riskCouncil"; "docs": [ "The address of the risk council, in charge of making parameter and risk decisions on behalf of the protocol" ]; "type": "pubkey"; }, { "name": "reserved1"; "docs": [ "[DEPRECATED] Reward points multiplier per obligation type" ]; "type": { "array": [ "u8", 8 ]; }; }, { "name": "elevationGroups"; "docs": [ "Elevation groups are used to group together reserves that have the same risk parameters and can bump the ltv and liquidation threshold" ]; "type": { "array": [ { "defined": { "name": "elevationGroup"; }; }, 32 ]; }; }, { "name": "elevationGroupPadding"; "type": { "array": [ "u64", 90 ]; }; }, { "name": "minNetValueInObligationSf"; "docs": [ "Min net value accepted to be found in a position after any lending action in an obligation (scaled by quote currency decimals)" ]; "type": "u128"; }, { "name": "minValueSkipLiquidationLtvChecks"; "docs": [ "Minimum value to enforce smallest ltv priority checks on the collateral reserves on liquidation" ]; "type": "u64"; }, { "name": "name"; "docs": [ "Market name, zero-padded." ]; "type": { "array": [ "u8", 32 ]; }; }, { "name": "minValueSkipLiquidationBfChecks"; "docs": [ "Minimum value to enforce highest borrow factor priority checks on the debt reserves on liquidation" ]; "type": "u64"; }, { "name": "individualAutodeleverageMarginCallPeriodSecs"; "docs": [ "Time (in seconds) that must pass before liquidation is allowed on an obligation that has", "been individually marked for auto-deleveraging (by the risk council)." ]; "type": "u64"; }, { "name": "minInitialDepositAmount"; "docs": [ "Minimum amount of deposit at creation of a reserve to prevent artificial inflation", "Note: this amount cannot be recovered, the ctoken associated are never minted" ]; "type": "u64"; }, { "name": "obligationOrderExecutionEnabled"; "docs": [ "Whether the obligation orders should be evaluated during liquidations." ]; "type": "u8"; }, { "name": "immutable"; "docs": [ "Whether the lending market is set as immutable." ]; "type": "u8"; }, { "name": "obligationOrderCreationEnabled"; "docs": [ "Whether new obligation orders can be created.", "Note: updating or cancelling existing orders is *not* affected by this flag." ]; "type": "u8"; }, { "name": "padding2"; "type": { "array": [ "u8", 5 ]; }; }, { "name": "padding1"; "type": { "array": [ "u64", 169 ]; }; } ]; }; }, { "name": "obligation"; "docs": [ "Lending market obligation state" ]; "type": { "kind": "struct"; "fields": [ { "name": "tag"; "docs": [ "Version of the struct" ]; "type": "u64"; }, { "name": "lastUpdate"; "docs": [ "Last update to collateral, liquidity, or their market values" ]; "type": { "defined": { "name": "lastUpdate"; }; }; }, { "name": "lendingMarket"; "docs": [ "Lending market address" ]; "type": "pubkey"; }, { "name": "owner"; "docs": [ "Owner authority which can borrow liquidity" ]; "type": "pubkey"; }, { "name": "deposits"; "docs": [ "Deposited collateral for the obligation, unique by deposit reserve address" ]; "type": { "array": [ { "defined": { "name": "obligationCollateral"; }; }, 8 ]; }; }, { "name": "lowestReserveDepositLiquidationLtv"; "docs": [ "Worst LTV for the collaterals backing the loan, represented as a percentage" ]; "type": "u64"; }, { "name": "depositedValueSf"; "docs": [ "Market value of deposits (scaled fraction)" ]; "type": "u128"; }, { "name": "borrows"; "docs": [ "Borrowed liquidity for the obligation, unique by borrow reserve address" ]; "type": { "array": [ { "defined": { "name": "obligationLiquidity"; }; }, 5 ]; }; }, { "name": "borrowFactorAdjustedDebtValueSf"; "docs": [ "Risk adjusted market value of borrows/debt (sum of price * borrowed_amount * borrow_factor) (scaled fraction)" ]; "type": "u128"; }, { "name": "borrowedAssetsMarketValueSf"; "docs": [ "Market value of borrows - used for max_liquidatable_borrowed_amount (scaled fraction)" ]; "type": "u128"; }, { "name": "allowedBorrowValueSf"; "docs": [ "The maximum borrow value at the weighted average loan to value ratio (scaled fraction)" ]; "type": "u128"; }, { "name": "unhealthyBorrowValueSf"; "docs": [ "The dangerous borrow value at the weighted average liquidation threshold (scaled fraction)" ]; "type": "u128"; }, { "name": "depositsAssetTiers"; "docs": [ "The asset tier of the deposits" ]; "type": { "array": [ "u8", 8 ]; }; }, { "name": "borrowsAssetTiers"; "docs": [ "The asset tier of the borrows" ]; "type": { "array": [ "u8", 5 ]; }; }, { "name": "elevationGroup"; "docs": [ "The elevation group id the obligation opted into." ]; "type": "u8"; }, { "name": "numOfObsoleteDepositReserves"; "docs": [ "The number of obsolete reserves the obligation has a deposit in" ]; "type": "u8"; }, { "name": "hasDebt"; "docs": [ "Marked = 1 if borrows array is not empty, 0 = borrows empty" ]; "type": "u8"; }, { "name": "referrer"; "docs": [ "Wallet address of the referrer" ]; "type": "pubkey"; }, { "name": "borrowingDisabled"; "docs": [ "Marked = 1 if borrowing disabled, 0 = borrowing enabled" ]; "type": "u8"; }, { "name": "autodeleverageTargetLtvPct"; "docs": [ "A target LTV set by the risk council when marking this obligation for deleveraging.", "Only effective when `deleveraging_margin_call_started_slot != 0`." ]; "type": "u8"; }, { "name": "lowestReserveDepositMaxLtvPct"; "docs": [ "The lowest max LTV found amongst the collateral deposits" ]; "type": "u8"; }, { "name": "numOfObsoleteBorrowReserves"; "docs": [ "The number of obsolete reserves the obligation has a borrow in" ]; "type": "u8"; }, { "name": "reserved"; "type": { "array": [ "u8", 4 ]; }; }, { "name": "highestBorrowFactorPct"; "type": "u64"; }, { "name": "autodeleverageMarginCallStartedTimestamp"; "docs": [ "A timestamp at which the risk council most-recently marked this obligation for deleveraging.", "Zero if not currently subject to deleveraging." ]; "type": "u64"; }, { "name": "orders"; "docs": [ "Owner-defined, liquidator-executed orders applicable to this obligation.", "Typical use-cases would be a stop-loss and a take-profit (possibly co-existing)." ]; "type": { "array": [ { "defined": { "name": "obligationOrder"; }; }, 2 ]; }; }, { "name": "padding3"; "type": { "array": [ "u64", 93 ]; }; } ]; }; }, { "name": "referrerState"; "type": { "kind": "struct"; "fields": [ { "name": "shortUrl"; "type": "pubkey"; }, { "name": "owner"; "type": "pubkey"; } ]; }; }, { "name": "referrerTokenState"; "docs": [ "Referrer account -> each owner can have multiple accounts for specific reserves" ]; "type": { "kind": "struct"; "fields": [ { "name": "referrer"; "docs": [ "Pubkey of the referrer/owner" ]; "type": "pubkey"; }, { "name": "mint"; "docs": [ "Token mint for the account" ]; "type": "pubkey"; }, { "name": "amountUnclaimedSf"; "docs": [ "Amount that has been accumulated and not claimed yet -> available to claim (scaled fraction)" ]; "type": "u128"; }, { "name": "amountCumulativeSf"; "docs": [ "Amount that has been accumulated in total -> both already claimed and unclaimed (scaled fraction)" ]; "type": "u128"; }, { "name": "bump"; "docs": [ "Referrer token state bump, used for address validation" ]; "type": "u64"; }, { "name": "padding"; "type": { "array": [ "u64", 31 ]; }; } ]; }; }, { "name": "shortUrl"; "type": { "kind": "struct"; "fields": [ { "name": "referrer"; "type": "pubkey"; }, { "name": "shortUrl"; "type": "string"; } ]; }; }, { "name": "userMetadata"; "docs": [ "Referrer account -> each owner can have multiple accounts for specific reserves" ]; "type": { "kind": "struct"; "fields": [ { "name": "referrer"; "docs": [ "Pubkey of the referrer/owner - pubkey::default if no referrer" ]; "type": "pubkey"; }, { "name": "bump"; "docs": [ "Bump used for validation of account address" ]; "type": "u64"; }, { "name": "userLookupTable"; "docs": [ "User lookup table - used to store all user accounts - atas for each reserve mint, each obligation PDA, UserMetadata itself and all referrer_token_states if there is a referrer" ]; "type": "pubkey"; }, { "name": "owner"; "docs": [ "User metadata account owner" ]; "type": "pubkey"; }, { "name": "padding1"; "type": { "array": [ "u64", 51 ]; }; }, { "name": "padding2"; "type": { "array": [ "u64", 64 ]; }; } ]; }; }, { "name": "reserve"; "type": { "kind": "struct"; "fields": [ { "name": "version"; "docs": [ "Version of the reserve" ]; "type": "u64"; }, { "name": "lastUpdate"; "docs": [ "Last slot when supply and rates updated" ]; "type": { "defined": { "name": "lastUpdate"; }; }; }, { "name": "lendingMarket"; "docs": [ "Lending market address" ]; "type": "pubkey"; }, { "name": "farmCollateral"; "type": "pubkey"; }, { "name": "farmDebt"; "type": "pubkey"; }, { "name": "liquidity"; "docs": [ "Reserve liquidity" ]; "type": { "defined": { "name": "reserveLiquidity"; }; }; }, { "name": "reserveLiquidityPadding"; "type": { "array": [ "u64", 150 ]; }; }, { "name": "collateral"; "docs": [ "Reserve collateral" ]; "type": { "defined": { "name": "reserveCollateral"; }; }; }, { "name": "reserveCollateralPadding"; "type": { "array": [ "u64", 150 ]; }; }, { "name": "config"; "docs": [ "Reserve configuration values" ]; "type": { "defined": { "name": "reserveConfig"; }; }; }, { "name": "configPadding"; "type": { "array": [ "u64", 116 ]; }; }, { "name": "borrowedAmountOutsideElevationGroup"; "type": "u64"; }, { "name": "borrowedAmountsAgainstThisReserveInElevationGroups"; "docs": [ "Amount of token borrowed in lamport of debt asset in the given", "elevation group when this reserve is part of the collaterals." ]; "type": { "array": [ "u64", 32 ]; }; }, { "name": "padding"; "type": { "array": [ "u64", 207 ]; }; } ]; }; } ]; }; declare const KLEND_IDL: KaminoLending; declare const KFARMS_IDL: Farms; type KlendIdlType = KaminoLending; type KfarmsIdlType = Farms; interface LastUpdateFields { /** Last slot when updated */ slot: BN; /** True when marked stale, false when slot updated */ stale: number; /** Status of the prices used to calculate the last update */ priceStatus: number; placeholder: Array; } interface BigFractionBytesFields { value: Array; padding: Array; } interface ReserveRaw { /** Version of the reserve */ version: BN; /** Last slot when supply and rates updated */ lastUpdate: LastUpdateFields; /** Lending market address */ lendingMarket: PublicKey; farmCollateral: PublicKey; farmDebt: PublicKey; /** Reserve liquidity */ liquidity: ReserveLiquidityFields; reserveLiquidityPadding: Array; /** Reserve collateral */ collateral: ReserveCollateralFields; reserveCollateralPadding: Array; /** Reserve configuration values */ config: ReserveConfigFields; configPadding: Array; borrowedAmountOutsideElevationGroup: BN; /** * Amount of token borrowed in lamport of debt asset in the given * elevation group when this reserve is part of the collaterals. */ borrowedAmountsAgainstThisReserveInElevationGroups: Array; padding: Array; } interface ReserveLiquidityFields { /** Reserve liquidity mint address */ mintPubkey: PublicKey; /** Reserve liquidity supply address */ supplyVault: PublicKey; /** Reserve liquidity fee collection address */ feeVault: PublicKey; /** Reserve liquidity available */ availableAmount: BN; /** Reserve liquidity borrowed (scaled fraction) */ borrowedAmountSf: BN; /** Reserve liquidity market price in quote currency (scaled fraction) */ marketPriceSf: BN; /** Unix timestamp of the market price (from the oracle) */ marketPriceLastUpdatedTs: BN; /** Reserve liquidity mint decimals */ mintDecimals: BN; /** * Timestamp when the last refresh reserve detected that the liquidity amount is above the deposit cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled. * If the threshold is not crossed, then the timestamp is set to 0 */ depositLimitCrossedTimestamp: BN; /** * Timestamp when the last refresh reserve detected that the borrowed amount is above the borrow cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled. * If the threshold is not crossed, then the timestamp is set to 0 */ borrowLimitCrossedTimestamp: BN; /** Reserve liquidity cumulative borrow rate (scaled fraction) */ cumulativeBorrowRateBsf: BigFractionBytesFields; /** Reserve cumulative protocol fees (scaled fraction) */ accumulatedProtocolFeesSf: BN; /** Reserve cumulative referrer fees (scaled fraction) */ accumulatedReferrerFeesSf: BN; /** Reserve pending referrer fees, to be claimed in refresh_obligation by referrer or protocol (scaled fraction) */ pendingReferrerFeesSf: BN; /** Reserve referrer fee absolute rate calculated at each refresh_reserve operation (scaled fraction) */ absoluteReferralRateSf: BN; /** Token program of the liquidity mint */ tokenProgram: PublicKey; padding2: Array; padding3: Array; } interface ReserveCollateralFields { /** Reserve collateral mint address */ mintPubkey: PublicKey; /** Reserve collateral mint supply, used for exchange rate */ mintTotalSupply: BN; /** Reserve collateral supply address */ supplyVault: PublicKey; padding1: Array; padding2: Array; } interface ReserveConfigFields { /** Status of the reserve Active/Obsolete/Hidden */ status: number; /** Asset tier -> 0 - regular (collateral & debt), 1 - isolated collateral, 2 - isolated debt */ assetTier: number; /** Flat rate that goes to the host */ hostFixedInterestRateBps: number; /** Minimum deleveraging bonus in bps */ minDeleveragingBonusBps: number; /** Whether cToken usage is blocked */ blockCtokenUsage: number; /** Remaining interest charged on early repay, as a percentage */ earlyRepayRemainingInterestPct: number; /** Emergency mode flag */ emergencyMode: number; /** Interest rate basis: 0 = Legacy (slot-based), 1 = TrueApr (wall-clock) */ interestRateBasis: number; /** Reserved for future use */ reserved2: Array; /** Cut of the order execution bonus that the protocol receives, as a percentage */ protocolOrderExecutionFeePct: number; /** Protocol take rate is the amount borrowed interest protocol receives, as a percentage */ protocolTakeRatePct: number; /** Cut of the liquidation bonus that the protocol receives, as a percentage */ protocolLiquidationFeePct: number; /** * Target ratio of the value of borrows to deposits, as a percentage * 0 if use as collateral is disabled */ loanToValuePct: number; /** Loan to value ratio at which an obligation can be liquidated, as percentage */ liquidationThresholdPct: number; /** Minimum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps */ minLiquidationBonusBps: number; /** Maximum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps */ maxLiquidationBonusBps: number; /** Bad debt liquidation bonus for an undercollateralized obligation, as bps */ badDebtLiquidationBonusBps: number; /** * Time in seconds that must pass before redemptions are enabled after the deposit limit is * crossed. * Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case. */ deleveragingMarginCallPeriodSecs: BN; /** * The rate at which the deleveraging threshold decreases, in bps per day. * Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case. */ deleveragingThresholdDecreaseBpsPerDay: BN; /** Program owner fees assessed, separate from gains due to interest accrual */ fees: ReserveFeesFields; /** Borrow rate curve based on utilization */ borrowRateCurve: BorrowRateCurveFields; /** Borrow factor in percentage - used for risk adjustment */ borrowFactorPct: BN; /** Maximum deposit limit of liquidity in native units, u64::MAX for inf */ depositLimit: BN; /** Maximum amount borrowed, u64::MAX for inf, 0 to disable borrows (protected deposits) */ borrowLimit: BN; /** Token id from TokenInfos struct */ tokenInfo: TokenInfoFields$1; /** Deposit withdrawal caps - deposit & redeem */ depositWithdrawalCap: WithdrawalCapsFields; /** Debt withdrawal caps - borrow & repay */ debtWithdrawalCap: WithdrawalCapsFields; elevationGroups: Array; disableUsageAsCollOutsideEmode: number; /** Utilization (in percentage) above which borrowing is blocked. 0 to disable. */ utilizationLimitBlockBorrowingAbovePct: number; /** * Whether this reserve should be subject to auto-deleveraging after deposit or borrow limit is * crossed. * Besides this flag, the lending market's flag also needs to be enabled (logical `AND`). * **NOTE:** the manual "target LTV" deleveraging (enabled by the risk council for individual * obligations) is NOT affected by this flag. */ autodeleverageEnabled: number; reserved1: Array; /** * Maximum amount liquidity of this reserve borrowed outside all elevation groups * - u64::MAX for inf * - 0 to disable borrows outside elevation groups */ borrowLimitOutsideElevationGroup: BN; /** * Defines the maximum amount (in lamports of elevation group debt asset) * that can be borrowed when this reserve is used as collateral. * - u64::MAX for inf * - 0 to disable borrows in this elevation group (expected value for the debt asset) */ borrowLimitAgainstThisCollateralInElevationGroup: Array; /** * The rate at which the deleveraging-related liquidation bonus increases, in bps per day. * Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case. */ deleveragingBonusIncreaseBpsPerDay: BN; } interface ReserveFeesFields { /** * Fee assessed on `BorrowObligationLiquidity`, as scaled fraction (60 bits fractional part) * Must be between `0` and `2^60`, such that `2^60 = 1`. A few examples for * clarity: * 1% = (1 << 60) / 100 = 11529215046068470 * 0.01% (1 basis point) = 115292150460685 * 0.00001% (Aave borrow fee) = 115292150461 */ borrowFeeSf: BN; /** * Fee for flash loan, expressed as scaled fraction. * 0.3% (Aave flash loan fee) = 0.003 * 2^60 = 3458764513820541 */ flashLoanFeeSf: BN; /** Used for allignment */ padding: Array; } interface BorrowRateCurveFields { points: Array; } interface CurvePointFields { utilizationRateBps: number; borrowRateBps: number; } interface TokenInfoFields$1 { /** UTF-8 encoded name of the token (null-terminated) */ name: Array; /** Heuristics limits of acceptable price */ heuristic: PriceHeuristicFields; /** Max divergence between twap and price in bps */ maxTwapDivergenceBps: BN; maxAgePriceSeconds: BN; maxAgeTwapSeconds: BN; /** Scope price configuration */ scopeConfiguration: ScopeConfigurationFields; /** Switchboard configuration */ switchboardConfiguration: SwitchboardConfigurationFields; /** Pyth configuration */ pythConfiguration: PythConfigurationFields; blockPriceUsage: number; reserved: Array; padding: Array; } interface PriceHeuristicFields { /** Lower value of acceptable price */ lower: BN; /** Upper value of acceptable price */ upper: BN; /** Number of decimals of the previously defined values */ exp: BN; } interface ScopeConfigurationFields { /** Pubkey of the scope price feed (disabled if `null` or `default`) */ priceFeed: PublicKey; /** This is the scope_id price chain that results in a price for the token */ priceChain: Array; /** This is the scope_id price chain for the twap */ twapChain: Array; } interface SwitchboardConfigurationFields { /** Pubkey of the base price feed (disabled if `null` or `default`) */ priceAggregator: PublicKey; twapAggregator: PublicKey; } interface PythConfigurationFields { /** Pubkey of the base price feed (disabled if `null` or `default`) */ price: PublicKey; } interface WithdrawalCapsFields { configCapacity: BN; currentTotal: BN; lastIntervalStartTimestamp: BN; configIntervalLengthSeconds: BN; } interface ObligationRaw { /** Version of the struct */ tag: BN; /** Last update to collateral, liquidity, or their market values */ lastUpdate: LastUpdateFields; /** Lending market address */ lendingMarket: PublicKey; /** Owner authority which can borrow liquidity */ owner: PublicKey; /** Deposited collateral for the obligation, unique by deposit reserve address */ deposits: Array; /** Worst LTV for the collaterals backing the loan, represented as a percentage */ lowestReserveDepositLiquidationLtv: BN; /** Market value of deposits (scaled fraction) */ depositedValueSf: BN; /** Borrowed liquidity for the obligation, unique by borrow reserve address */ borrows: Array; /** Risk adjusted market value of borrows/debt (sum of price * borrowed_amount * borrow_factor) (scaled fraction) */ borrowFactorAdjustedDebtValueSf: BN; /** Market value of borrows - used for max_liquidatable_borrowed_amount (scaled fraction) */ borrowedAssetsMarketValueSf: BN; /** The maximum borrow value at the weighted average loan to value ratio (scaled fraction) */ allowedBorrowValueSf: BN; /** The dangerous borrow value at the weighted average liquidation threshold (scaled fraction) */ unhealthyBorrowValueSf: BN; /** The asset tier of the deposits */ depositsAssetTiers: Array; /** The asset tier of the borrows */ borrowsAssetTiers: Array; /** The elevation group id the obligation opted into. */ elevationGroup: number; /** The number of obsolete reserves the obligation has a deposit in */ numOfObsoleteDepositReserves: number; /** Marked = 1 if borrows array is not empty, 0 = borrows empty */ hasDebt: number; /** Wallet address of the referrer */ referrer: PublicKey; /** Marked = 1 if borrowing disabled, 0 = borrowing enabled */ borrowingDisabled: number; /** * A target LTV set by the risk council when marking this obligation for deleveraging. * Only effective when `deleveraging_margin_call_started_slot != 0`. */ autodeleverageTargetLtvPct: number; /** The lowest max LTV found amongst the collateral deposits */ lowestReserveDepositMaxLtvPct: number; /** The number of obsolete reserves the obligation has a borrow in */ numOfObsoleteBorrowReserves: number; reserved: Array; highestBorrowFactorPct: BN; /** * A timestamp at which the risk council most-recently marked this obligation for deleveraging. * Zero if not currently subject to deleveraging. */ autodeleverageMarginCallStartedTimestamp: BN; /** * Owner-defined, liquidator-executed orders applicable to this obligation. * Typical use-cases would be a stop-loss and a take-profit (possibly co-existing). */ orders: Array; padding3: Array; } interface ObligationCollateralFields { /** Reserve collateral is deposited to */ depositReserve: PublicKey; /** Amount of collateral deposited */ depositedAmount: BN; /** Collateral market value in quote currency (scaled fraction) */ marketValueSf: BN; /** * Debt amount (lamport) taken against this collateral. * (only meaningful if this obligation is part of an elevation group, otherwise 0) * This is only indicative of the debt computed on the last refresh obligation. * If the obligation have multiple collateral this value is the same for all of them. */ borrowedAmountAgainstThisCollateralInElevationGroup: BN; padding: Array; } interface ObligationLiquidityFields { /** Reserve liquidity is borrowed from */ borrowReserve: PublicKey; /** Borrow rate used for calculating interest (big scaled fraction) */ cumulativeBorrowRateBsf: BigFractionBytesFields; padding: BN; /** Amount of liquidity borrowed plus interest (scaled fraction) */ borrowedAmountSf: BN; /** Liquidity market value in quote currency (scaled fraction) */ marketValueSf: BN; /** Risk adjusted liquidity market value in quote currency - DEBUG ONLY - use market_value instead */ borrowFactorAdjustedMarketValueSf: BN; /** Amount of liquidity borrowed outside of an elevation group */ borrowedAmountOutsideElevationGroups: BN; padding2: Array; } interface ObligationOrderFields { /** * A threshold value used by the condition (scaled [Fraction]). * The exact meaning depends on the specific [Self::condition_type]. * * Examples: * - when `condition_type == 2 (UserLtvBelow)`: * then a value of `0.455` here means that the order is active only when the obligation's * user LTV is less than `0.455` (i.e. < 45.5%). * - when `condition_type == 3 (DebtCollPriceRatioAbove)`: * assuming the obligation uses BTC collateral for SOL debt, then a value of `491.3` here * means that the order is active only when the BTC-SOL price is greater than `491.3` (i.e. * > 491.3 SOL per BTC). */ conditionThresholdSf: BN; /** * A configuration parameter used by the opportunity (scaled [Fraction]). * The exact meaning depends on the specific [Self::opportunity_type]. * * Examples: * - when `opportunity_type == 0 (DeleverageSingleDebtAmount)`: * Assuming the obligation uses BTC collateral for SOL debt, then a value of `1_234_000_000` * here means that a liquidator may repay up to 1234000000 lamports (i.e. 1.234 SOL) on this * obligation. * Note: the special value of [Fraction::MAX] is *not* allowed in this case. * - when `opportunity_type == 1 (DeleverageAllDebtAmount)`: * The only allowed value in this case is [Fraction::MAX] (to emphasize that *all* debt * should be repaid). */ opportunityParameterSf: BN; /** * A *minimum* additional fraction of collateral transferred to the liquidator, in bps. * * The minimum bonus is applied exactly when the [Self::condition_threshold_sf] is met, and * grows linearly towards the [Self::max_execution_bonus_bps]. * * Example: a value of `50` here means 50bps == 0.5% bonus for an "LTV > 65%" order, when * executed precisely at the moment LTV exceeds 65%. */ minExecutionBonusBps: number; /** * A *maximum* additional fraction of collateral transferred to the liquidator, in bps. * * The maximum bonus is applied at the relevant "extreme" state of the obligation, i.e.: * - for a stop-loss condition, it is a point at which the obligation becomes liquidatable; * - for a take-profit condition, it is a point at which obligation has 0% LTV. * * In non-extreme states, the actual bonus value is interpolated linearly, starting from * [Self::min_execution_bonus_bps] (at the point specified by the order's condition). * * Example: a value of `300` here means 300bps == 3.0% bonus for a "debt/coll price > 140" * order, when executed at a higher price = 200, at which the obligation's LTV happens to * be equal to its liquidation LTV. */ maxExecutionBonusBps: number; /** * Serialized [ConditionType]. * The entire order is void when this is zeroed (i.e. representing [ConditionType::Never]). * * Example: a value of `2` here denotes `UserLtvBelow` condition type. Of course, to * interpret this condition, we also need to take the [Self::condition_threshold_sf] into * account. */ conditionType: number; /** * Serialized [OpportunityType]. * * Example: a value of `0` here denotes `DeleverageSingleDebtAmount` opportunity. Of course, to * interpret this opportunity, we also need to take the [Self::opportunity_parameter_sf] into * account. */ opportunityType: number; /** * Internal padding. * The fields above take up 2+2+1+1 bytes = 48 bits, which means we need 80 bits = 10 bytes to * align with `u128`s. */ padding1: Array; /** * End padding. * The total size of a single instance is 8*u128 = 128 bytes. */ padding2: Array; } interface FarmStateRaw { farmAdmin: PublicKey; globalConfig: PublicKey; token: TokenInfoFields; rewardInfos: Array; numRewardTokens: BN; /** Data used to calculate the rewards of the user */ numUsers: BN; /** * The number of token in the `farm_vault` staked (getting rewards and fees) * Set such as `farm_vault.amount = total_staked_amount + total_pending_amount` */ totalStakedAmount: BN; farmVault: PublicKey; farmVaultsAuthority: PublicKey; farmVaultsAuthorityBump: BN; /** * Only used for delegate farms * Set to `default()` otherwise */ delegateAuthority: PublicKey; /** * Raw representation of a `TimeUnit` * Seconds = 0, Slots = 1 */ timeUnit: number; /** * Automatically set to true in case of a full authority withdrawal * If true, the farm is frozen and no more deposits are allowed */ isFarmFrozen: number; /** * Indicates if the farm is a delegate farm * If true, the farm is a delegate farm and the `delegate_authority` is set* */ isFarmDelegated: number; padding0: Array; /** * Withdraw authority for the farm, allowed to lock deposited funds and withdraw them * Set to `default()` if unused (only the depositors can withdraw their funds) */ withdrawAuthority: PublicKey; /** * Delay between a user deposit and the moment it is considered as staked * 0 if unused */ depositWarmupPeriod: number; /** Delay between a user unstake and the ability to withdraw his deposit. */ withdrawalCooldownPeriod: number; /** Total active stake of tokens in the farm (scaled from `Decimal` representation). */ totalActiveStakeScaled: BN; /** * Total pending stake of tokens in the farm (scaled from `Decimal` representation). * (can be used by `withdraw_authority` but don't get rewards or fees) */ totalPendingStakeScaled: BN; /** Total pending amount of tokens in the farm */ totalPendingAmount: BN; /** Slashed amounts from early withdrawal */ slashedAmountCurrent: BN; slashedAmountCumulative: BN; slashedAmountSpillAddress: PublicKey; /** Locking stake */ lockingMode: BN; lockingStartTimestamp: BN; lockingDuration: BN; lockingEarlyWithdrawalPenaltyBps: BN; depositCapAmount: BN; scopePrices: PublicKey; scopeOraclePriceId: BN; scopeOracleMaxAge: BN; pendingFarmAdmin: PublicKey; strategyId: PublicKey; delegatedRpsAdmin: PublicKey; vaultId: PublicKey; secondDelegatedAuthority: PublicKey; padding: Array; } interface TokenInfoFields { mint: PublicKey; decimals: BN; tokenProgram: PublicKey; padding: Array; } interface RewardInfoFields { token: TokenInfoFields; rewardsVault: PublicKey; rewardsAvailable: BN; rewardScheduleCurve: RewardScheduleCurveFields; minClaimDurationSeconds: BN; lastIssuanceTs: BN; rewardsIssuedUnclaimed: BN; rewardsIssuedCumulative: BN; rewardPerShareScaled: BN; placeholder0: BN; rewardType: number; rewardsPerSecondDecimals: number; padding0: Array; padding1: Array; } interface RewardPerTimeUnitPointFields { tsStart: BN; rewardPerTimeUnit: BN; } interface RewardScheduleCurveFields { /** * This is a stepwise function, meaning that each point represents * how many rewards are issued per time unit since the beginning * of that point until the beginning of the next point. * This is not a linear curve, there is no interpolation going on. * A curve can be [[t0, 100], [t1, 50], [t2, 0]] * meaning that from t0 to t1, 100 rewards are issued per time unit, * from t1 to t2, 50 rewards are issued per time unit, and after t2 it stops * Another curve, can be [[t0, 100], [u64::max, 0]] * meaning that from t0 to u64::max, 100 rewards are issued per time unit */ points: Array; } type MakeRefreshingIxsParams = { klendProgram: Program; reserve: KaminoReserve; reserveKey: PublicKey; obligationKey: PublicKey; program: Program; }; declare function makeRefreshingIxs({ klendProgram, reserve, reserveKey, obligationKey, }: MakeRefreshingIxsParams): Promise<_solana_web3_js.TransactionInstruction[]>; /** * Serialize a Kamino Obligation to its JSON DTO. * * The parameter is typed as the curated {@link KaminoObligation}, so a * freshly decoded `ObligationRaw` is accepted structurally and trimmed * down to the curated shape here. */ declare function kaminoObligationToDto(obligation: KaminoObligation): KaminoObligationJSON; /** * Serialize a Kamino Reserve to its JSON DTO. * * The parameter is typed as the curated {@link KaminoReserve}, so a * freshly decoded `ReserveRaw` is accepted structurally and trimmed * down to the curated shape here. */ declare function kaminoReserveToDto(reserve: KaminoReserve): KaminoReserveJSON; declare const KLEND_ACCOUNT_CODER: BorshCoder; declare function decodeKlendReserveData(data: Buffer): ReserveRaw; declare function decodeKlendObligationData(data: Buffer): ObligationRaw; declare function dtoToKaminoObligation(obligationDto: KaminoObligationJSON): KaminoObligation; declare function dtoToKaminoReserve(reserveDto: KaminoReserveJSON): KaminoReserve; declare const SEED_LENDING_MARKET_AUTH = "lma"; declare const SEED_RESERVE_LIQ_SUPPLY = "reserve_liq_supply"; declare const SEED_FEE_RECEIVER = "fee_receiver"; declare const SEED_RESERVE_COLL_MINT = "reserve_coll_mint"; declare const SEED_RESERVE_COLL_SUPPLY = "reserve_coll_supply"; declare const SEED_BASE_REFERRER_TOKEN_STATE = "referrer_acc"; declare const SEED_BASE_USER_METADATA = "user_meta"; declare const SEED_BASE_REFERRER_STATE = "ref_state"; declare const SEED_BASE_SHORT_URL = "short_url"; declare const SEED_USER_STATE = "user"; /** @deprecated Kamino changed derivation logic. Do not use. */ declare function getAllDerivedKaminoAccounts(lendingMarket: PublicKey, reserveLiquidityMint: PublicKey): { lendingMarketAuthority: PublicKey; reserveLiquiditySupply: PublicKey; reserveCollateralMint: PublicKey; reserveDestinationDepositCollateral: PublicKey; }; declare function deriveLendingMarketAuthority(lendingMarket: PublicKey): [PublicKey, number]; declare function deriveReserveLiquiditySupply(lendingMarket: PublicKey, reserveLiquidityMint: PublicKey): [PublicKey, number]; declare function deriveFeeReceiver(lendingMarket: PublicKey, reserveLiquidityMint: PublicKey): [PublicKey, number]; declare function deriveReserveCollateralMint(lendingMarket: PublicKey, reserveLiquidityMint: PublicKey): [PublicKey, number]; declare function deriveReserveCollateralSupply(lendingMarket: PublicKey, reserveLiquidityMint: PublicKey): [PublicKey, number]; declare function deriveReferrerTokenState(referrer: PublicKey): [PublicKey, number]; declare function deriveUserMetadata(user: PublicKey): [PublicKey, number]; declare function deriveReferrerState(user: PublicKey): [PublicKey, number]; declare function deriveShortUrl(identifier: Buffer): [PublicKey, number]; /** * Typically the obligation for each bank will have tag and id = 0 * @param ownerPublicKey * @param marketPublicKey * @param programId - Default KLEND_PROGRAM_ID * @param seed1AccountKey - Default PublicKey.default * @param seed2AccountKey - Default PublicKey.default * @param tag - Default 0 * @param id - Default 0 * @returns */ declare const deriveBaseObligation: (ownerPublicKey: PublicKey, marketPublicKey: PublicKey, programId?: PublicKey, seed1AccountKey?: PublicKey, seed2AccountKey?: PublicKey, tag?: number, id?: number) => [PublicKey, number]; declare const deriveObligation: (programId: PublicKey, tag: number, id: number, ownerPublicKey: PublicKey, marketPublicKey: PublicKey, seed1AccountKey: PublicKey, seed2AccountKey: PublicKey) => [PublicKey, number]; /** * Somewhat contrary to the name, this is the rewards state of the farms program for an obligation * (like one owned by a bank), and has nothing to do with "users" in a margin context. * @param programId * @param farmState * @param obligation * @returns */ declare function deriveUserState(programId: PublicKey, farmState: PublicKey, obligation: PublicKey): [PublicKey, number]; /** * Kamino Lending Protocol - Interest Rate Utilities * * Provides utilities for calculating interest rates, reserve metrics, and curve generation * for the Kamino lending protocol. * * Extracted all needed functions & constants out of their SDK */ interface KlendInterestRateCurvePoint { utilization: number; borrowAPY: number; supplyAPY: number; } interface KaminoReserveCurveData { reserveAddress: string; curvePoints: KlendInterestRateCurvePoint[]; } /** * How a reserve's configured (curve) rate is turned into a realized annual rate. * `multiplier` scales the curve rate; `periodsPerYear` is the compounding * granularity used to convert APR to APY. */ interface KaminoRateBasis { multiplier: number; periodsPerYear: number; } /** * Linear interpolation between two points */ declare const interpolateLinear: (x: number, x0: number, y0: number, x1: number, y1: number) => number; /** * Calculate borrow rate from utilization using interest rate curve * @param currentUtilization - Current utilization ratio (0-1) * @param curve - Array of [utilization, rate] points * @returns Borrow rate for the given utilization */ declare const getKaminoBorrowRate: (currentUtilization: number, curve: [number, number][]) => number; /** * Convert APR to APY using compound interest formula * APY = (1 + APR/n)^n - 1 * @param apr - Annual Percentage Rate as decimal (e.g., 0.05 for 5%) * @param periodsPerYear - Compounding periods per year (defaults to SLOTS_PER_YEAR; * use `getKaminoRateBasis(reserve).periodsPerYear` for basis-aware compounding) * @returns Annual Percentage Yield as decimal */ declare function calculateAPYFromAPR(apr: number, periodsPerYear?: number): number; /** * Calculate total supply of a reserve * Formula: available liquidity + borrowed - protocol fees - referrer fees * @param reserve - The Kamino reserve * @returns Total supply in lamports */ declare function getKaminoTotalSupply(reserve: KaminoReserve): Decimal; /** * Calculate utilization ratio of a reserve * Formula: total borrowed / total supply * @param reserve - The Kamino reserve * @returns Utilization ratio (0-1, e.g., 0.75 = 75% utilized) */ declare function calculateUtilizationRatio(reserve: KaminoReserve): number; /** * Resolve a reserve's interest rate basis, defaulting to `Legacy` when the * field is absent (reserves serialized before it existed). * @throws if the on-chain value is not a known basis */ declare function getKaminoInterestRateBasis(reserve: KaminoReserve): KaminoInterestRateBasis; /** * Calculate slot adjustment factor based on recent slot duration * Used to adjust Legacy-basis rates based on actual blockchain performance * @param recentSlotDurationMs - Recent slot duration in milliseconds * @returns Slot adjustment factor */ declare function slotAdjustmentFactor(recentSlotDurationMs?: number): number; /** * Rate multiplier and compounding granularity for a reserve, per its * interest rate basis (1:1 with klend-sdk `KaminoReserve.rateAdjustmentFactor()` * and `accrualUnitsPerYear()`). * * - `Legacy`: curve rates are slot-year APRs, so they are scaled by the observed * slot duration and compounded per slot. * - `TrueApr`: curve rates are wall-clock APRs; `recentSlotDurationMs` is ignored * and rates compound per second. * * @param reserve - The Kamino reserve * @param recentSlotDurationMs - Observed slot duration; only read for `Legacy` * @throws for an unsupported basis, or a non-positive slot duration on `Legacy` */ declare function getKaminoRateBasis(reserve: KaminoReserve, recentSlotDurationMs?: number): KaminoRateBasis; /** * Calculate the rate multiplier for a reserve (1:1 with klend-sdk * `KaminoReserve.rateAdjustmentFactor()`): the slot adjustment factor for a * `Legacy` reserve, `1` for a `TrueApr` one. */ declare function calculateSlotAdjustmentFactor(reserve: KaminoReserve, recentSlotDurationMs?: number): number; /** * Calculate estimated borrow rate for a reserve * @param reserve - The reserve * @param recentSlotDurationMs - Recent slot duration (optional; ignored for TrueApr reserves) * @returns Borrow rate as decimal (e.g., 0.05 = 5%) */ declare function calculateKaminoEstimatedBorrowRate(reserve: KaminoReserve, recentSlotDurationMs?: number): number; /** * Calculate estimated supply rate for a reserve * Formula: borrow rate × utilization × (1 - protocol take rate) * @param reserve - The reserve * @param recentSlotDurationMs - Recent slot duration (optional; ignored for TrueApr reserves) * @returns Supply rate as decimal (e.g., 0.03 = 3%) */ declare function calculateKaminoEstimatedSupplyRate(reserve: KaminoReserve, recentSlotDurationMs?: number): number; /** * Calculate supply APY for a reserve * APY includes compounding, making it higher than APR * Matches Kamino SDK's reserve.totalSupplyAPY() * @param reserve - The Kamino reserve * @param recentSlotDurationMs - Recent slot duration (defaults to * DEFAULT_RECENT_SLOT_DURATION_MS; ignored for TrueApr reserves) * @returns Supply APY as decimal (e.g., 0.0512 = 5.12% APY) */ declare function calculateKaminoSupplyAPY(reserve: KaminoReserve, recentSlotDurationMs?: number): number; declare function scaledSupplies(state: KaminoReserve): [Decimal, Decimal]; /** * Convert raw curve points to normalized [utilization, rate] pairs * Truncates curve at 100% utilization */ declare const truncateBorrowCurve: (points: KaminoBorrowRateCurvePoint[]) => [number, number][]; /** * Get fixed host interest rate from reserve config (1:1 with Kamino SDK) * Source: klend-sdk/src/classes/reserve.ts line 209 */ declare function getFixedHostInterestRate(reserve: KaminoReserve): number; /** * Get protocol take rate percentage from reserve config */ declare function getProtocolTakeRatePct(reserve: KaminoReserve): number; /** * Generate complete interest rate curve for a reserve * Creates 101 data points from 0% to 100% utilization * @param curvePoints - Raw curve configuration from reserve * @param slotAdjustmentFactor - Rate multiplier (`calculateSlotAdjustmentFactor`; * the slot adjustment for Legacy reserves, 1 for TrueApr) * @param fixedHostInterestRate - Fixed rate added to all borrow rates * @param protocolTakeRatePct - Percentage kept by depositors (1 - protocol fee) * @param periodsPerYear - APY compounding periods (`getKaminoRateBasis(reserve).periodsPerYear`; * defaults to SLOTS_PER_YEAR) * @returns Array of curve points with utilization, borrow APY, and supply APY */ declare function generateKaminoReserveCurve(curvePoints: KaminoBorrowRateCurvePoint[], slotAdjustmentFactor: number, fixedHostInterestRate: number, protocolTakeRatePct: number, periodsPerYear?: number): KlendInterestRateCurvePoint[]; /** * Generate the interest rate curve for a reserve, deriving the rate multiplier * and compounding granularity from its interest rate basis. * @param reserve - The Kamino reserve * @param recentSlotDurationMs - Recent slot duration (optional; ignored for TrueApr reserves) */ declare function generateKaminoReserveCurveFromReserve(reserve: KaminoReserve, recentSlotDurationMs?: number): KlendInterestRateCurvePoint[]; declare function getRewardPerTimeUnitSecond(reward: KaminoFarmRewardInfo): Decimal; declare function getReserveRewardsApy(priceByMint: Record, farmState: KaminoFarmState, reserveState: KaminoReserve): Promise<{ rewardApy: Decimal; rewardInfo: KaminoFarmRewardInfo; rewardApr: Decimal; }[]>; declare function calculateRewardApy(priceByMint: Record, reserve: KaminoReserve, rewardInfo: KaminoFarmRewardInfo): { apr: Decimal; apy: Decimal; }; /** * Serialize a Kamino FarmState to its JSON DTO. * * The parameter is typed as the curated {@link KaminoFarmState}, so a * freshly decoded `FarmStateRaw` is accepted structurally and trimmed * down to the curated shape here. */ declare function kaminoFarmStateToDto(farmState: KaminoFarmState): KaminoFarmStateJSON; declare function decodeFarmDataRaw(data: Buffer): FarmStateRaw; declare function dtoToKaminoFarmState(dto: KaminoFarmStateJSON): KaminoFarmState; declare const KLEND_PROGRAM_ID: PublicKey; declare const FARMS_PROGRAM_ID: PublicKey; declare const SLOTS_PER_SECOND = 2; declare const SLOTS_PER_MINUTE: number; declare const SLOTS_PER_HOUR: number; declare const SLOTS_PER_DAY: number; declare const SLOTS_PER_YEAR: number; declare const SECONDS_PER_YEAR = 31536000; declare const DEFAULT_RECENT_SLOT_DURATION_MS = 350; declare const ONE_HUNDRED_PCT_IN_BPS = 10000; /** * Refresh a generic Kamino obligation * @param program * @param market * @param obligation * @param remaining - pack the reserves used in this obligation, in the order they appear, starting * with lending reserves. For example, a user lending USDC at index 0, SOL at index 1, borrowing * BONK at index 0, pass [USDC, SOL, BONK] reserves * @returns */ declare const REFRESH_OBLIGATION_DISCRIMINATOR: Buffer; interface RefreshObligationAccounts { lendingMarket: Address; obligation: Address; } declare const makeRefreshObligationIx: (lendingMarket: PublicKey, obligation: PublicKey, reserve: PublicKey) => TransactionInstruction; declare const layout: any; type ReserveRemainingAccounts = { reserve: PublicKey; lendingMarket: PublicKey; }; declare function makeRefreshReservesBatchIx(reserves: ReserveRemainingAccounts[], programId?: PublicKey): TransactionInstruction; /** * Gamma Protocol vault program — LP vaults with instant deposits, escrow * withdrawals. The production P0 vaults live under the upstream Gamma * program; the on-chain vault, withdrawal-policy, deposit-receipt and * withdraw-receipt accounts all live under this program, so all PDAs and * instruction targets must derive from it. */ declare const GAMMA_VAULT_PROGRAM_ID: PublicKey; declare const SEED_WITHDRAWAL_POLICY = "withdrawal_policy"; declare const SEED_DEPOSIT_POLICY = "deposit_policy"; declare const SEED_DEPOSIT_RECEIPT = "deposit_receipt"; declare const SEED_WITHDRAW_ESCROW = "withdraw_escrow"; declare const SEED_WITHDRAW_RECEIPT = "withdraw_receipt"; /** * Program IDL in camelCase format in order to be used in JS/TS. * * Note that this is only a type helper and is not the actual IDL. The original * IDL can be found at `target/idl/gamma_vault.json`. */ type GammaVault = { "address": "GaMmanX9i4jGmqDZZD2tbD6B2v9p21btenPneMXnTczV"; "metadata": { "name": "gammaVault"; "version": "2.3.0"; "spec": "0.1.0"; "description": "Gamma Protocol vault program — LP vaults with instant deposits, escrow withdrawals, and performance fees"; }; "instructions": [ { "name": "assessFees"; "docs": [ "Assess scheduled performance fees (keeper)." ]; "discriminator": [ 224, 15, 195, 19, 125, 145, 2, 100 ]; "accounts": [ { "name": "fundAuthority"; "signer": true; "relations": [ "lpVault" ]; }, { "name": "lpVault"; "writable": true; }, { "name": "sharesMint"; "writable": true; "relations": [ "lpVault" ]; }, { "name": "feeRecipientAccount"; "writable": true; }, { "name": "tokenProgram"; } ]; "args": []; }, { "name": "claimCrossChainWithdrawal"; "docs": [ "Move a fulfilled withdrawal's claimable assets out of the withdraw escrow", "into the DLN give-ATA, which is derived from `lp_vault.keeper_authority` and", "never supplied by the caller, and advance the intent to `ASSETS_SETTLED`.", "Permissionless. Beta-only; reject-only otherwise." ]; "discriminator": [ 51, 239, 161, 18, 144, 185, 10, 112 ]; "accounts": [ { "name": "payer"; "docs": [ "Rent for the maker ATA if it does not exist yet. NOT an authority." ]; "writable": true; "signer": true; }, { "name": "crossChainIntent"; "writable": true; }, { "name": "lpVault"; }, { "name": "crossChainWithdrawer"; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 119, 105, 116, 104, 100, 114, 97, 119, 101, 114 ]; }, { "kind": "account"; "path": "crossChainIntent"; } ]; }; }, { "name": "withdrawReceipt"; "docs": [ "Drained of its claimable amounts but deliberately NOT closed." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 95, 114, 101, 99, 101, 105, 112, 116 ]; }, { "kind": "account"; "path": "crossChainWithdrawer"; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "withdrawEscrow"; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 95, 101, 115, 99, 114, 111, 119 ]; }, { "kind": "account"; "path": "crossChainWithdrawer"; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "escrowAssetsAccount"; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "withdrawEscrow"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "assetsMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "escrowSharesAccount"; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "withdrawEscrow"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "sharesMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "makerAuthority"; "docs": [ "is checked below. Never signs here; its signature is needed only for the", "off-chain DLN return order. The `!= default` guard stops an unconfigured", "vault from routing assets to the zero address's ATA." ]; }, { "name": "makerAssetAccount"; "docs": [ "The DLN give-ATA. Anchor derives it from `maker_authority`, which the", "constraints above pin to `lp_vault.keeper_authority`, so the destination is", "on-chain state rather than a caller argument." ]; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "makerAuthority"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "assetsMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "assetsMint"; "relations": [ "lpVault" ]; }, { "name": "sharesMint"; "writable": true; "relations": [ "lpVault" ]; }, { "name": "systemProgram"; "address": "11111111111111111111111111111111"; }, { "name": "tokenProgram"; }, { "name": "associatedTokenProgram"; "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; } ]; "args": []; }, { "name": "closeDepositReceipt"; "docs": [ "Close a deposit receipt and reclaim rent." ]; "discriminator": [ 216, 104, 127, 60, 88, 217, 184, 15 ]; "accounts": [ { "name": "user"; "docs": [ "User who owns the deposit receipt." ]; "writable": true; "signer": true; }, { "name": "lpVault"; "docs": [ "The vault this receipt is associated with." ]; }, { "name": "depositReceipt"; "docs": [ "Deposit receipt to close. Rent is returned to user." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 100, 101, 112, 111, 115, 105, 116, 95, 114, 101, 99, 101, 105, 112, 116 ]; }, { "kind": "account"; "path": "user"; }, { "kind": "account"; "path": "lpVault"; } ]; }; } ]; "args": []; }, { "name": "completeWithdrawal"; "docs": [ "User claims their withdrawal from escrow.", "Burns shares and transfers assets to user's wallet." ]; "discriminator": [ 107, 98, 134, 131, 74, 120, 174, 121 ]; "accounts": [ { "name": "user"; "docs": [ "User claiming the withdrawal." ]; "writable": true; "signer": true; }, { "name": "lpVault"; "docs": [ "LpVault (needed for shares_mint validation)." ]; }, { "name": "assetsMint"; "docs": [ "Mint of the vault assets." ]; "relations": [ "lpVault" ]; }, { "name": "sharesMint"; "docs": [ "Mint for vault shares." ]; "writable": true; "relations": [ "lpVault" ]; }, { "name": "userAssetAta"; "docs": [ "User's asset token account (destination for claimed assets)." ]; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "user"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "assetsMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "withdrawEscrow"; "docs": [ "User's withdraw escrow." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 95, 101, 115, 99, 114, 111, 119 ]; }, { "kind": "account"; "path": "user"; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "escrowAssetsAccount"; "docs": [ "Escrow's asset token account (source of assets)." ]; "writable": true; "relations": [ "withdrawEscrow" ]; }, { "name": "escrowSharesAccount"; "docs": [ "Escrow's share token account (shares to burn)." ]; "writable": true; "relations": [ "withdrawEscrow" ]; }, { "name": "withdrawReceipt"; "docs": [ "User's withdraw receipt." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 95, 114, 101, 99, 101, 105, 112, 116 ]; }, { "kind": "account"; "path": "user"; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "systemProgram"; "docs": [ "System program." ]; "address": "11111111111111111111111111111111"; }, { "name": "tokenProgram"; "docs": [ "Token program." ]; }, { "name": "associatedTokenProgram"; "docs": [ "Associated token program." ]; "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; } ]; "args": []; }, { "name": "crossChainDepositAndBridge"; "docs": [ "Authenticated BNB/DLN ingress, native Gamma deposit accounting, and", "dePort share send in one atomic Gamma instruction. The bridging logic and", "the deBridge SDK are compiled only under the non-default `cross-chain`", "feature; the default (production) build keeps this entrypoint present but", "hard-disabled (it rejects before any state transition)." ]; "discriminator": [ 191, 64, 193, 191, 223, 242, 234, 122 ]; "accounts": [ { "name": "crossChainConfig"; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 99, 111, 110, 102, 105, 103 ]; } ]; }; }, { "name": "crossChainVaultRoute"; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 114, 111, 117, 116, 101 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "crossChainIntent"; "docs": [ "Heap-boxed to keep Anchor's generated account parser below the SBF", "4 KiB stack-frame limit without changing the ordered account ABI." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 105, 110, 116, 101, 110, 116 ]; }, { "kind": "const"; "value": [ 100, 101, 112, 111, 115, 105, 116 ]; }, { "kind": "account"; "path": "extcallMeta"; } ]; }; }, { "name": "extcallMeta"; }, { "name": "extcallAuthority"; "docs": [ "DLN's externally supplied CPI signer. Hook expense/reward funds", "first-use rent and the exact native fee transferred to Gamma's sender." ]; "writable": true; "signer": true; }, { "name": "extcallWallet"; "writable": true; }, { "name": "crossChainSender"; "docs": [ "only when calling deBridge. The handler verifies owner and data before", "funding it with the live native fixed fee." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 115, 101, 110, 100, 101, 114 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "crossChainSenderShareWallet"; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "crossChainSender"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "sharesMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "depositReceipt"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 100, 101, 112, 111, 115, 105, 116, 95, 114, 101, 99, 101, 105, 112, 116 ]; }, { "kind": "account"; "path": "extcallAuthority"; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "instructions"; "address": "Sysvar1nstructions1111111111111111111111111"; }, { "name": "lpVault"; "writable": true; "relations": [ "withdrawalPolicy", "depositPolicy" ]; }, { "name": "withdrawalPolicy"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 97, 108, 95, 112, 111, 108, 105, 99, 121 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "depositPolicy"; "pda": { "seeds": [ { "kind": "const"; "value": [ 100, 101, 112, 111, 115, 105, 116, 95, 112, 111, 108, 105, 99, 121 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "assetsAccount"; "writable": true; "relations": [ "lpVault" ]; }, { "name": "assetsMint"; "relations": [ "lpVault" ]; }, { "name": "sharesMint"; "writable": true; "relations": [ "lpVault" ]; }, { "name": "systemProgram"; "address": "11111111111111111111111111111111"; }, { "name": "tokenProgram"; }, { "name": "associatedTokenProgram"; "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; } ]; "args": [ { "name": "args"; "type": { "defined": { "name": "crossChainDepositArgs"; }; }; } ]; }, { "name": "crossChainDepositAndBridgeV2"; "docs": [ "Historical serializable BNB/DLN ingress ABI. V2 remains present for", "decoder compatibility but always rejects because it lacks runtime", "ExtcallMeta order binding." ]; "discriminator": [ 207, 9, 169, 239, 70, 236, 234, 17 ]; "accounts": [ { "name": "crossChainConfig"; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 99, 111, 110, 102, 105, 103 ]; } ]; }; }, { "name": "crossChainVaultRoute"; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 114, 111, 117, 116, 101 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "crossChainIntent"; "docs": [ "Heap-boxed to keep Anchor's generated account parser below the SBF", "4 KiB stack-frame limit. This address is static at hook-construction", "time and its rent must be included in the hook expense." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 105, 110, 116, 101, 110, 116 ]; }, { "kind": "const"; "value": [ 100, 101, 112, 111, 115, 105, 116 ]; }, { "kind": "account"; "path": "lpVault"; }, { "kind": "arg"; "path": "args.beneficiary"; }, { "kind": "arg"; "path": "args.nonce"; } ]; }; }, { "name": "extcallAuthority"; "docs": [ "DLN's substituted CPI signer. Hook expense funds first-use sender-share", "ATA rent, this Gamma intent's rent, and the exact native dePort fee", "transferred to Gamma's sender." ]; "writable": true; "signer": true; }, { "name": "extcallWallet"; "writable": true; }, { "name": "crossChainSender"; "docs": [ "only when calling deBridge. The handler verifies owner and data before", "funding it with the live native fixed fee." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 115, 101, 110, 100, 101, 114 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "crossChainSenderShareWallet"; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "crossChainSender"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "sharesMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "instructions"; "address": "Sysvar1nstructions1111111111111111111111111"; }, { "name": "lpVault"; "writable": true; "relations": [ "withdrawalPolicy", "depositPolicy" ]; }, { "name": "withdrawalPolicy"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 97, 108, 95, 112, 111, 108, 105, 99, 121 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "depositPolicy"; "pda": { "seeds": [ { "kind": "const"; "value": [ 100, 101, 112, 111, 115, 105, 116, 95, 112, 111, 108, 105, 99, 121 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "assetsAccount"; "writable": true; "relations": [ "lpVault" ]; }, { "name": "assetsMint"; "relations": [ "lpVault" ]; }, { "name": "sharesMint"; "writable": true; "relations": [ "lpVault" ]; }, { "name": "systemProgram"; "address": "11111111111111111111111111111111"; }, { "name": "tokenProgram"; }, { "name": "associatedTokenProgram"; "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; } ]; "args": [ { "name": "args"; "type": { "defined": { "name": "crossChainDepositArgs"; }; }; } ]; }, { "name": "crossChainDepositAndBridgeV3"; "docs": [ "Source-authenticated BNB/DLN ingress, native Gamma deposit accounting,", "and dePort share send in one atomic Gamma instruction. The executable", "body exists only in the exact `test-program,cross-chain` beta profile;", "every other build keeps the ABI but rejects before state transition." ]; "discriminator": [ 47, 175, 48, 23, 105, 150, 94, 207 ]; "accounts": [ { "name": "crossChainConfig"; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 99, 111, 110, 102, 105, 103 ]; } ]; }; }, { "name": "crossChainVaultRoute"; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 114, 111, 117, 116, 101 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "crossChainIntent"; "docs": [ "Heap-boxed to keep Anchor's generated account parser below the SBF", "4 KiB stack-frame limit. This address is static at hook-construction", "time and its rent must be included in the hook expense." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 105, 110, 116, 101, 110, 116 ]; }, { "kind": "const"; "value": [ 100, 101, 112, 111, 115, 105, 116 ]; }, { "kind": "account"; "path": "lpVault"; }, { "kind": "arg"; "path": "args.beneficiary"; }, { "kind": "arg"; "path": "args.nonce"; } ]; }; }, { "name": "extcallMeta"; "docs": [ "order metadata account. The handler requires this account to be", "nonempty, nonexecutable, and owned by the authenticated DLN executor." ]; }, { "name": "extcallAuthority"; "docs": [ "DLN's substituted CPI signer. Hook expense funds first-use sender-share", "ATA rent, this Gamma intent's rent, and the exact native dePort fee", "transferred to Gamma's sender." ]; "writable": true; "signer": true; }, { "name": "extcallWallet"; "writable": true; }, { "name": "crossChainSender"; "docs": [ "only when calling deBridge. The handler verifies owner and data before", "funding it with the live native fixed fee." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 115, 101, 110, 100, 101, 114 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "crossChainSenderShareWallet"; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "crossChainSender"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "sharesMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "instructions"; "docs": [ "stack height are checked in the handler." ]; "address": "Sysvar1nstructions1111111111111111111111111"; }, { "name": "lpVault"; "writable": true; "relations": [ "withdrawalPolicy", "depositPolicy" ]; }, { "name": "withdrawalPolicy"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 97, 108, 95, 112, 111, 108, 105, 99, 121 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "depositPolicy"; "pda": { "seeds": [ { "kind": "const"; "value": [ 100, 101, 112, 111, 115, 105, 116, 95, 112, 111, 108, 105, 99, 121 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "assetsAccount"; "writable": true; "relations": [ "lpVault" ]; }, { "name": "assetsMint"; "relations": [ "lpVault" ]; }, { "name": "sharesMint"; "writable": true; "relations": [ "lpVault" ]; }, { "name": "systemProgram"; "address": "11111111111111111111111111111111"; }, { "name": "tokenProgram"; }, { "name": "associatedTokenProgram"; "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; } ]; "args": [ { "name": "args"; "type": { "defined": { "name": "crossChainDepositArgs"; }; }; } ]; }, { "name": "deposit"; "docs": [ "Deposit assets and receive shares instantly.", "Requires NAV to be fresh (within nav_max_staleness)." ]; "discriminator": [ 242, 35, 198, 137, 82, 225, 242, 182 ]; "accounts": [ { "name": "user"; "docs": [ "User depositing into the vault." ]; "writable": true; "signer": true; }, { "name": "lpVault"; "docs": [ "LpVault to deposit into." ]; "writable": true; "relations": [ "withdrawalPolicy", "depositPolicy" ]; }, { "name": "withdrawalPolicy"; "docs": [ "Withdrawal policy for net capacity accounting. Deposits offset usage." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 97, 108, 95, 112, 111, 108, 105, 99, 121 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "depositPolicy"; "docs": [ "Hard capacity shared by all deposit sources." ]; "pda": { "seeds": [ { "kind": "const"; "value": [ 100, 101, 112, 111, 115, 105, 116, 95, 112, 111, 108, 105, 99, 121 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "assetsAccount"; "docs": [ "Token account for vault assets." ]; "writable": true; "relations": [ "lpVault" ]; }, { "name": "userAssetAta"; "docs": [ "User's asset token account (source of deposit)." ]; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "user"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "assetsMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "userShareAta"; "docs": [ "User's share token account (destination for minted shares)." ]; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "user"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "sharesMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "depositReceipt"; "docs": [ "Deposit receipt account", "Derived from user pubkey and lp_vault pubkey." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 100, 101, 112, 111, 115, 105, 116, 95, 114, 101, 99, 101, 105, 112, 116 ]; }, { "kind": "account"; "path": "user"; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "assetsMint"; "docs": [ "Mint of the vault assets." ]; "relations": [ "lpVault" ]; }, { "name": "sharesMint"; "docs": [ "Mint for vault shares." ]; "writable": true; "relations": [ "lpVault" ]; }, { "name": "systemProgram"; "docs": [ "System program." ]; "address": "11111111111111111111111111111111"; }, { "name": "tokenProgram"; "docs": [ "Token program." ]; }, { "name": "associatedTokenProgram"; "docs": [ "Associated token program." ]; "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; } ]; "args": [ { "name": "amount"; "type": "u64"; } ]; }, { "name": "emergencyUpdateNav"; "docs": [ "Apply a truthful NAV movement outside the normal window cap. Requires", "distinct vault fund-authority and global super-admin signatures and the", "same complete optimistic-concurrency tuple as a normal publication." ]; "discriminator": [ 99, 77, 126, 170, 191, 0, 36, 218 ]; "accounts": [ { "name": "fundAuthority"; "docs": [ "Ordinary per-vault NAV authority. Emergency use always requires this", "signer and the independent global super-admin below." ]; "signer": true; "relations": [ "lpVault" ]; }, { "name": "superAdmin"; "signer": true; "relations": [ "globalConfig" ]; }, { "name": "globalConfig"; "pda": { "seeds": [ { "kind": "const"; "value": [ 103, 108, 111, 98, 97, 108, 95, 99, 111, 110, 102, 105, 103 ]; } ]; }; }, { "name": "lpVault"; "writable": true; "relations": [ "navUpdatePolicy" ]; }, { "name": "navUpdatePolicy"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 110, 97, 118, 95, 117, 112, 100, 97, 116, 101, 95, 112, 111, 108, 105, 99, 121 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "sharesMint"; "relations": [ "lpVault" ]; } ]; "args": [ { "name": "newNav"; "type": "u64"; }, { "name": "expectedNav"; "type": "u64"; }, { "name": "expectedTotalShares"; "type": "u64"; }, { "name": "expectedNavUpdatedAt"; "type": "i64"; }, { "name": "expectedPendingWithdrawalValue"; "type": "u64"; } ]; }, { "name": "fulfillWithdrawal"; "docs": [ "Fulfill pending withdrawals by transferring assets to user's escrow.", "Called by keeper when liquidity is available." ]; "discriminator": [ 57, 37, 123, 221, 103, 93, 162, 176 ]; "accounts": [ { "name": "signer"; "docs": [ "Keeper signer. Must be the vault's fund_authority or keeper_authority." ]; "writable": true; "signer": true; }, { "name": "user"; }, { "name": "lpVault"; "docs": [ "LpVault." ]; "writable": true; "relations": [ "withdrawalPolicy" ]; }, { "name": "withdrawalPolicy"; "docs": [ "Withdrawal policy used to retain the configured base-asset fee." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 97, 108, 95, 112, 111, 108, 105, 99, 121 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "assetsAccount"; "docs": [ "Vault's asset token account." ]; "writable": true; "relations": [ "lpVault" ]; }, { "name": "assetsMint"; "docs": [ "Mint of the vault assets." ]; "relations": [ "lpVault" ]; }, { "name": "sharesMint"; "docs": [ "Mint for vault shares." ]; "relations": [ "lpVault" ]; }, { "name": "withdrawEscrow"; "docs": [ "User's withdraw escrow." ]; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 95, 101, 115, 99, 114, 111, 119 ]; }, { "kind": "account"; "path": "user"; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "escrowAssetsAccount"; "docs": [ "Escrow's asset token account (destination for assets)." ]; "writable": true; "relations": [ "withdrawEscrow" ]; }, { "name": "withdrawReceipt"; "docs": [ "User's withdraw receipt." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 95, 114, 101, 99, 101, 105, 112, 116 ]; }, { "kind": "account"; "path": "user"; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "tokenProgram"; "docs": [ "Token program." ]; } ]; "args": []; }, { "name": "initGlobalConfig"; "discriminator": [ 140, 136, 214, 48, 87, 0, 120, 255 ]; "accounts": [ { "name": "signer"; "docs": [ "Signer initializing the GlobalConfig. MUST be the program's", "BPFLoaderUpgradeable upgrade authority (proven by the constraints on", "`program` + `program_data` below). Becomes the super_admin; the only", "later rotation path is `update_admin_authorities`, which is likewise", "gated on the upgrade authority. On a fresh deploy, call init BEFORE", "finalizing the program (a finalized/`--final` program has no upgrade", "authority → init AND rotation impossible) and while a plain deployer", "keypair (not a multisig PDA) still holds it." ]; "writable": true; "signer": true; }, { "name": "globalConfig"; "docs": [ "Global config account. Derived with a single str." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 103, 108, 111, 98, 97, 108, 95, 99, 111, 110, 102, 105, 103 ]; } ]; }; }, { "name": "program"; "docs": [ "This program's own account; ties `program_data` to this program so the", "upgrade-authority check below cannot be satisfied with an unrelated", "program's ProgramData." ]; "address": "GaMmanX9i4jGmqDZZD2tbD6B2v9p21btenPneMXnTczV"; }, { "name": "programData"; "docs": [ "ProgramData account holding the program's upgrade authority. Gate: the", "signer must equal the upgrade authority. `programdata_address()` returns", "`Ok(None)` for a non-upgradeable load and a revoked authority is `None`,", "so a `None` on either side fails closed." ]; }, { "name": "systemProgram"; "docs": [ "System program." ]; "address": "11111111111111111111111111111111"; } ]; "args": [ { "name": "createAuthority"; "type": "pubkey"; } ]; }, { "name": "initLpVault"; "discriminator": [ 40, 247, 24, 8, 152, 98, 18, 220 ]; "accounts": [ { "name": "signer"; "docs": [ "User creating the vault." ]; "writable": true; "signer": true; }, { "name": "lpVault"; "docs": [ "Lp vault being created." ]; "writable": true; "pda": { "seeds": [ { "kind": "arg"; "path": "vaultName"; }, { "kind": "const"; "value": [ 118, 97, 117, 108, 116 ]; }, { "kind": "account"; "path": "assetsMint"; } ]; }; }, { "name": "globalConfig"; "pda": { "seeds": [ { "kind": "const"; "value": [ 103, 108, 111, 98, 97, 108, 95, 99, 111, 110, 102, 105, 103 ]; } ]; }; }, { "name": "sharesMint"; "docs": [ "Mint for shares, minted on deposit." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 115, 104, 97, 114, 101, 115 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "assetsMint"; "docs": [ "Mint of the assets, USDC, maybe configurable." ]; }, { "name": "assetsAccount"; "docs": [ "Token account for main asset." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 109, 97, 105, 110, 95, 97, 115, 115, 101, 116, 115 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "pendingSharesAccount"; "docs": [ "Token account where shares are held during queued (illiquid) withdrawals." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 112, 101, 110, 100, 105, 110, 103, 95, 115, 104, 97, 114, 101, 115 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "withdrawalPolicy"; "docs": [ "Withdrawal policy PDA for retained fees and net outflow caps." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 97, 108, 95, 112, 111, 108, 105, 99, 121 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "depositPolicy"; "docs": [ "Shared hard deposit capacity. New vaults start fail-closed until their", "fund authority explicitly configures this policy." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 100, 101, 112, 111, 115, 105, 116, 95, 112, 111, 108, 105, 99, 121 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "feeRecipientAccount"; "docs": [ "Optional fee recipient token account (shares mint).", "Required when initializing with performance_fee_bps > 0." ]; "optional": true; }, { "name": "systemProgram"; "docs": [ "System program." ]; "address": "11111111111111111111111111111111"; }, { "name": "tokenProgram"; "docs": [ "Can either be spl-token or token-2022." ]; } ]; "args": [ { "name": "fundAuthority"; "type": "pubkey"; }, { "name": "navMaxStaleness"; "type": "u64"; }, { "name": "vaultName"; "type": "string"; }, { "name": "decimals"; "type": "u8"; }, { "name": "performanceFeeBps"; "type": "u16"; }, { "name": "assessmentIntervalSecs"; "type": "i64"; }, { "name": "keeperAuthority"; "type": { "option": "pubkey"; }; } ]; }, { "name": "initNavUpdatePolicy"; "docs": [ "Create the per-vault fixed-window NAV movement policy. Existing vaults", "must initialize this PDA during the checked-NAV upgrade window; normal", "checked publications fail closed while it is absent." ]; "discriminator": [ 216, 234, 28, 89, 151, 95, 189, 56 ]; "accounts": [ { "name": "fundAuthority"; "docs": [ "Existing vault fund authority. Pays for the dedicated policy PDA." ]; "writable": true; "signer": true; "relations": [ "lpVault" ]; }, { "name": "lpVault"; }, { "name": "navUpdatePolicy"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 110, 97, 118, 95, 117, 112, 100, 97, 116, 101, 95, 112, 111, 108, 105, 99, 121 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "systemProgram"; "address": "11111111111111111111111111111111"; } ]; "args": []; }, { "name": "initializeCrossChainConfig"; "docs": [ "Initialize Gamma's program-owned cross-chain control plane. The", "existing Gamma upgrade authority is the only initializer and the", "circuit breaker always starts paused." ]; "discriminator": [ 162, 136, 180, 13, 95, 156, 67, 223 ]; "accounts": [ { "name": "signer"; "writable": true; "signer": true; }, { "name": "crossChainConfig"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 99, 111, 110, 102, 105, 103 ]; } ]; }; }, { "name": "program"; "address": "GaMmanX9i4jGmqDZZD2tbD6B2v9p21btenPneMXnTczV"; }, { "name": "programData"; }, { "name": "systemProgram"; "address": "11111111111111111111111111111111"; } ]; "args": [ { "name": "admin"; "type": "pubkey"; } ]; }, { "name": "queueCrossChainWithdrawal"; "docs": [ "Move an escrowed withdrawal intent's shares into the vault's own illiquid", "withdrawal queue, so the existing keeper prices and fulfils them exactly as", "it does a native withdrawal. Leaves `nav` and `total_shares` untouched.", "Permissionless — every amount comes from the intent. Beta-only; reject-only", "otherwise." ]; "discriminator": [ 102, 132, 183, 186, 25, 146, 174, 219 ]; "accounts": [ { "name": "payer"; "docs": [ "Rent for the receipt, the escrow and their two ATAs. NOT an authority —", "every amount here comes from the intent, so any signer may pay." ]; "writable": true; "signer": true; }, { "name": "crossChainVaultRoute"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 114, 111, 117, 116, 101 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "crossChainIntent"; "docs": [ "Program-authored withdrawal intent (kind = 2). Its status is the idempotency", "guard against queueing the same withdrawal twice." ]; "writable": true; }, { "name": "lpVault"; "writable": true; "relations": [ "withdrawalPolicy" ]; }, { "name": "withdrawalPolicy"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 97, 108, 95, 112, 111, 108, 105, 99, 121 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "crossChainWithdrawer"; "docs": [ "this intent. Never signs and is never read as data — it exists only so the", "receipt and escrow seeds are 1:1 with the withdrawal. Fully constrained by", "its seeds." ]; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 119, 105, 116, 104, 100, 114, 97, 119, 101, 114 ]; }, { "kind": "account"; "path": "crossChainIntent"; } ]; }; }, { "name": "withdrawReceipt"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 95, 114, 101, 99, 101, 105, 112, 116 ]; }, { "kind": "account"; "path": "crossChainWithdrawer"; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "withdrawEscrow"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 95, 101, 115, 99, 114, 111, 119 ]; }, { "kind": "account"; "path": "crossChainWithdrawer"; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "escrowSharesAccount"; "docs": [ "Destination for the queued shares." ]; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "withdrawEscrow"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "sharesMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "escrowAssetsAccount"; "docs": [ "Initialized here so the keeper's `fulfill_withdrawal` has somewhere to put", "the assets; this instruction never writes to it." ]; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "withdrawEscrow"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "assetsMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "shareEscrow"; "docs": [ "Route-owned share escrow; source of the shares being queued." ]; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "crossChainVaultRoute"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "sharesMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "assetsMint"; "relations": [ "lpVault" ]; }, { "name": "sharesMint"; "docs": [ "Read-only: queueing MOVES shares, it does not burn them, so unlike settle", "(and unlike the claim below) this instruction needs no mint authority write." ]; "relations": [ "lpVault" ]; }, { "name": "systemProgram"; "address": "11111111111111111111111111111111"; }, { "name": "tokenProgram"; }, { "name": "associatedTokenProgram"; "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; } ]; "args": []; }, { "name": "queueCrossChainWithdrawalV2"; "docs": [ "Start a cross-chain withdrawal through the native withdrawal lifecycle.", "Liquid vault USDC becomes claimable immediately; otherwise the shares enter", "the existing keeper queue and are repriced on fulfilment. Permissionless —", "every amount comes from the intent. Beta-only; reject-only otherwise." ]; "discriminator": [ 244, 130, 119, 7, 93, 40, 215, 135 ]; "accounts": [ { "name": "payer"; "docs": [ "Rent for the receipt, the escrow and their two ATAs. NOT an authority —", "every amount here comes from the intent, so any signer may pay." ]; "writable": true; "signer": true; }, { "name": "crossChainVaultRoute"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 114, 111, 117, 116, 101 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "crossChainIntent"; "docs": [ "Program-authored withdrawal intent (kind = 2). Its status is the idempotency", "guard against queueing the same withdrawal twice." ]; "writable": true; }, { "name": "lpVault"; "writable": true; "relations": [ "withdrawalPolicy" ]; }, { "name": "withdrawalPolicy"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 97, 108, 95, 112, 111, 108, 105, 99, 121 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "assetsAccount"; "docs": [ "Vault USDC account. Liquid requests transfer from here immediately;", "illiquid requests leave it untouched for the keeper to fund later." ]; "writable": true; "relations": [ "lpVault" ]; }, { "name": "crossChainWithdrawer"; "docs": [ "this intent. Never signs and is never read as data — it exists only so the", "receipt and escrow seeds are 1:1 with the withdrawal. Fully constrained by", "its seeds." ]; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 119, 105, 116, 104, 100, 114, 97, 119, 101, 114 ]; }, { "kind": "account"; "path": "crossChainIntent"; } ]; }; }, { "name": "withdrawReceipt"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 95, 114, 101, 99, 101, 105, 112, 116 ]; }, { "kind": "account"; "path": "crossChainWithdrawer"; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "withdrawEscrow"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 95, 101, 115, 99, 114, 111, 119 ]; }, { "kind": "account"; "path": "crossChainWithdrawer"; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "escrowSharesAccount"; "docs": [ "Destination for the queued shares." ]; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "withdrawEscrow"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "sharesMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "escrowAssetsAccount"; "docs": [ "Liquid requests receive assets here immediately; queued requests leave it", "initialized for the keeper's later `fulfill_withdrawal` transfer." ]; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "withdrawEscrow"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "assetsMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "shareEscrow"; "docs": [ "Route-owned share escrow; source of the shares being queued." ]; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "crossChainVaultRoute"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "sharesMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "feeRecipientAccount"; "docs": [ "Required only when the vault has an active performance fee, exactly like", "native `withdraw`." ]; "writable": true; "optional": true; }, { "name": "assetsMint"; "relations": [ "lpVault" ]; }, { "name": "sharesMint"; "docs": [ "Mutable because the native-equivalent fee branch can mint fee shares." ]; "writable": true; "relations": [ "lpVault" ]; }, { "name": "systemProgram"; "address": "11111111111111111111111111111111"; }, { "name": "tokenProgram"; }, { "name": "associatedTokenProgram"; "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; } ]; "args": []; }, { "name": "receiveCrossChainWithdrawal"; "docs": [ "Future withdrawal intake shape. The handler and route configuration", "remain independently hard-disabled until the continuation is complete." ]; "discriminator": [ 17, 163, 45, 124, 66, 193, 202, 124 ]; "accounts": [ { "name": "crossChainConfig"; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 99, 111, 110, 102, 105, 103 ]; } ]; }; }, { "name": "crossChainVaultRoute"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 114, 111, 117, 116, 101 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "crossChainIntent"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 105, 110, 116, 101, 110, 116 ]; }, { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 97, 108 ]; }, { "kind": "account"; "path": "submission"; } ]; }; }, { "name": "submission"; }, { "name": "submissionAuthority"; "writable": true; "signer": true; }, { "name": "inboundShareWallet"; "writable": true; }, { "name": "shareEscrow"; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "crossChainVaultRoute"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "sharesMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "instructions"; "address": "Sysvar1nstructions1111111111111111111111111"; }, { "name": "lpVault"; "relations": [ "withdrawalPolicy" ]; }, { "name": "withdrawalPolicy"; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 97, 108, 95, 112, 111, 108, 105, 99, 121 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "sharesMint"; }, { "name": "systemProgram"; "address": "11111111111111111111111111111111"; }, { "name": "tokenProgram"; } ]; "args": [ { "name": "args"; "type": { "defined": { "name": "crossChainWithdrawalArgs"; }; }; } ]; }, { "name": "receiveCrossChainWithdrawalV2"; "docs": [ "Submission-authenticated BNB dePort intake. The beta handler binds the", "share amount to the complete balance of the canonical, submission-specific", "authority ATA; every other build remains reject-only." ]; "discriminator": [ 68, 182, 91, 59, 48, 217, 250, 123 ]; "accounts": [ { "name": "crossChainConfig"; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 99, 111, 110, 102, 105, 103 ]; } ]; }; }, { "name": "crossChainVaultRoute"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 114, 111, 117, 116, 101 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "crossChainIntent"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 105, 110, 116, 101, 110, 116 ]; }, { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 97, 108 ]; }, { "kind": "account"; "path": "lpVault"; }, { "kind": "arg"; "path": "args.beneficiary"; }, { "kind": "arg"; "path": "args.nonce"; } ]; }; }, { "name": "submission"; }, { "name": "submissionAuthority"; "writable": true; "signer": true; }, { "name": "inboundShareWallet"; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "submissionAuthority"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "sharesMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "shareEscrow"; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "crossChainVaultRoute"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "sharesMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "instructions"; "address": "Sysvar1nstructions1111111111111111111111111"; }, { "name": "lpVault"; "relations": [ "withdrawalPolicy" ]; }, { "name": "withdrawalPolicy"; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 97, 108, 95, 112, 111, 108, 105, 99, 121 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "sharesMint"; }, { "name": "systemProgram"; "address": "11111111111111111111111111111111"; }, { "name": "tokenProgram"; } ]; "args": [ { "name": "args"; "type": { "defined": { "name": "crossChainWithdrawalArgs"; }; }; } ]; }, { "name": "sendCrossChainWithdrawalReturn"; "docs": [ "Program-signed Solana→BNB deBridge send of the settled USDC to the", "intent's beneficiary, honoring the 18-decimal `min_output_amount_raw`.", "Beta-only; reject-only otherwise." ]; "discriminator": [ 187, 230, 11, 5, 45, 1, 122, 221 ]; "accounts": [ { "name": "settlementAuthority"; "docs": [ "Funds the deBridge native fixed fee deficit on the sender PDA." ]; "writable": true; "signer": true; }, { "name": "crossChainVaultRoute"; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 114, 111, 117, 116, 101 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "crossChainIntent"; "docs": [ "Settled withdrawal intent (kind = 2, status `ASSETS_SETTLED`). Its status", "is the idempotency guard against double send." ]; "writable": true; }, { "name": "lpVault"; }, { "name": "crossChainSender"; "docs": [ "only when calling deBridge. The handler verifies owner and data before", "funding it with the live native fixed fee." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 115, 101, 110, 100, 101, 114 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "crossChainSenderAssetWallet"; "docs": [ "Sender-owned USDC wallet holding the settled assets; deBridge debits it." ]; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "crossChainSender"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "assetsMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "assetsMint"; "relations": [ "lpVault" ]; }, { "name": "systemProgram"; "address": "11111111111111111111111111111111"; }, { "name": "tokenProgram"; } ]; "args": []; }, { "name": "setDepositPolicy"; "docs": [ "Configure the hard shared deposit capacity or pause deposits. The", "policy applies equally to native and cross-chain deposit callers." ]; "discriminator": [ 56, 138, 17, 74, 222, 84, 14, 210 ]; "accounts": [ { "name": "fundAuthority"; "signer": true; "relations": [ "lpVault" ]; }, { "name": "payer"; "docs": [ "Payer for initializing the policy on pre-upgrade vaults." ]; "writable": true; "signer": true; }, { "name": "lpVault"; }, { "name": "depositPolicy"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 100, 101, 112, 111, 115, 105, 116, 95, 112, 111, 108, 105, 99, 121 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "systemProgram"; "address": "11111111111111111111111111111111"; } ]; "args": [ { "name": "capacityAssets"; "type": "u64"; }, { "name": "depositsPaused"; "type": "bool"; } ]; }, { "name": "setFeeConfig"; "docs": [ "Configure or disable performance fee settings." ]; "discriminator": [ 221, 222, 52, 206, 114, 198, 64, 91 ]; "accounts": [ { "name": "fundAuthority"; "docs": [ "Operator / fund authority." ]; "signer": true; "relations": [ "lpVault" ]; }, { "name": "lpVault"; "writable": true; }, { "name": "sharesMint"; "writable": true; "relations": [ "lpVault" ]; }, { "name": "feeRecipientAccount"; "docs": [ "Token account that will receive fee shares.", "Required when enabling fees (performance_fee_bps > 0) or when", "mid-window settlement is needed (accrued fees must be settled", "to the old recipient before changing config).", "Omit when disabling with no accrued fees.", "Mutable because it may be the destination of a MintTo CPI during mid-window settlement." ]; "writable": true; "optional": true; }, { "name": "tokenProgram"; } ]; "args": [ { "name": "performanceFeeBps"; "type": "u16"; }, { "name": "assessmentIntervalSecs"; "type": "i64"; } ]; }, { "name": "setKeeperAuthority"; "docs": [ "Set or remove the keeper authority on a vault.", "When set, this key can call fulfill_withdrawal in addition to fund_authority." ]; "discriminator": [ 29, 124, 191, 114, 184, 243, 33, 155 ]; "accounts": [ { "name": "fundAuthority"; "docs": [ "Fund authority — only they can change keeper authority." ]; "signer": true; "relations": [ "lpVault" ]; }, { "name": "payer"; "docs": [ "Payer for any reallocation rent." ]; "writable": true; "signer": true; }, { "name": "lpVault"; "writable": true; }, { "name": "systemProgram"; "address": "11111111111111111111111111111111"; } ]; "args": [ { "name": "keeperAuthority"; "type": "pubkey"; } ]; }, { "name": "setMetadata"; "discriminator": [ 78, 157, 75, 242, 151, 20, 121, 144 ]; "accounts": [ { "name": "fundAuthority"; "docs": [ "Fund authority - only they can set metadata." ]; "writable": true; "signer": true; "relations": [ "lpVault" ]; }, { "name": "lpVault"; "docs": [ "LpVault that owns the shares_mint." ]; }, { "name": "sharesMint"; "docs": [ "Shares mint for which we're setting metadata." ]; "writable": true; "relations": [ "lpVault" ]; }, { "name": "metadataAccount"; "docs": [ "Seeds: [\"metadata\", token_metadata_program_id, mint]" ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 109, 101, 116, 97, 100, 97, 116, 97 ]; }, { "kind": "const"; "value": [ 11, 112, 101, 177, 227, 209, 124, 69, 56, 157, 82, 127, 107, 4, 195, 205, 88, 184, 108, 115, 26, 160, 253, 181, 73, 182, 209, 188, 3, 248, 41, 70 ]; }, { "kind": "account"; "path": "sharesMint"; } ]; "program": { "kind": "const"; "value": [ 11, 112, 101, 177, 227, 209, 124, 69, 56, 157, 82, 127, 107, 4, 195, 205, 88, 184, 108, 115, 26, 160, 253, 181, 73, 182, 209, 188, 3, 248, 41, 70 ]; }; }; }, { "name": "tokenMetadataProgram"; "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"; }, { "name": "systemProgram"; "docs": [ "System program." ]; "address": "11111111111111111111111111111111"; }, { "name": "rent"; "docs": [ "Rent sysvar." ]; "address": "SysvarRent111111111111111111111111111111111"; } ]; "args": [ { "name": "name"; "type": "string"; }, { "name": "symbol"; "type": "string"; }, { "name": "uri"; "type": "string"; } ]; }, { "name": "setWithdrawalPolicy"; "docs": [ "Configure retained withdrawal fees and net withdrawal caps." ]; "discriminator": [ 3, 223, 67, 81, 69, 30, 203, 150 ]; "accounts": [ { "name": "fundAuthority"; "docs": [ "Fund authority for the vault." ]; "signer": true; "relations": [ "lpVault" ]; }, { "name": "payer"; "docs": [ "Payer for creating the policy account on existing vaults." ]; "writable": true; "signer": true; }, { "name": "lpVault"; }, { "name": "withdrawalPolicy"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 97, 108, 95, 112, 111, 108, 105, 99, 121 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "systemProgram"; "address": "11111111111111111111111111111111"; } ]; "args": [ { "name": "withdrawalFeeBps"; "type": "u16"; }, { "name": "hourlyWithdrawalCapBps"; "type": "u16"; }, { "name": "dailyWithdrawalCapBps"; "type": "u16"; } ]; }, { "name": "settleCrossChainWithdrawal"; "docs": [ "Realize an escrowed withdrawal intent's shares into native Solana vault", "assets at fresh NAV, honoring the intent's `min_vault_assets` floor and", "staging the assets for the BNB return send. Beta-only; reject-only", "otherwise." ]; "discriminator": [ 48, 72, 115, 56, 187, 76, 67, 246 ]; "accounts": [ { "name": "settlementAuthority"; "writable": true; "signer": true; }, { "name": "crossChainVaultRoute"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 114, 111, 117, 116, 101 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "crossChainIntent"; "docs": [ "Program-authored withdrawal intent (kind = 2). Bound to this route; its", "status is the idempotency guard against double settlement." ]; "writable": true; }, { "name": "lpVault"; "writable": true; "relations": [ "withdrawalPolicy" ]; }, { "name": "withdrawalPolicy"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 97, 108, 95, 112, 111, 108, 105, 99, 121 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "assetsAccount"; "docs": [ "Vault's asset token account (source of the settled USDC)." ]; "writable": true; "relations": [ "lpVault" ]; }, { "name": "shareEscrow"; "docs": [ "Route-owned share escrow; source of the shares being burned." ]; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "crossChainVaultRoute"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "sharesMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "makerAssetAccount"; "docs": [ "Destination for the settled USDC and the give-ATA of the off-chain DLN", "return order: the canonical ATA(settlement_authority, assets_mint). The", "keeper that signs settle (`is_keeper_authorized`) receives the assets and", "is the real DLN order maker (DLN requires a signing maker). No trust", "expansion — this authority already controls vault funds. b-gva pins the", "maker give-ATA to exactly this account." ]; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "settlementAuthority"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "assetsMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "feeRecipientAccount"; "docs": [ "Required (and validated against `lp_vault.fee_recipient`) only when the", "vault has an active performance fee; omit otherwise." ]; "writable": true; "optional": true; }, { "name": "assetsMint"; "relations": [ "lpVault" ]; }, { "name": "sharesMint"; "writable": true; "relations": [ "lpVault" ]; }, { "name": "systemProgram"; "address": "11111111111111111111111111111111"; }, { "name": "tokenProgram"; }, { "name": "associatedTokenProgram"; "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; } ]; "args": []; }, { "name": "updateAdminAuthorities"; "docs": [ "Rotate super_admin, create_authority, and permissioned_creation", "atomically. Recovery instruction gated on the program's", "BPFLoaderUpgradeable upgrade authority (NOT the current super_admin),", "so a compromised or lost super_admin can be replaced." ]; "discriminator": [ 41, 241, 142, 184, 75, 212, 72, 171 ]; "accounts": [ { "name": "signer"; "docs": [ "Signer rotating the authorities. MUST be the program's", "BPFLoaderUpgradeable upgrade authority (proven by the constraints on", "`program` + `program_data` below)." ]; "signer": true; }, { "name": "globalConfig"; "docs": [ "The global config account being rotated. Unique in the program.", "Deliberately no `has_one = super_admin`: see the struct docs." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 103, 108, 111, 98, 97, 108, 95, 99, 111, 110, 102, 105, 103 ]; } ]; }; }, { "name": "program"; "docs": [ "This program's own account; ties `program_data` to this program so the", "upgrade-authority check below cannot be satisfied with an unrelated", "program's ProgramData." ]; "address": "GaMmanX9i4jGmqDZZD2tbD6B2v9p21btenPneMXnTczV"; }, { "name": "programData"; "docs": [ "ProgramData account holding the program's upgrade authority. Gate: the", "signer must equal the upgrade authority. `programdata_address()` returns", "`Ok(None)` for a non-upgradeable load and a revoked authority is `None`,", "so a `None` on either side fails closed." ]; } ]; "args": [ { "name": "newSuperAdmin"; "type": "pubkey"; }, { "name": "newCreateAuthority"; "type": "pubkey"; }, { "name": "newPermissionedCreation"; "type": "bool"; } ]; }, { "name": "updateCrossChainConfig"; "discriminator": [ 79, 141, 137, 119, 118, 242, 249, 118 ]; "accounts": [ { "name": "admin"; "signer": true; "relations": [ "crossChainConfig" ]; }, { "name": "crossChainConfig"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 99, 111, 110, 102, 105, 103 ]; } ]; }; } ]; "args": [ { "name": "newAdmin"; "type": "pubkey"; }, { "name": "depositsPaused"; "type": "bool"; } ]; }, { "name": "updateGlobalConfig"; "discriminator": [ 164, 84, 130, 189, 111, 58, 250, 200 ]; "accounts": [ { "name": "superAdmin"; "docs": [ "The signer must be the global_config super_admin." ]; "writable": true; "signer": true; "relations": [ "globalConfig" ]; }, { "name": "globalConfig"; "docs": [ "The global config account. Unique in the program." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 103, 108, 111, 98, 97, 108, 95, 99, 111, 110, 102, 105, 103 ]; } ]; }; } ]; "args": [ { "name": "newCreateAuthority"; "type": "pubkey"; }, { "name": "isCreationPermissioned"; "type": "bool"; } ]; }, { "name": "updateNav"; "docs": [ "Update the vault's NAV. Called by fund_authority (operator)." ]; "discriminator": [ 56, 16, 234, 109, 155, 165, 5, 0 ]; "accounts": [ { "name": "fundAuthority"; "docs": [ "Fund authority - only they can update NAV." ]; "signer": true; "relations": [ "lpVault" ]; }, { "name": "lpVault"; "writable": true; }, { "name": "sharesMint"; "relations": [ "lpVault" ]; } ]; "args": [ { "name": "newNav"; "type": "u64"; } ]; }, { "name": "updateNavChecked"; "docs": [ "Atomically update NAV only when the vault still matches the state read", "by the caller. This prevents deposits, withdrawals, fee assessments, or", "another NAV publish from invalidating an off-chain NAV calculation", "between preflight and transaction execution." ]; "discriminator": [ 2, 235, 178, 75, 223, 26, 72, 144 ]; "accounts": [ { "name": "fundAuthority"; "docs": [ "Fund authority - only they can update NAV." ]; "signer": true; "relations": [ "lpVault" ]; }, { "name": "lpVault"; "writable": true; }, { "name": "sharesMint"; "relations": [ "lpVault" ]; } ]; "args": [ { "name": "newNav"; "type": "u64"; }, { "name": "expectedNav"; "type": "u64"; }, { "name": "expectedTotalShares"; "type": "u64"; }, { "name": "expectedNavUpdatedAt"; "type": "i64"; } ]; }, { "name": "updateNavCheckedV2"; "docs": [ "Race-safe NAV update. The caller supplies the complete vault state used", "for its calculation, including pending-withdrawal value. The program", "compares that tuple against the live account before writing." ]; "discriminator": [ 38, 73, 237, 91, 112, 231, 73, 41 ]; "accounts": [ { "name": "fundAuthority"; "docs": [ "Fund authority - only they can update NAV." ]; "signer": true; "relations": [ "lpVault" ]; }, { "name": "lpVault"; "writable": true; "relations": [ "navUpdatePolicy" ]; }, { "name": "navUpdatePolicy"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 110, 97, 118, 95, 117, 112, 100, 97, 116, 101, 95, 112, 111, 108, 105, 99, 121 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "sharesMint"; "relations": [ "lpVault" ]; } ]; "args": [ { "name": "newNav"; "type": "u64"; }, { "name": "expectedNav"; "type": "u64"; }, { "name": "expectedTotalShares"; "type": "u64"; }, { "name": "expectedNavUpdatedAt"; "type": "i64"; }, { "name": "expectedPendingWithdrawalValue"; "type": "u64"; } ]; }, { "name": "updateNavMaxStaleness"; "docs": [ "Update the NAV max staleness window on a vault." ]; "discriminator": [ 212, 225, 120, 109, 83, 96, 40, 17 ]; "accounts": [ { "name": "fundAuthority"; "docs": [ "Fund authority — only they can change vault config." ]; "signer": true; "relations": [ "lpVault" ]; }, { "name": "lpVault"; "writable": true; } ]; "args": [ { "name": "navMaxStaleness"; "type": "u64"; } ]; }, { "name": "upsertCrossChainVaultRoute"; "discriminator": [ 10, 80, 62, 8, 145, 215, 7, 31 ]; "accounts": [ { "name": "admin"; "writable": true; "signer": true; "relations": [ "crossChainConfig" ]; }, { "name": "crossChainConfig"; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 99, 111, 110, 102, 105, 103 ]; } ]; }; }, { "name": "crossChainVaultRoute"; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 99, 114, 111, 115, 115, 95, 99, 104, 97, 105, 110, 95, 114, 111, 117, 116, 101 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "lpVault"; }, { "name": "assetsMint"; }, { "name": "sharesMint"; }, { "name": "shareEscrow"; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "crossChainVaultRoute"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "sharesMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "systemProgram"; "address": "11111111111111111111111111111111"; }, { "name": "tokenProgram"; }, { "name": "associatedTokenProgram"; "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; } ]; "args": [ { "name": "bnbUsdc"; "type": { "array": [ "u8", 20 ]; }; }, { "name": "bnbUsdt"; "type": { "array": [ "u8", 20 ]; }; }, { "name": "depositsEnabled"; "type": "bool"; }, { "name": "withdrawalsEnabled"; "type": "bool"; } ]; }, { "name": "withdraw"; "docs": [ "Withdraw shares for assets.", "If vault has sufficient liquidity: instant withdrawal.", "If illiquid: creates WithdrawReceipt, shares go to pending account." ]; "discriminator": [ 183, 18, 70, 156, 148, 109, 161, 34 ]; "accounts": [ { "name": "user"; "docs": [ "User withdrawing from the vault." ]; "writable": true; "signer": true; }, { "name": "lpVault"; "docs": [ "LpVault to withdraw from." ]; "writable": true; "relations": [ "withdrawalPolicy" ]; }, { "name": "withdrawalPolicy"; "docs": [ "Withdrawal policy for retained asset fees and net withdrawal caps." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 97, 108, 95, 112, 111, 108, 105, 99, 121 ]; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "assetsAccount"; "docs": [ "Token account for vault assets." ]; "writable": true; "relations": [ "lpVault" ]; }, { "name": "userShareAta"; "docs": [ "User's share token account (source of shares)." ]; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "user"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "sharesMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "assetsMint"; "docs": [ "Mint of the vault assets." ]; "relations": [ "lpVault" ]; }, { "name": "sharesMint"; "docs": [ "Mint for vault shares (mutable for fee mint CPI)." ]; "writable": true; "relations": [ "lpVault" ]; }, { "name": "feeRecipientAccount"; "docs": [ "Token account that receives fee shares on withdrawal.", "Required when `has_fee_config()` is true; omit otherwise.", "Mutable because it is the destination of a MintTo CPI." ]; "writable": true; "optional": true; }, { "name": "withdrawEscrow"; "docs": [ "Withdraw escrow - holds assets and shares until user claims." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 95, 101, 115, 99, 114, 111, 119 ]; }, { "kind": "account"; "path": "user"; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "escrowAssetsAccount"; "docs": [ "Escrow's asset token account (holds USDC for user to claim)." ]; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "withdrawEscrow"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "assetsMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "escrowSharesAccount"; "docs": [ "Escrow's share token account (holds shares until burned on claim)." ]; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "withdrawEscrow"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "sharesMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "withdrawReceipt"; "docs": [ "Withdraw receipt - tracks pending and claimable amounts (accumulates)." ]; "writable": true; "pda": { "seeds": [ { "kind": "const"; "value": [ 119, 105, 116, 104, 100, 114, 97, 119, 95, 114, 101, 99, 101, 105, 112, 116 ]; }, { "kind": "account"; "path": "user"; }, { "kind": "account"; "path": "lpVault"; } ]; }; }, { "name": "systemProgram"; "docs": [ "System program." ]; "address": "11111111111111111111111111111111"; }, { "name": "tokenProgram"; "docs": [ "Token program." ]; }, { "name": "associatedTokenProgram"; "docs": [ "Associated token program." ]; "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; } ]; "args": [ { "name": "sharesAmount"; "type": "u64"; } ]; }, { "name": "withdrawAssets"; "docs": [ "Withdraw assets from vault to operator wallet for investment." ]; "discriminator": [ 202, 105, 54, 155, 56, 33, 207, 254 ]; "accounts": [ { "name": "fundAuthority"; "writable": true; "signer": true; "relations": [ "lpVault" ]; }, { "name": "lpVault"; }, { "name": "assetsAccount"; "writable": true; "relations": [ "lpVault" ]; }, { "name": "authorityAssetAta"; "writable": true; "pda": { "seeds": [ { "kind": "account"; "path": "fundAuthority"; }, { "kind": "account"; "path": "tokenProgram"; }, { "kind": "account"; "path": "assetsMint"; } ]; "program": { "kind": "const"; "value": [ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 ]; }; }; }, { "name": "assetsMint"; "relations": [ "lpVault" ]; }, { "name": "systemProgram"; "address": "11111111111111111111111111111111"; }, { "name": "tokenProgram"; }, { "name": "associatedTokenProgram"; "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; } ]; "args": [ { "name": "amount"; "type": "u64"; } ]; } ]; "accounts": [ { "name": "crossChainConfig"; "discriminator": [ 74, 146, 238, 67, 67, 21, 3, 218 ]; }, { "name": "crossChainIntent"; "discriminator": [ 37, 183, 58, 87, 62, 179, 16, 114 ]; }, { "name": "crossChainVaultRoute"; "discriminator": [ 48, 216, 186, 31, 186, 216, 19, 166 ]; }, { "name": "depositPolicy"; "discriminator": [ 159, 243, 65, 242, 81, 27, 41, 167 ]; }, { "name": "depositReceipt"; "discriminator": [ 64, 175, 24, 183, 138, 109, 70, 78 ]; }, { "name": "globalConfig"; "discriminator": [ 149, 8, 156, 202, 160, 252, 176, 217 ]; }, { "name": "lpVault"; "discriminator": [ 189, 45, 167, 23, 91, 118, 105, 190 ]; }, { "name": "navUpdatePolicy"; "discriminator": [ 120, 129, 130, 73, 109, 226, 91, 12 ]; }, { "name": "withdrawEscrow"; "discriminator": [ 161, 63, 221, 55, 116, 204, 131, 11 ]; }, { "name": "withdrawReceipt"; "discriminator": [ 132, 238, 44, 182, 207, 9, 124, 140 ]; }, { "name": "withdrawalPolicy"; "discriminator": [ 52, 231, 68, 59, 247, 250, 119, 244 ]; } ]; "events": [ { "name": "adminAuthoritiesUpdated"; "discriminator": [ 1, 164, 87, 62, 157, 85, 1, 113 ]; }, { "name": "crossChainConfigUpdated"; "discriminator": [ 50, 228, 95, 17, 86, 48, 61, 70 ]; }, { "name": "crossChainDepositCompleted"; "discriminator": [ 45, 209, 209, 207, 158, 87, 232, 168 ]; }, { "name": "crossChainDepositDestinationAuthenticated"; "discriminator": [ 214, 108, 125, 178, 219, 22, 101, 214 ]; }, { "name": "crossChainIntentReplayAccepted"; "discriminator": [ 221, 50, 69, 6, 52, 30, 90, 159 ]; }, { "name": "crossChainVaultRouteUpdated"; "discriminator": [ 181, 72, 59, 8, 36, 234, 89, 88 ]; }, { "name": "crossChainWithdrawalDeliverySurplus"; "discriminator": [ 213, 204, 131, 208, 81, 144, 99, 235 ]; }, { "name": "crossChainWithdrawalEscrowed"; "discriminator": [ 72, 146, 194, 25, 142, 51, 182, 26 ]; }, { "name": "crossChainWithdrawalReturnSent"; "discriminator": [ 237, 14, 156, 162, 211, 80, 105, 153 ]; }, { "name": "crossChainWithdrawalSettled"; "discriminator": [ 96, 92, 225, 1, 2, 51, 96, 26 ]; }, { "name": "depositPolicyUpdated"; "discriminator": [ 190, 38, 79, 160, 80, 143, 90, 255 ]; }, { "name": "feeConfigUpdated"; "discriminator": [ 45, 50, 42, 173, 193, 67, 52, 244 ]; }, { "name": "feesAssessed"; "discriminator": [ 210, 177, 59, 191, 116, 251, 25, 131 ]; }, { "name": "navEmergencyOverrideApplied"; "discriminator": [ 106, 20, 168, 70, 152, 131, 110, 219 ]; }, { "name": "navUpdatePolicyInitialized"; "discriminator": [ 67, 240, 192, 111, 90, 46, 28, 18 ]; }, { "name": "navUpdateWindowApplied"; "discriminator": [ 215, 116, 21, 53, 41, 234, 250, 73 ]; }, { "name": "withdrawalFeeRetained"; "discriminator": [ 105, 104, 190, 198, 168, 231, 18, 182 ]; }, { "name": "withdrawalFeesSettled"; "discriminator": [ 106, 253, 199, 177, 101, 104, 38, 219 ]; }, { "name": "withdrawalPolicyUpdated"; "discriminator": [ 252, 196, 144, 224, 210, 3, 71, 66 ]; } ]; "errors": [ { "code": 6000; "name": "arithmeticError"; "msg": "Arithmetic error!"; }, { "code": 6001; "name": "obsoleteVaultData"; "msg": "LpVault data is outdated!"; }, { "code": 6002; "name": "staleNav"; "msg": "NAV is stale - operator must update NAV before this operation!"; }, { "code": 6003; "name": "unauthorized"; "msg": "Signer is not an authority!"; }, { "code": 6004; "name": "invalidMint"; "msg": "Invalid mint extension!"; }, { "code": 6005; "name": "nameTooLong"; "msg": "LP Vault name is too long!"; }, { "code": 6006; "name": "blockedDeposit"; "msg": "Deposits are blocked - NAV is zero!"; }, { "code": 6007; "name": "insufficientLiquidity"; "msg": "Insufficient liquid assets for instant withdrawal!"; }, { "code": 6008; "name": "invalidShareAmount"; "msg": "Invalid share amount!"; }, { "code": 6009; "name": "invalidDepositAmount"; "msg": "Invalid deposit amount!"; }, { "code": 6010; "name": "noPendingWithdrawal"; "msg": "No pending withdrawal to fulfill!"; }, { "code": 6011; "name": "noClaimableAssets"; "msg": "No claimable assets to withdraw!"; }, { "code": 6012; "name": "feeRecipientNotConfigured"; "msg": "Fee recipient is not configured!"; }, { "code": 6013; "name": "invalidPerformanceFeeBps"; "msg": "Invalid performance fee - must be <= MAX_PERFORMANCE_FEE_BPS!"; }, { "code": 6014; "name": "invalidFeeRecipient"; "msg": "Invalid fee recipient account!"; }, { "code": 6015; "name": "assessmentTooEarly"; "msg": "Assessment interval has not elapsed!"; }, { "code": 6016; "name": "invalidAssessmentInterval"; "msg": "Invalid assessment interval!"; }, { "code": 6017; "name": "navUpdateTooLarge"; "msg": "NAV update would change share price by more than the allowed maximum!"; }, { "code": 6018; "name": "invalidWithdrawalFeeBps"; "msg": "Invalid withdrawal fee - must be <= MAX_WITHDRAWAL_FEE_BPS!"; }, { "code": 6019; "name": "invalidWithdrawalCapBps"; "msg": "Invalid withdrawal cap - must be <= 10000 bps!"; }, { "code": 6020; "name": "hourlyWithdrawalCapExceeded"; "msg": "Withdrawal exceeds hourly vault capacity!"; }, { "code": 6021; "name": "dailyWithdrawalCapExceeded"; "msg": "Withdrawal exceeds daily vault capacity!"; }, { "code": 6022; "name": "invalidWithdrawalPolicy"; "msg": "Invalid withdrawal policy account!"; }, { "code": 6023; "name": "invalidAuthority"; "msg": "New authority cannot be the default (all-zeros) pubkey!"; }, { "code": 6024; "name": "navUpdateStateMismatch"; "msg": "Vault NAV state changed since the expected state was read!"; }, { "code": 6025; "name": "invalidDepositPolicy"; "msg": "Invalid deposit policy account!"; }, { "code": 6026; "name": "depositsPaused"; "msg": "Deposits are paused for this vault!"; }, { "code": 6027; "name": "depositCapacityExceeded"; "msg": "Deposit would exceed the vault capacity!"; }, { "code": 6028; "name": "invalidCrossChainRoute"; "msg": "Invalid cross-chain vault route"; }, { "code": 6029; "name": "crossChainRouteDisabled"; "msg": "Cross-chain vault route is disabled"; }, { "code": 6030; "name": "invalidEvmAddress"; "msg": "Invalid BNB address"; }, { "code": 6031; "name": "crossChainTokenNotAllowed"; "msg": "BNB token is not allowlisted"; }, { "code": 6032; "name": "crossChainIntentExpired"; "msg": "Cross-chain intent deadline has expired"; }, { "code": 6033; "name": "invalidCrossChainAmount"; "msg": "Invalid cross-chain amount"; }, { "code": 6034; "name": "crossChainMinimumOutputNotMet"; "msg": "Cross-chain minimum output cannot be met"; }, { "code": 6035; "name": "crossChainIntentReplayConflict"; "msg": "Conflicting replay of an existing cross-chain intent"; }, { "code": 6036; "name": "invalidCrossChainIntentState"; "msg": "Invalid cross-chain intent state"; }, { "code": 6037; "name": "invalidDebridgeCaller"; "msg": "Caller is not the authenticated deBridge execution program"; }, { "code": 6038; "name": "invalidDebridgeMetadata"; "msg": "Invalid deBridge execution metadata account"; }, { "code": 6039; "name": "invalidDebridgeSubmissionAuthority"; "msg": "Invalid deBridge submission authority"; }, { "code": 6040; "name": "invalidDebridgeDeliveryBalance"; "msg": "Invalid deBridge delivery balance invariant"; }, { "code": 6041; "name": "invalidDebridgeSendAccounts"; "msg": "Invalid deBridge send account boundary"; }, { "code": 6042; "name": "crossChainExternalBindingUnavailable"; "msg": "Cross-chain external protocol binding is not activated"; }, { "code": 6043; "name": "crossChainConfigurationRequiresPause"; "msg": "Cross-chain route configuration requires deposits to be paused"; }, { "code": 6044; "name": "invalidDebridgeOutboundBalance"; "msg": "deBridge did not debit the exact outbound share amount"; }, { "code": 6045; "name": "legacyNavUpdateDisabled"; "msg": "Legacy NAV update instructions are disabled; use update_nav_checked_v2"; }, { "code": 6046; "name": "residualNavRequiresReconciliation"; "msg": "A zero-share vault must have zero NAV before accepting deposits"; }, { "code": 6047; "name": "residualAssetsRequireReconciliation"; "msg": "A zero-share vault must have no residual custody assets before accepting deposits"; }, { "code": 6048; "name": "invalidNavUpdatePolicy"; "msg": "Invalid NAV update policy account"; }, { "code": 6049; "name": "navWindowAnchorZero"; "msg": "A zero-price NAV window requires the separately governed emergency override"; }, { "code": 6050; "name": "navUpdateWindowClockInvalid"; "msg": "The NAV update window timestamp is ahead of the current clock"; }, { "code": 6051; "name": "navEmergencyAuthoritiesNotDistinct"; "msg": "Emergency NAV override authorities must be distinct"; }, { "code": 6052; "name": "navUpdateRequiresZeroNavWhenNoShares"; "msg": "A vault with no outstanding shares must keep NAV at zero"; } ]; "types": [ { "name": "adminAuthoritiesUpdated"; "type": { "kind": "struct"; "fields": [ { "name": "oldSuperAdmin"; "type": "pubkey"; }, { "name": "newSuperAdmin"; "type": "pubkey"; }, { "name": "oldCreateAuthority"; "type": "pubkey"; }, { "name": "newCreateAuthority"; "type": "pubkey"; }, { "name": "oldPermissionedCreation"; "type": "bool"; }, { "name": "newPermissionedCreation"; "type": "bool"; } ]; }; }, { "name": "crossChainConfig"; "docs": [ "Program-wide administration for Gamma-owned cross-chain entrypoints.", "Initialization is upgrade-authority gated and always starts paused." ]; "type": { "kind": "struct"; "fields": [ { "name": "admin"; "type": "pubkey"; }, { "name": "depositsPaused"; "docs": [ "Global deposit-only circuit breaker. Withdrawal intake has its own hard", "executable gate and remains unavailable in this release." ]; "type": "bool"; }, { "name": "bump"; "type": "u8"; } ]; }; }, { "name": "crossChainConfigUpdated"; "type": { "kind": "struct"; "fields": [ { "name": "oldAdmin"; "type": "pubkey"; }, { "name": "newAdmin"; "type": "pubkey"; }, { "name": "depositsPaused"; "type": "bool"; } ]; }; }, { "name": "crossChainDepositArgs"; "type": { "kind": "struct"; "fields": [ { "name": "beneficiary"; "docs": [ "BNB recipient of the managed deAsset. This is order payload data; DLN's", "public Solana metadata does not prove it is the source transaction maker." ]; "type": { "array": [ "u8", 20 ]; }; }, { "name": "sourceToken"; "docs": [ "Declared hook payload value only. The published ExtcallMeta layout does", "not expose the DLN CreatedOrder giveOffer, so this field cannot prove", "which BNB token funded the order." ]; "type": { "array": [ "u8", 20 ]; }; }, { "name": "depositAmount"; "docs": [ "Declared destination take-token tranche. This is not the BNB", "CreatedOrder give amount, which may use different decimals and terms." ]; "type": "u64"; }, { "name": "minBnbShares"; "docs": [ "Minimum shares after deBridge transfer fees." ]; "type": "u64"; }, { "name": "deadline"; "type": "i64"; }, { "name": "nonce"; "type": "u64"; } ]; }; }, { "name": "crossChainDepositCompleted"; "type": { "kind": "struct"; "fields": [ { "name": "intent"; "type": "pubkey"; }, { "name": "replayKey"; "type": "pubkey"; }, { "name": "lpVault"; "type": "pubkey"; }, { "name": "nativeSender"; "docs": [ "Gamma-derived signer recorded by deBridge as `nativeSender`." ]; "type": "pubkey"; }, { "name": "beneficiary"; "type": { "array": [ "u8", 20 ]; }; }, { "name": "depositedAssets"; "type": "u64"; }, { "name": "bridgedShares"; "type": "u64"; }, { "name": "nonce"; "type": "u64"; } ]; }; }, { "name": "crossChainDepositDestinationAuthenticated"; "docs": [ "Additive audit event for the exact destination-delivery boundary. The", "existing `CrossChainDepositCompleted` event remains byte-for-byte stable." ]; "type": { "kind": "struct"; "fields": [ { "name": "intent"; "type": "pubkey"; }, { "name": "replayKey"; "docs": [ "DLN's executor-owned ExtcallMeta substituted for the active order." ]; "type": "pubkey"; }, { "name": "lpVault"; "type": "pubkey"; }, { "name": "executor"; "type": "pubkey"; }, { "name": "extcallAuthority"; "docs": [ "DLN executor-provided signer that owns the delivered-asset token account." ]; "type": "pubkey"; }, { "name": "extcallWallet"; "docs": [ "Executor-selected token account, bound to ExtcallAuthority and", "assets_mint by the instruction's Anchor account constraints." ]; "type": "pubkey"; }, { "name": "assetsMint"; "docs": [ "Exact native vault asset mint received by Gamma (USDC for gmSTBL beta)." ]; "type": "pubkey"; }, { "name": "declaredSourceToken"; "docs": [ "Untrusted hook label retained for off-chain source-policy monitoring." ]; "type": { "array": [ "u8", 20 ]; }; }, { "name": "sourcePolicyEnforcedOnChain"; "docs": [ "Always false in this implementation: BNB source terms are not decoded", "or represented as authenticated by the Solana program." ]; "type": "bool"; }, { "name": "sourcePolicyRequiredOffChain"; "docs": [ "Always true: quote, UX, observation, and reconciliation must", "authenticate BNB give-chain/token/amount outside this program." ]; "type": "bool"; }, { "name": "deliveredAssets"; "type": "u64"; } ]; }; }, { "name": "crossChainIntent"; "type": { "kind": "struct"; "fields": [ { "name": "version"; "type": "u8"; }, { "name": "kind"; "docs": [ "1 = deposit, 2 = withdrawal." ]; "type": "u8"; }, { "name": "status"; "type": "u8"; }, { "name": "route"; "type": "pubkey"; }, { "name": "replayKey"; "docs": [ "Opaque deBridge-owned account used as the replay key." ]; "type": "pubkey"; }, { "name": "beneficiary"; "type": { "array": [ "u8", 20 ]; }; }, { "name": "sourceOrOutputToken"; "type": { "array": [ "u8", 20 ]; }; }, { "name": "inputAmount"; "type": "u64"; }, { "name": "minimumOutput"; "docs": [ "Deposit intents store the six-decimal minimum shares here; withdrawal", "intents store the six-decimal minimum native Solana vault assets here." ]; "type": "u64"; }, { "name": "minOutputAmountRaw"; "docs": [ "Authenticated minimum final BNB USDC/USDT output for withdrawals,", "encoded as a fixed-width unsigned U256 in big-endian order." ]; "type": { "array": [ "u8", 32 ]; }; }, { "name": "actualOutput"; "docs": [ "Actual native share output for the implemented deposit path." ]; "type": "u64"; }, { "name": "deadline"; "type": "i64"; }, { "name": "nonce"; "type": "u64"; }, { "name": "createdAt"; "type": "i64"; }, { "name": "updatedAt"; "type": "i64"; }, { "name": "bump"; "type": "u8"; } ]; }; }, { "name": "crossChainIntentReplayAccepted"; "type": { "kind": "struct"; "fields": [ { "name": "intent"; "type": "pubkey"; }, { "name": "replayKey"; "type": "pubkey"; }, { "name": "status"; "type": "u8"; } ]; }; }, { "name": "crossChainVaultRoute"; "docs": [ "Per-vault BNB route owned directly by the Gamma program." ]; "type": { "kind": "struct"; "fields": [ { "name": "lpVault"; "type": "pubkey"; }, { "name": "assetsMint"; "type": "pubkey"; }, { "name": "sharesMint"; "type": "pubkey"; }, { "name": "shareEscrow"; "type": "pubkey"; }, { "name": "bnbUsdc"; "type": { "array": [ "u8", 20 ]; }; }, { "name": "bnbUsdt"; "type": { "array": [ "u8", 20 ]; }; }, { "name": "depositsEnabled"; "type": "bool"; }, { "name": "withdrawalsEnabled"; "type": "bool"; }, { "name": "escrowedShares"; "docs": [ "Native shares received from dePort but not yet consumed by a bound", "Gamma-withdrawal/DLN-return implementation." ]; "type": "u64"; }, { "name": "bump"; "type": "u8"; } ]; }; }, { "name": "crossChainVaultRouteUpdated"; "type": { "kind": "struct"; "fields": [ { "name": "route"; "type": "pubkey"; }, { "name": "lpVault"; "type": "pubkey"; }, { "name": "depositsEnabled"; "type": "bool"; }, { "name": "withdrawalsEnabled"; "type": "bool"; } ]; }; }, { "name": "crossChainWithdrawalArgs"; "type": { "kind": "struct"; "fields": [ { "name": "beneficiary"; "docs": [ "Authenticated external-call payload and final BNB recipient." ]; "type": { "array": [ "u8", 20 ]; }; }, { "name": "outputToken"; "type": { "array": [ "u8", 20 ]; }; }, { "name": "sharesAmount"; "type": "u64"; }, { "name": "minVaultAssets"; "docs": [ "Minimum six-decimal native Solana vault assets after Gamma fees." ]; "type": "u64"; }, { "name": "minOutputAmountRaw"; "docs": [ "Minimum final BNB output in 18-decimal raw units, fixed-width U256 BE." ]; "type": { "array": [ "u8", 32 ]; }; }, { "name": "deadline"; "type": "i64"; }, { "name": "nonce"; "type": "u64"; } ]; }; }, { "name": "crossChainWithdrawalDeliverySurplus"; "docs": [ "Emitted only when the inbound share wallet held more than the declared", "tranche at withdrawal intake. Gamma escrows exactly the declared tranche and", "leaves the remainder in the provider-owned wallet, so this is the signal that", "something was left behind.", "", "`surplus_shares` is an aggregate balance difference and nothing more, and no", "value of it is safe by inspection. The program cannot tell an unrelated", "transfer into a public token account from the BNB side having delivered more", "than the hook declared, and — because it cannot measure provider delivery at", "all — it also cannot rule out the opposite: an under-delivery masked by an", "unrelated balance, where the declared tranche was escrowed partly out of", "someone else's shares. An unrelated balance is only harmless if full delivery", "independently occurred, which is exactly what Gamma cannot prove.", "Reconciliation must alert on EVERY occurrence and classify it against", "authenticated off-chain delivery evidence.", "", "Equally important: the ABSENCE of this event proves nothing. Emission requires a", "non-zero surplus, so an under-delivery exactly offset by an unrelated balance", "emits nothing at all. This is a \"something was left behind\" signal, never a", "funding-completeness signal.", "", "Recovery of a surplus is unproven: the pinned deBridge SDK exposes no close or", "recovery operation for this wallet, and because intake now succeeds rather than", "failing, whatever the provider would have done on external-call failure is not", "exercised. Any non-zero surplus needs investigation." ]; "type": { "kind": "struct"; "fields": [ { "name": "intent"; "type": "pubkey"; }, { "name": "replayKey"; "type": "pubkey"; }, { "name": "lpVault"; "type": "pubkey"; }, { "name": "inboundShareWallet"; "type": "pubkey"; }, { "name": "declaredShares"; "type": "u64"; }, { "name": "surplusShares"; "type": "u64"; } ]; }; }, { "name": "crossChainWithdrawalEscrowed"; "type": { "kind": "struct"; "fields": [ { "name": "intent"; "type": "pubkey"; }, { "name": "replayKey"; "type": "pubkey"; }, { "name": "lpVault"; "type": "pubkey"; }, { "name": "beneficiary"; "type": { "array": [ "u8", 20 ]; }; }, { "name": "shares"; "type": "u64"; }, { "name": "minVaultAssets"; "docs": [ "Six-decimal native Solana vault-asset floor." ]; "type": "u64"; }, { "name": "minOutputAmountRaw"; "docs": [ "Unsigned U256 big-endian final BNB USDC/USDT floor (18 decimals)." ]; "type": { "array": [ "u8", 32 ]; }; }, { "name": "nonce"; "type": "u64"; } ]; }; }, { "name": "crossChainWithdrawalReturnSent"; "docs": [ "Emitted when the settled Solana USDC has been dispatched to the BNB", "beneficiary through deBridge, completing the withdrawal reverse leg." ]; "type": { "kind": "struct"; "fields": [ { "name": "intent"; "type": "pubkey"; }, { "name": "replayKey"; "type": "pubkey"; }, { "name": "lpVault"; "type": "pubkey"; }, { "name": "nativeSender"; "docs": [ "Gamma-derived signer recorded by deBridge as `nativeSender`." ]; "type": "pubkey"; }, { "name": "beneficiary"; "type": { "array": [ "u8", 20 ]; }; }, { "name": "returnedAssets"; "docs": [ "Six-decimal native Solana USDC dispatched to deBridge." ]; "type": "u64"; }, { "name": "minOutputAmountRaw"; "docs": [ "Authenticated 18-decimal BNB output floor honored by the send." ]; "type": { "array": [ "u8", 32 ]; }; }, { "name": "nonce"; "type": "u64"; } ]; }; }, { "name": "crossChainWithdrawalSettled"; "docs": [ "Emitted when a withdrawal intent's escrowed shares are realized into native", "Solana vault assets at fresh NAV and staged for the BNB return send." ]; "type": { "kind": "struct"; "fields": [ { "name": "intent"; "type": "pubkey"; }, { "name": "replayKey"; "type": "pubkey"; }, { "name": "lpVault"; "type": "pubkey"; }, { "name": "beneficiary"; "type": { "array": [ "u8", 20 ]; }; }, { "name": "maker"; "docs": [ "Authority that received the settled USDC and is the off-chain DLN return", "order maker (the keeper that signed settle)." ]; "type": "pubkey"; }, { "name": "makerAssetAccount"; "docs": [ "The maker's give-ATA the settled USDC landed in: ATA(maker, assets_mint)." ]; "type": "pubkey"; }, { "name": "sharesConsumed"; "type": "u64"; }, { "name": "grossAssets"; "type": "u64"; }, { "name": "feeAssets"; "docs": [ "Base-asset fee retained in the vault for remaining LPs." ]; "type": "u64"; }, { "name": "netAssets"; "docs": [ "Six-decimal native Solana vault assets staged for the return send." ]; "type": "u64"; }, { "name": "feeSharesMinted"; "docs": [ "Prorated performance-fee shares minted to the fee recipient (dilution)." ]; "type": "u64"; } ]; }; }, { "name": "depositPolicy"; "docs": [ "Per-vault deposit controls shared by every deposit source, including", "Solana-native users and cross-chain adapters.", "", "This is intentionally a separate PDA rather than a field on `LpVault` so", "existing vault accounts do not require a layout migration. Existing vaults", "fail closed after the program upgrade until their policy PDA is initialized", "by the fund authority." ]; "type": { "kind": "struct"; "fields": [ { "name": "lpVault"; "docs": [ "Vault this policy belongs to." ]; "type": "pubkey"; }, { "name": "capacityAssets"; "docs": [ "Maximum post-deposit NAV in the vault asset's base units." ]; "type": "u64"; }, { "name": "depositsPaused"; "docs": [ "Emergency switch for deposits. Withdrawals do not consult this field." ]; "type": "bool"; }, { "name": "bump"; "docs": [ "PDA derivation bump." ]; "type": "u8"; } ]; }; }, { "name": "depositPolicyUpdated"; "type": { "kind": "struct"; "fields": [ { "name": "vault"; "type": "pubkey"; }, { "name": "oldCapacityAssets"; "type": "u64"; }, { "name": "newCapacityAssets"; "type": "u64"; }, { "name": "oldDepositsPaused"; "type": "bool"; }, { "name": "newDepositsPaused"; "type": "bool"; }, { "name": "timestamp"; "type": "i64"; } ]; }; }, { "name": "depositReceipt"; "type": { "kind": "struct"; "fields": [ { "name": "bump"; "docs": [ "PDA bump seed." ]; "type": "u8"; } ]; }; }, { "name": "feeConfigUpdated"; "type": { "kind": "struct"; "fields": [ { "name": "vault"; "type": "pubkey"; }, { "name": "oldFeeRecipient"; "type": "pubkey"; }, { "name": "newFeeRecipient"; "type": "pubkey"; }, { "name": "oldFeeBps"; "type": "u16"; }, { "name": "newFeeBps"; "type": "u16"; }, { "name": "assessmentIntervalSecs"; "type": "i64"; } ]; }; }, { "name": "feesAssessed"; "type": { "kind": "struct"; "fields": [ { "name": "vault"; "type": "pubkey"; }, { "name": "profitAssets"; "type": "u64"; }, { "name": "feeAssets"; "type": "u64"; }, { "name": "feeSharesMinted"; "type": "u64"; }, { "name": "newPps"; "type": "u64"; }, { "name": "checkpointPps"; "type": "u64"; }, { "name": "timestamp"; "type": "i64"; } ]; }; }, { "name": "globalConfig"; "type": { "kind": "struct"; "fields": [ { "name": "superAdmin"; "docs": [ "Key with the ability to update the GlobalConfig. Rotatable only via", "`update_admin_authorities` (gated on the program upgrade authority)." ]; "type": "pubkey"; }, { "name": "permissionedCreation"; "docs": [ "When true InitializeLpVault requires create_authority to be a signer" ]; "type": "bool"; }, { "name": "createAuthority"; "docs": [ "The key with authority to call `InitializeLpVault`" ]; "type": "pubkey"; }, { "name": "bump"; "docs": [ "Bump for increased efficiency." ]; "type": "u8"; } ]; }; }, { "name": "lpVault"; "type": { "kind": "struct"; "fields": [ { "name": "assetsAccount"; "docs": [ "USDC TokenAccount where users deposit, funds agent operations." ]; "type": "pubkey"; }, { "name": "pendingSharesAccount"; "docs": [ "TokenAccount where shares are held during queued (illiquid) withdrawals." ]; "type": "pubkey"; }, { "name": "sharesMint"; "docs": [ "Derived mint (created on initialize) that represents LP tokens or shares." ]; "type": "pubkey"; }, { "name": "assetsMint"; "docs": [ "Mint corresponding to the asset, most of the time USDC." ]; "type": "pubkey"; }, { "name": "fundAuthority"; "docs": [ "Pubkey authorized to withdraw assets from assets_account and update NAV." ]; "type": "pubkey"; }, { "name": "nav"; "docs": [ "Current Net Asset Value (total vault value in asset decimals)." ]; "type": "u64"; }, { "name": "totalShares"; "docs": [ "Total shares outstanding (cached for efficiency). May temporarily diverge", "from shares_mint.supply during the escrow withdrawal flow (between", "fulfill_withdrawal and complete_withdrawal)." ]; "type": "u64"; }, { "name": "navUpdatedAt"; "docs": [ "Timestamp for when NAV was last updated." ]; "type": "i64"; }, { "name": "navMaxStaleness"; "docs": [ "Maximum NAV staleness for user operations (in seconds).", "Deposits and withdrawals fail if NAV is older than this." ]; "type": "u64"; }, { "name": "bump"; "docs": [ "PDA derivation bump, stored for CU saving purposes." ]; "type": "u8"; }, { "name": "vaultName"; "type": "string"; }, { "name": "pendingWithdrawalValue"; "docs": [ "Total value of pending withdrawals awaiting liquidity.", "When a withdrawal cannot be fulfilled instantly due to insufficient", "liquid assets, the value is tracked here. This is approximate — the", "value recorded at withdrawal time may differ from the value at", "fulfillment time (recomputed at current NAV). Used for operator", "visibility only, not for critical calculations." ]; "type": "u64"; }, { "name": "feeRecipient"; "docs": [ "Shares token account that receives fee shares. Pubkey::default() = disabled." ]; "type": "pubkey"; }, { "name": "performanceFeeBps"; "docs": [ "Performance fee rate in basis points (2000 = 20%). 0 = disabled." ]; "type": "u16"; }, { "name": "assessmentIntervalSecs"; "docs": [ "How often scheduled fees are assessed (seconds). E.g., 86400 = 24h." ]; "type": "i64"; }, { "name": "lastAssessmentTimestamp"; "docs": [ "Unix timestamp of last fee event (scheduled or withdrawal-triggered)." ]; "type": "i64"; }, { "name": "pricePerShareAtLastAssessment"; "docs": [ "PPS at last fee event, scaled by PRICE_SCALE. High-water mark for fees." ]; "type": "u64"; }, { "name": "keeperAuthority"; "docs": [ "Optional keeper authority. When set (non-default), this key can call", "fulfill_withdrawal in addition to fund_authority. Allows the keeper", "process to use a separate key from the agent/fund_authority.", "Pubkey::default() = not set (only fund_authority can fulfill)." ]; "type": "pubkey"; } ]; }; }, { "name": "navEmergencyOverrideApplied"; "type": { "kind": "struct"; "fields": [ { "name": "vault"; "type": "pubkey"; }, { "name": "fundAuthority"; "type": "pubkey"; }, { "name": "superAdmin"; "type": "pubkey"; }, { "name": "oldNav"; "type": "u64"; }, { "name": "newNav"; "type": "u64"; }, { "name": "oldPricePerShare"; "type": "u64"; }, { "name": "newPricePerShare"; "type": "u64"; }, { "name": "timestamp"; "type": "i64"; } ]; }; }, { "name": "navUpdatePolicy"; "type": { "kind": "struct"; "fields": [ { "name": "lpVault"; "docs": [ "Vault whose checked NAV publications this policy constrains." ]; "type": "pubkey"; }, { "name": "windowStartedAt"; "docs": [ "Chain timestamp at which the current fixed window began." ]; "type": "i64"; }, { "name": "anchorPricePerShare"; "docs": [ "Window-start share price, scaled by PRICE_SCALE." ]; "type": "u64"; }, { "name": "bump"; "docs": [ "PDA derivation bump." ]; "type": "u8"; } ]; }; }, { "name": "navUpdatePolicyInitialized"; "type": { "kind": "struct"; "fields": [ { "name": "vault"; "type": "pubkey"; }, { "name": "anchorPricePerShare"; "type": "u64"; }, { "name": "windowStartedAt"; "type": "i64"; } ]; }; }, { "name": "navUpdateWindowApplied"; "type": { "kind": "struct"; "fields": [ { "name": "vault"; "type": "pubkey"; }, { "name": "oldNav"; "type": "u64"; }, { "name": "newNav"; "type": "u64"; }, { "name": "anchorPricePerShare"; "type": "u64"; }, { "name": "newPricePerShare"; "type": "u64"; }, { "name": "windowStartedAt"; "type": "i64"; }, { "name": "windowReset"; "type": "bool"; }, { "name": "timestamp"; "type": "i64"; } ]; }; }, { "name": "withdrawEscrow"; "docs": [ "Escrow account that holds assets and shares for a pending withdrawal.", "Each user has one escrow per vault, derived as PDA from [WITHDRAW_ESCROW_SEED, user, vault]." ]; "type": { "kind": "struct"; "fields": [ { "name": "user"; "docs": [ "User who owns this escrow." ]; "type": "pubkey"; }, { "name": "lpVault"; "docs": [ "The vault this escrow is associated with." ]; "type": "pubkey"; }, { "name": "escrowAssetsAccount"; "docs": [ "Token account holding escrowed assets (USDC)." ]; "type": "pubkey"; }, { "name": "escrowSharesAccount"; "docs": [ "Token account holding escrowed shares (for burning on claim)." ]; "type": "pubkey"; }, { "name": "bump"; "docs": [ "PDA derivation bump." ]; "type": "u8"; } ]; }; }, { "name": "withdrawReceipt"; "type": { "kind": "struct"; "fields": [ { "name": "user"; "docs": [ "User requesting withdrawal." ]; "type": "pubkey"; }, { "name": "lpVault"; "docs": [ "Vault where the user has invested." ]; "type": "pubkey"; }, { "name": "pendingShares"; "docs": [ "Shares waiting for liquidity (keeper needs to fulfill these).", "These shares are held in the escrow_shares_account." ]; "type": "u64"; }, { "name": "claimableShares"; "docs": [ "Shares that have been fulfilled and are ready to claim.", "These shares are also in escrow_shares_account, waiting to be burned on claim." ]; "type": "u64"; }, { "name": "claimableAssets"; "docs": [ "Asset value ready to claim (held in escrow_assets_account)." ]; "type": "u64"; }, { "name": "oldestPendingAt"; "docs": [ "NAV ordering floor for the whole `pending_shares` aggregate, re-derived on", "the MOST RECENT addition.", "", "Despite the name and the `i64` type this is NOT a wall-clock timestamp of", "the addition: it stores `observed_nav_updated_at + 1`, i.e. one past the", "NAV version in force when that addition was queued. It shares the", "`nav_updated_at` number space, which is why the existing `>=` comparisons", "in the program and the keeper keep working unchanged.", "", "`fulfill_withdrawal` prices all of `pending_shares` at once and requires", "`nav_updated_at >= oldest_pending_at`, so this must track the newest", "request, not the first: a first-request-only stamp lets every subsequent", "addition settle against a NAV that predates it.", "", "NOTE: the field name is retained for wire/IDL compatibility — the keeper", "reads it by name and orders fulfilment on it. Renaming it to", "`newest_pending_at` is a follow-up that must land with a keeper change.", "", "The floor is derived from the NAV VERSION the request observed —", "`lp_vault.nav_updated_at + 1` — not from the wall clock. Combined with", "fulfilment's `nav_updated_at >= oldest_pending_at`, that requires a NAV", "write STRICTLY NEWER than the one in force when the request was queued.", "", "KNOWN RESIDUAL — a newer VERSION does not prove a later VALUATION. An", "`update_nav_checked` prepared BEFORE the request can still land after it:", "its compare-and-set covers only `(nav, total_shares, nav_updated_at)`, and", "a fee-free illiquid queue changes none of them. `apply_illiquid_withdrawal`", "adds only `fee_shares` (zero here) to `total_shares` and moves", "`pending_withdrawal_value`, which is NOT part of the CAS tuple — the", "cross-chain path passes `fee_shares = 0` explicitly. So the prepared", "update still validates, advances the timestamp past the floor, and", "fulfilment settles against a valuation computed before the request.", "", "Two writers, two different bounds:", "", "- `update_nav_checked` — bounded by the publisher's prepare-to-publish", "interval (`NAV_PUBLISH_INTENT_MAX_AGE_MS`, 120s in gamma-vault-agents),", "because a prepared intent older than that is discarded client-side.", "- `update_nav` (legacy, `handler`) — **UNBOUNDED**. It validates no", "expected state and carries no age limit, so a valuation computed", "arbitrarily long before the request can be published at any later time", "and will advance `nav_updated_at` past the floor.", "", "This residual is still reachable WITHOUT any privileged actor: a holder", "only has to queue between an honest publisher's prepare and its publish.", "No compromised key and no operator error is required — only timing inside", "that window. What the `+1` narrows is the SIZE of the window (from \"any", "NAV after the first request on the receipt\" to \"the publisher's in-flight", "interval\"), not the privilege needed to hit it.", "", "The legacy entrypoint is already slated for removal (gamma-vault-agents", "calls only `update_nav_checked`, with no fallback, and the legacy client", "helper has no callers). Deleting it closes the unbounded half of this", "residual and should be sequenced with removing the web-server's", "`/gamma/update-vault-nav` route.", "", "Either way this is strictly narrower than the pre-fix behaviour, which", "accepted any NAV after the FIRST request on the receipt.", "", "Closing it requires the queue to invalidate in-flight NAV writes — i.e.", "extending the CAS tuple with `pending_withdrawal_value` (or a receipt", "version). That changes `update_nav_checked`'s signature, so it is a", "coordinated program + IDL + agent + web-server change and an on-chain", "upgrade; the agent calls `update_nav_checked` with no fallback, so a", "required new argument breaks it against the deployed program until all", "four ship together. Deliberately not bundled here.", "", "This needs no new state and no change to either comparison:", "`next_nav_updated_at` already guarantees `nav_updated_at` strictly", "increases on every NAV write (`max(clock_now, previous + 1)`), so", "`observed + 1` is always reachable by the next write. It proves only that", "the version ALREADY OBSERVED cannot settle the request — a stale", "valuation that becomes the next write still passes, which is exactly the", "residual above. The keeper's mirrored `>=` check keeps working unchanged.", "", "A wall-clock floor left a same-second hole: `Clock::unix_timestamp` is", "second-resolution and the comparison is `>=`, so a NAV published earlier", "in the same second as the request compared equal and passed.", "", "UPGRADE GATE — receipts already pending at the upgrade carry a LEGACY", "floor. Accounts survive a program upgrade, and nothing re-stamps a", "receipt until its next `withdraw`, so a receipt queued under the previous", "release keeps a wall-clock, first-request-only value that", "`fulfill_withdrawal` still accepts. Concretely: 1 share queued at T0,", "NAV published at T1, an unrecorded loss, then 1,000,000 shares added —", "all pre-upgrade — leaves the receipt at T0, and post-upgrade fulfilment", "accepts the stale T1 NAV.", "", "Publishing a fresh NAV after the upgrade does NOT fix this: any NAV after", "T0 satisfies a T0 floor, which is the whole defect. The gate is therefore", "to DRAIN pending receipts before the upgrade, so no legacy floor survives", "it.", "", "A scan alone is NOT sufficient: `withdraw` intake is permissionless, so a", "user can create a fresh legacy-floor receipt between the scan and the", "upgrade, and no off-chain maintenance mode can stop a direct transaction.", "", "There is no withdrawal pause flag for the native path — `withdrawals_enabled`", "gates only the cross-chain intake, and zeroing the `WithdrawalPolicy` caps", "REMOVES the limits rather than applying them. The one enforceable on-chain", "lever is NAV staleness: `withdraw` begins with `require_fresh_nav`, so once", "NAV ages past `nav_max_staleness` every new intake reverts with `StaleNav`.", "`fulfill_withdrawal` requires fresh NAV too, so draining must finish first:", "", "1. drain — fulfil until `pending_shares == 0` on EVERY receipt, with NAV", "still being published. \"Every receipt\" means an on-chain", "`getProgramAccounts` scan for `WithdrawReceipt` filtered by", "`lp_vault`; the off-chain `gamma_pending_withdrawals` table is NOT a", "valid inventory — it tracks only agent-managed parent-to-child Gamma", "withdrawals for dedup and NAV enumeration, and omits ordinary user", "and cross-chain receipts entirely;", "2. stop publishing NAV and wait out `nav_max_staleness` (1800s on prod", "STBL1). New `withdraw` calls now revert on-chain, not by convention;", "3. RE-CHECK that every receipt is still at zero — nothing can have been", "added during step 2;", "4. upgrade;", "5. resume NAV publication, which re-opens intake.", "", "No production pre-verification is claimed here: the scan in step 1 has not", "been run, and the agent-side table cannot stand in for it. Steps 2 and 3", "are required regardless, because the count can otherwise change under you." ]; "type": "i64"; }, { "name": "bump"; "docs": [ "PDA derivation bump, stored for CU saving purposes." ]; "type": "u8"; } ]; }; }, { "name": "withdrawalFeeRetained"; "type": { "kind": "struct"; "fields": [ { "name": "vault"; "type": "pubkey"; }, { "name": "user"; "type": "pubkey"; }, { "name": "grossAssets"; "type": "u64"; }, { "name": "feeAssets"; "type": "u64"; }, { "name": "netAssets"; "type": "u64"; }, { "name": "withdrawalFeeBps"; "type": "u16"; }, { "name": "timestamp"; "type": "i64"; } ]; }; }, { "name": "withdrawalFeesSettled"; "type": { "kind": "struct"; "fields": [ { "name": "vault"; "type": "pubkey"; }, { "name": "user"; "type": "pubkey"; }, { "name": "sharesWithdrawn"; "type": "u64"; }, { "name": "assetValue"; "type": "u64"; }, { "name": "feeSharesMinted"; "type": "u64"; }, { "name": "prorationElapsed"; "type": "i64"; }, { "name": "prorationInterval"; "type": "i64"; }, { "name": "ppsAfterFees"; "type": "u64"; } ]; }; }, { "name": "withdrawalPolicy"; "type": { "kind": "struct"; "fields": [ { "name": "lpVault"; "docs": [ "Vault this policy belongs to." ]; "type": "pubkey"; }, { "name": "withdrawalFeeBps"; "docs": [ "Base-asset fee retained in the vault on withdrawal. 30 = 0.30%." ]; "type": "u16"; }, { "name": "hourlyWithdrawalCapBps"; "docs": [ "Max net withdrawal accepted per hour as bps of current NAV. 0 = disabled." ]; "type": "u16"; }, { "name": "dailyWithdrawalCapBps"; "docs": [ "Max net withdrawal accepted per day as bps of current NAV. 0 = disabled." ]; "type": "u16"; }, { "name": "hourlyWithdrawnAssets"; "docs": [ "Net withdrawn assets counted in the current hourly window." ]; "type": "u64"; }, { "name": "dailyWithdrawnAssets"; "docs": [ "Net withdrawn assets counted in the current daily window." ]; "type": "u64"; }, { "name": "hourlyWindowStart"; "docs": [ "Start timestamp for the current hourly cap window." ]; "type": "i64"; }, { "name": "dailyWindowStart"; "docs": [ "Start timestamp for the current daily cap window." ]; "type": "i64"; }, { "name": "bump"; "docs": [ "PDA derivation bump." ]; "type": "u8"; } ]; }; }, { "name": "withdrawalPolicyUpdated"; "type": { "kind": "struct"; "fields": [ { "name": "vault"; "type": "pubkey"; }, { "name": "withdrawalFeeBps"; "type": "u16"; }, { "name": "hourlyWithdrawalCapBps"; "type": "u16"; }, { "name": "dailyWithdrawalCapBps"; "type": "u16"; }, { "name": "timestamp"; "type": "i64"; } ]; }; } ]; }; declare const GAMMA_VAULT_IDL: GammaVault; type GammaVaultIdlType = GammaVault; /** * Derive the WithdrawalPolicy PDA for a vault. * Seeds: ["withdrawal_policy", lpVault] */ declare function deriveGammaWithdrawalPolicy(lpVault: PublicKey, programId?: PublicKey): [PublicKey, number]; /** * Derive the DepositPolicy PDA for a vault. * Seeds: ["deposit_policy", lpVault] */ declare function deriveGammaDepositPolicy(lpVault: PublicKey, programId?: PublicKey): [PublicKey, number]; /** * Derive the per-user DepositReceipt PDA for a vault. * Seeds: ["deposit_receipt", user, lpVault] */ declare function deriveGammaDepositReceipt(user: PublicKey, lpVault: PublicKey, programId?: PublicKey): [PublicKey, number]; /** * Derive the per-user WithdrawEscrow PDA for a vault. * Seeds: ["withdraw_escrow", user, lpVault] */ declare function deriveGammaWithdrawEscrow(user: PublicKey, lpVault: PublicKey, programId?: PublicKey): [PublicKey, number]; /** * Derive the per-user WithdrawReceipt PDA for a vault. * Seeds: ["withdraw_receipt", user, lpVault] */ declare function deriveGammaWithdrawReceipt(user: PublicKey, lpVault: PublicKey, programId?: PublicKey): [PublicKey, number]; /** * Associated token account derivation matching the Gamma program's ATA seeds * (`[owner, tokenProgram, mint]`). `allowOwnerOffCurve` is enabled since owners * are frequently PDAs (escrow, fee recipient). */ declare function deriveGammaAta(mint: PublicKey, owner: PublicKey, tokenProgram?: PublicKey): PublicKey; /** Decode a Gamma `LpVault` account from raw buffer data. */ declare function decodeGammaLpVaultData(data: Buffer, pubkey: PublicKey): GammaLpVaultRaw; /** Decode a Gamma `WithdrawReceipt` account from raw buffer data. */ declare function decodeGammaWithdrawReceiptData(data: Buffer, pubkey: PublicKey): GammaWithdrawReceiptRaw; interface GammaDepositAccounts { user: PublicKey; lpVault: PublicKey; withdrawalPolicy: PublicKey; depositPolicy: PublicKey; assetsAccount: PublicKey; userAssetAta: PublicKey; userShareAta: PublicKey; depositReceipt: PublicKey; assetsMint: PublicKey; sharesMint: PublicKey; tokenProgram?: PublicKey; associatedTokenProgram?: PublicKey; } /** * Deposit `amount` (raw base units of the vault's asset mint) into a Gamma LP * vault. Instant deposit: user receives vault shares in the same transaction. * The program creates `user_share_ata` and `deposit_receipt` if needed. */ declare function makeGammaDepositIx(accounts: GammaDepositAccounts, amount: BN): TransactionInstruction; interface GammaWithdrawAccounts { user: PublicKey; lpVault: PublicKey; withdrawalPolicy: PublicKey; depositPolicy: PublicKey; assetsAccount: PublicKey; userShareAta: PublicKey; assetsMint: PublicKey; sharesMint: PublicKey; feeRecipientAccount: PublicKey; withdrawEscrow: PublicKey; escrowAssetsAccount: PublicKey; escrowSharesAccount: PublicKey; withdrawReceipt: PublicKey; tokenProgram?: PublicKey; associatedTokenProgram?: PublicKey; } /** * Initiate a withdrawal of `sharesAmount` (raw base units of the vault's share * mint) from a Gamma LP vault. Shares are escrowed and a WithdrawReceipt is * created/updated; assets become claimable via {@link makeGammaCompleteWithdrawalIx} * once the withdrawal is fulfilled by a keeper. */ declare function makeGammaWithdrawIx(accounts: GammaWithdrawAccounts, sharesAmount: BN): TransactionInstruction; interface GammaCompleteWithdrawalAccounts { user: PublicKey; lpVault: PublicKey; assetsMint: PublicKey; sharesMint: PublicKey; userAssetAta: PublicKey; withdrawEscrow: PublicKey; escrowAssetsAccount: PublicKey; escrowSharesAccount: PublicKey; withdrawReceipt: PublicKey; tokenProgram?: PublicKey; associatedTokenProgram?: PublicKey; } /** * Claim the assets from a fulfilled Gamma withdrawal. Transfers the claimable * assets from the escrow to the user's asset ATA (created if needed). */ declare function makeGammaCompleteWithdrawalIx(accounts: GammaCompleteWithdrawalAccounts): TransactionInstruction; /** Number of slots that can pass before a publisher's price is no longer included in the aggregate. */ declare const MAX_SLOT_DIFFERENCE = 25; interface Price { priceComponent: bigint; price: number; confidenceComponent: bigint; confidence: number; status: PriceStatus; corporateAction: CorpAction; publishSlot: number; } declare enum PriceStatus { Unknown = 0, Trading = 1, Halted = 2, Auction = 3, Ignored = 4 } declare enum CorpAction { NoCorpAct = 0 } interface PriceData extends Base { priceType: PriceType; exponent: number; numComponentPrices: number; numQuoters: number; lastSlot: bigint; validSlot: bigint; emaPrice: Ema; emaConfidence: Ema; timestamp: bigint; minPublishers: number; drv2: number; drv3: number; drv4: number; productAccountKey: PublicKey; nextPriceAccountKey: PublicKey | null; previousSlot: bigint; previousPriceComponent: bigint; previousPrice: number; previousConfidenceComponent: bigint; previousConfidence: number; previousTimestamp: bigint; priceComponents: PriceComponent[]; aggregate: Price; price: number | undefined; confidence: number | undefined; status: PriceStatus; } interface Base { magic: number; version: number; type: AccountType; size: number; } declare enum AccountType { Unknown = 0, Mapping = 1, Product = 2, Price = 3, Test = 4, Permission = 5 } declare enum PriceType { Unknown = 0, Price = 1 } /** * valueComponent = numerator / denominator * value = valueComponent * 10 ^ exponent (from PriceData) */ interface Ema { valueComponent: bigint; value: number; numerator: bigint; denominator: bigint; } interface PriceComponent { publisher: PublicKey; aggregate: Price; latest: Price; } declare const parsePriceData: (data: Buffer, currentSlot?: number) => PriceData; type PriceUpdateV2 = { writeAuthority: Buffer; verificationLevel: number; priceMessage: { feedId: Buffer; price: bigint; conf: bigint; exponent: number; publishTime: bigint; prevPublishTime: bigint; emaPrice: bigint; emaConf: bigint; }; }; declare const parsePriceInfo: (data: Buffer) => PriceUpdateV2; declare const SinglePoolInstruction: { initializePool: (voteAccount: PublicKey) => TransactionInstruction; initializeOnRamp: (pool: PublicKey) => TransactionInstruction; depositStake: (pool: PublicKey, userStakeAccount: PublicKey, userTokenAccount: PublicKey, userLamportAccount: PublicKey) => Promise; withdrawStake: (pool: PublicKey, userStakeAccount: PublicKey, userStakeAuthority: PublicKey, userTokenAccount: PublicKey, tokenAmount: BigNumber$1) => Promise; createTokenMetadata: (pool: PublicKey, payer: PublicKey) => Promise; updateTokenMetadata: (voteAccount: PublicKey, authorizedWithdrawer: PublicKey, tokenName: string, tokenSymbol: string, tokenUri?: string) => Promise; }; declare const findPoolMintAddressByVoteAccount: (voteAccountAddress: PublicKey) => PublicKey; declare const findPoolAddress: (voteAccountAddress: PublicKey) => PublicKey; declare const findPoolMintAddress: (poolAddress: PublicKey) => PublicKey; declare const findPoolStakeAddress: (poolAddress: PublicKey) => PublicKey; declare const findPoolStakeAuthorityAddress: (poolAddress: PublicKey) => PublicKey; declare const findPoolMintAuthorityAddress: (poolAddress: PublicKey) => PublicKey; declare const findPoolMplAuthorityAddress: (poolAddress: PublicKey) => PublicKey; declare const findPoolOnRampAddress: (poolAddress: PublicKey) => PublicKey; declare const findMplMetadataAddress: (poolMintAddress: PublicKey) => Promise; declare function initializeStakedPoolTx(connection: Connection, payer: PublicKey, voteAccountAddress: PublicKey): Promise; declare function initializeStakedPoolIxs(connection: Connection, payer: PublicKey, voteAccountAddress: PublicKey): Promise; declare const createAccountIx: (from: PublicKey, newAccount: PublicKey, lamports: number, space: number, programAddress: PublicKey) => TransactionInstruction; declare const createPoolOnrampIx: (voteAccount: PublicKey) => TransactionInstruction; declare const replenishPoolIx: (voteAccount: PublicKey) => TransactionInstruction; /** * Parsed content of an on-chain StakeAccount * * Copied from https://github.com/solana-developers/solana-rpc-get-stake-activation/blob/main/web3js-1.0/src/stake.ts * */ type StakeAccount = { discriminant: bigint; meta: { rentExemptReserve: bigint; authorized: { staker: PublicKey; withdrawer: PublicKey; }; lockup: { unixTimestamp: bigint; epoch: bigint; custodian: PublicKey; }; }; stake: { delegation: { voterPubkey: PublicKey; stake: bigint; activationEpoch: bigint; deactivationEpoch: bigint; }; creditsObserved: bigint; }; }; /** * Decode a StakeAccount from parsed account data. * * Copied from https://github.com/solana-developers/solana-rpc-get-stake-activation/blob/main/web3js-1.0/src/stake.ts * */ declare const getStakeAccount: (data: Buffer$1) => StakeAccount; declare const SCOPE_PROGRAM_ID: PublicKey; declare const SCOPE_ORACLE_PRICES_DISCRIMINATOR: Buffer; declare const SCOPE_MAX_ENTRIES = 512; declare const SCOPE_ORACLE_PRICES_SIZE: number; interface ScopeDatedPrice { /** Decimal price, i.e. `value / 10^exp` */ price: BigNumber$1; lastUpdatedSlot: number; unixTimestamp: number; } /** * Decodes one `DatedPrice` entry out of a Scope `OraclePrices` account. * DatedPrice layout: price.value u64, price.exp u64, last_updated_slot u64, unix_timestamp u64, * generic_data [u8; 24]. */ declare function decodeScopePriceAtIndex(data: Buffer, entryIndex: number): ScopeDatedPrice; declare const MARINADE_PROGRAM_ID: PublicKey; declare const MARINADE_STATE_DISCRIMINATOR: Buffer; declare const MARINADE_STATE_MIN_SIZE: number; interface MarinadeState { /** mSOL/SOL exchange rate */ msolPrice: BigNumber$1; } declare function decodeMarinadeState(data: Buffer): MarinadeState; declare const SPL_STAKE_POOL_PROGRAM_ID: PublicKey; declare const SANCTUM_SPL_STAKE_POOL_PROGRAM_ID: PublicKey; declare const SANCTUM_SPL_MULTI_STAKE_POOL_PROGRAM_ID: PublicKey; interface StakePool { totalLamports: bigint; poolTokenSupply: bigint; lastUpdateEpoch: number; /** LST/SOL exchange rate, i.e. `total_lamports / pool_token_supply` */ exchangeRate: BigNumber$1; } declare function decodeStakePool(data: Buffer): StakePool; /** Information about a token account */ interface Account { /** Address of the account */ address: PublicKey; /** Mint associated with the account */ mint: PublicKey; /** Owner of the account */ owner: PublicKey; /** Number of tokens the account holds */ amount: bigint; /** Authority that can transfer tokens from the account */ delegate: PublicKey | null; /** Number of tokens the delegate is authorized to transfer */ delegatedAmount: bigint; /** True if the account is initialized */ isInitialized: boolean; /** True if the account is frozen */ isFrozen: boolean; /** True if the account is a native token account */ isNative: boolean; /** * If the account is a native token account, it must be rent-exempt. The rent-exempt reserve is the amount that must * remain in the balance until the account is closed. */ rentExemptReserve: bigint | null; /** Optional authority to close the account */ closeAuthority: PublicKey | null; tlvData: Buffer; } /** Token account state as stored by the program */ declare enum AccountState { Uninitialized = 0, Initialized = 1, Frozen = 2 } /** Token account as stored by the program */ interface RawAccount { mint: PublicKey; owner: PublicKey; amount: bigint; delegateOption: 1 | 0; delegate: PublicKey; state: AccountState; isNativeOption: 1 | 0; isNative: bigint; delegatedAmount: bigint; closeAuthorityOption: 1 | 0; closeAuthority: PublicKey; } /** Information about a multisig */ interface Multisig { /** Address of the multisig */ address: PublicKey; /** Number of signers required */ m: number; /** Number of possible signers, corresponds to the number of `signers` that are valid */ n: number; /** Is this mint initialized */ isInitialized: boolean; /** Full set of signers, of which `n` are valid */ signer1: PublicKey; signer2: PublicKey; signer3: PublicKey; signer4: PublicKey; signer5: PublicKey; signer6: PublicKey; signer7: PublicKey; signer8: PublicKey; signer9: PublicKey; signer10: PublicKey; signer11: PublicKey; } interface Mint { /** Address of the mint */ address: PublicKey; /** * Optional authority used to mint new tokens. The mint authority may only be provided during mint creation. * If no mint authority is present then the mint has a fixed supply and no further tokens may be minted. */ mintAuthority: PublicKey | null; /** Total supply of tokens */ supply: bigint; /** Number of base 10 digits to the right of the decimal place */ decimals: number; /** Is this mint initialized */ isInitialized: boolean; /** Optional authority to freeze token accounts */ freezeAuthority: PublicKey | null; } /** Mint as stored by the program */ interface RawMint { mintAuthorityOption: 1 | 0; mintAuthority: PublicKey; supply: bigint; decimals: number; isInitialized: boolean; freezeAuthorityOption: 1 | 0; freezeAuthority: PublicKey; } declare enum SplAccountType { Uninitialized = 0, Mint = 1, Account = 2 } declare const ACCOUNT_TYPE_SIZE = 1; /** Buffer layout for de/serializing a token account */ declare const AccountLayout: _solana_buffer_layout.Structure; /** Byte length of a token account */ declare const ACCOUNT_SIZE: number; declare const NATIVE_MINT: PublicKey; /** * Retrieve information about a token account * * @param connection Connection to use * @param address Token account * @param commitment Desired level of commitment for querying the state * @param programId SPL Token program account * * @return Token account information */ declare function getAccount(connection: Connection, address: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise; /** * Retrieve information about multiple token accounts in a single RPC call * * @param connection Connection to use * @param addresses Token accounts * @param commitment Desired level of commitment for querying the state * @param programId SPL Token program account * * @return Token account information */ declare function getMultipleAccounts(connection: Connection, addresses: PublicKey[], commitment?: Commitment, programId?: PublicKey): Promise; /** Get the minimum lamport balance for a base token account to be rent exempt * * @param connection Connection to use * @param commitment Desired level of commitment for querying the state * * @return Amount of lamports required */ declare function getMinimumBalanceForRentExemptAccount(connection: Connection, commitment?: Commitment): Promise; declare enum ExtensionType { Uninitialized = 0, TransferFeeConfig = 1, TransferFeeAmount = 2, MintCloseAuthority = 3, ConfidentialTransferMint = 4, ConfidentialTransferAccount = 5, DefaultAccountState = 6, ImmutableOwner = 7, MemoTransfer = 8, NonTransferable = 9, InterestBearingMint = 10 } declare function getAccountLen(extensionTypes: ExtensionType[]): number; declare const TYPE_SIZE = 2; declare const LENGTH_SIZE = 2; /** Get the minimum lamport balance for a rent-exempt token account with extensions * * @param connection Connection to use * @param extensions * @param commitment Desired level of commitment for querying the state * * @return Amount of lamports required */ declare function getMinimumBalanceForRentExemptAccountWithExtensions(connection: Connection, extensions: ExtensionType[], commitment?: Commitment): Promise; /** * Unpack a token account * * @param address Token account * @param info Token account data * @param programId SPL Token program account * * @return Unpacked token account */ declare function unpackAccount(address: PublicKey, info: AccountInfo | null, programId?: PublicKey): Account; /** * Get the address of the associated token account for a given mint and owner * * @param mint Token mint account * @param owner Owner of the new account * @param allowOwnerOffCurve Allow the owner account to be a PDA (Program Derived Address) * @param programId SPL Token program account * @param associatedTokenProgramId SPL Associated Token program account * * @return Address of the associated token account */ declare function getAssociatedTokenAddressSync(mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, programId?: PublicKey, associatedTokenProgramId?: PublicKey): PublicKey; /** @internal */ declare function addSigners(keys: AccountMeta$1[], ownerOrAuthority: PublicKey, multiSigners: Signer[]): AccountMeta$1[]; /** Buffer layout for de/serializing a mint */ declare const MintLayout: _solana_buffer_layout.Structure; /** Byte length of a mint */ declare const MINT_SIZE: number; /** * Retrieve information about a mint * * @param connection Connection to use * @param address Mint account * @param commitment Desired level of commitment for querying the state * @param programId SPL Token program account * * @return Mint information */ declare function getMint(connection: Connection, address: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise; /** Multisig as stored by the program */ type RawMultisig = Omit; /** Buffer layout for de/serializing a multisig */ declare const MultisigLayout: _solana_buffer_layout.Structure; /** Byte length of a multisig */ declare const MULTISIG_SIZE: number; declare const MEMO_PROGRAM_ID: PublicKey; /** Address of the SPL Associated Token Account program */ declare const ASSOCIATED_TOKEN_PROGRAM_ID: PublicKey; declare const TOKEN_PROGRAM_ID: PublicKey; declare const TOKEN_2022_PROGRAM_ID: PublicKey; /** Base class for errors */ declare abstract class TokenError extends Error { constructor(message?: string); } /** Thrown if an account is not found at the expected address */ declare class TokenAccountNotFoundError extends TokenError { name: string; } /** Thrown if a program state account is not a valid Account */ declare class TokenInvalidAccountError extends TokenError { name: string; } /** Thrown if a program state account is not owned by the expected token program */ declare class TokenInvalidAccountOwnerError extends TokenError { name: string; } /** Thrown if the byte length of an program state account doesn't match the expected size */ declare class TokenInvalidAccountSizeError extends TokenError { name: string; } /** Thrown if the mint of a token account doesn't match the expected mint */ declare class TokenInvalidMintError extends TokenError { name: string; } /** Thrown if the owner of a token account doesn't match the expected owner */ declare class TokenInvalidOwnerError extends TokenError { name: string; } /** Thrown if the owner of a token account is a PDA (Program Derived Address) */ declare class TokenOwnerOffCurveError extends TokenError { name: string; } /** Thrown if an instruction's program is invalid */ declare class TokenInvalidInstructionProgramError extends TokenError { name: string; } /** Thrown if an instruction's keys are invalid */ declare class TokenInvalidInstructionKeysError extends TokenError { name: string; } /** Thrown if an instruction's data is invalid */ declare class TokenInvalidInstructionDataError extends TokenError { name: string; } /** Thrown if an instruction's type is invalid */ declare class TokenInvalidInstructionTypeError extends TokenError { name: string; } /** Thrown if the program does not support the desired instruction */ declare class TokenUnsupportedInstructionError extends TokenError { name: string; } /** * Creates and returns an instruction which validates a string of UTF-8 * encoded characters and verifies that any accounts provided are signers of * the transaction. The program also logs the memo, as well as any verified * signer addresses, to the transaction log, so that anyone can easily observe * memos and know they were approved by zero or more addresses by inspecting * the transaction log from a trusted provider. * * Public keys passed in via the signerPubkeys will identify Signers which * must subsequently sign the Transaction including the returned * TransactionInstruction in order for the transaction to be valid. * * @param memo The UTF-8 encoded memo string to validate * @param signerPubkeys An array of public keys which must sign the * Transaction including the returned TransactionInstruction in order * for the transaction to be valid and the memo verification to * succeed. null is allowed if there are no signers for the memo * verification. **/ declare function createMemoInstruction(memo: string, signerPubkeys?: Array): TransactionInstruction; /** Instructions defined by the program */ declare enum TokenInstruction { Approve = 4, InitializeAccount = 1, TransferChecked = 12, CloseAccount = 9, SyncNative = 17 } /** TODO: docs */ interface ApproveInstructionData { instruction: TokenInstruction.Approve; amount: bigint; } declare const approveInstructionData: _solana_buffer_layout.Structure; /** * Construct an Approve instruction * * @param account Account to set the delegate for * @param delegate Account authorized to transfer tokens from the account * @param owner Owner of the account * @param amount Maximum number of tokens the delegate may transfer * @param multiSigners Signing accounts if `owner` is a multisig * @param programId SPL Token program account * * @return Instruction to add to a transaction */ declare function createApproveInstruction(account: PublicKey, delegate: PublicKey, owner: PublicKey, amount: number | bigint, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction; /** TODO: docs */ interface InitializeAccountInstructionData { instruction: TokenInstruction.InitializeAccount; } declare const initializeAccountInstructionData: _solana_buffer_layout.Structure; /** * Construct an InitializeAccount instruction * * @param account New token account * @param mint Mint account * @param owner Owner of the new account * @param programId SPL Token program account * * @return Instruction to add to a transaction */ declare function createInitializeAccountInstruction(account: PublicKey, mint: PublicKey, owner: PublicKey, programId?: PublicKey): TransactionInstruction; /** * Construct an AssociatedTokenAccount instruction * * @param payer Payer of the initialization fees * @param associatedToken New associated token account * @param owner Owner of the new account * @param mint Token mint account * @param programId SPL Token program account * @param associatedTokenProgramId SPL Associated Token program account * * @return Instruction to add to a transaction */ declare function createAssociatedTokenAccountInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey): TransactionInstruction; /** * Construct a CreateAssociatedTokenAccountIdempotent instruction * * @param payer Payer of the initialization fees * @param associatedToken New associated token account * @param owner Owner of the new account * @param mint Token mint account * @param programId SPL Token program account * @param associatedTokenProgramId SPL Associated Token program account * * @return Instruction to add to a transaction */ declare function createAssociatedTokenAccountIdempotentInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey): TransactionInstruction; /** TODO: docs */ interface SyncNativeInstructionData { instruction: TokenInstruction.SyncNative; } /** TODO: docs */ declare const syncNativeInstructionData: _solana_buffer_layout.Structure; /** * Construct a SyncNative instruction * * @param account Native account to sync lamports from * @param programId SPL Token program account * * @return Instruction to add to a transaction */ declare function createSyncNativeInstruction(account: PublicKey, programId?: PublicKey): TransactionInstruction; /** TODO: docs */ interface CloseAccountInstructionData { instruction: TokenInstruction.CloseAccount; } /** TODO: docs */ declare const closeAccountInstructionData: _solana_buffer_layout.Structure; /** * Construct a CloseAccount instruction * * @param account Account to close * @param destination Account to receive the remaining balance of the closed account * @param authority Account close authority * @param multiSigners Signing accounts if `authority` is a multisig * @param programId SPL Token program account * * @return Instruction to add to a transaction */ declare function createCloseAccountInstruction(account: PublicKey, destination: PublicKey, authority: PublicKey, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction; /** TODO: docs */ interface TransferCheckedInstructionData { instruction: TokenInstruction.TransferChecked; amount: bigint; decimals: number; } /** TODO: docs */ declare const transferCheckedInstructionData: _solana_buffer_layout.Structure; /** * Construct a TransferChecked instruction * * @param source Source account * @param mint Mint account * @param destination Destination account * @param owner Owner of the source account * @param amount Number of tokens to transfer * @param decimals Number of decimals in transfer amount * @param multiSigners Signing accounts if `owner` is a multisig * @param programId SPL Token program account * * @return Instruction to add to a transaction */ declare function createTransferCheckedInstruction(source: PublicKey, mint: PublicKey, destination: PublicKey, owner: PublicKey, amount: number | bigint, decimals: number, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction; /** A Solana account public key, encoded as 32 bytes by msgpack. */ type Pubkey = Uint8Array; /** Solana account metadata for an instruction. */ interface AccountMeta { /** Public key for the account. */ p: Pubkey; /** Whether the account is a signer. */ s: boolean; /** Whether the account is writable. */ w: boolean; } /** A single instruction to be executed as part of a transaction. */ interface Instruction { /** Program id. */ p: Pubkey; /** Account metadata. */ a: AccountMeta[]; /** Instruction data. */ d: Uint8Array; } /** An address lookup table referenced by a transaction template (key + inner addresses). */ interface TransactionTemplateLut { /** ALT account address. */ p: Pubkey; /** Addresses stored inside the ALT, in order. */ a: Pubkey[]; } /** * Footprint of the instructions/ALTs surrounding the swap, so the router sizes * routes to fit alongside them. Wire format uses single-letter fields: `i` * instructions, `a` ALTs, `m` extra account metas. See the gateway helper * `buildTitanTemplate`. Over the WebSocket this is sent as a native msgpack * object (no base64) — unlike the gateway GET there is no URL-length limit, so * large ALTs are fine. */ interface TransactionTemplate { i: Instruction[]; a: TransactionTemplateLut[]; m: AccountMeta[]; } declare enum SwapMode { ExactIn = "ExactIn", ExactOut = "ExactOut" } type Uint64 = number | bigint; interface ClientRequest { id: number; data: RequestData; } type RequestData = { NewSwapQuoteStream: SwapQuoteRequest; } | { StopStream: StopStreamRequest; }; interface SwapQuoteRequest { swap: SwapParams; transaction: TransactionParams; update?: QuoteUpdateParams; } interface SwapParams { inputMint: Pubkey; outputMint: Pubkey; amount: Uint64; swapMode?: SwapMode; slippageBps?: number; dexes?: string[]; excludeDexes?: string[]; /** * Exclude the server-configured "vote account" venues from routing. Those venues touch validator * vote accounts, which Jito refuses to bundle — so a swap that routes through them can't land inside * our flashloan/double-hop Jito bundles. Set `true` for bundled flows. Available since Titan v1.6. */ noVoteAccounts?: boolean; onlyDirectRoutes?: boolean; addSizeConstraint?: boolean; sizeConstraint?: number; providers?: string[]; /** Limit total number of accounts used by routes. Default: 256. Available since v1.1. */ accountsLimitTotal?: number; /** Limit writable accounts used by routes. Default: 64. Available since v1.1. */ accountsLimitWritable?: number; /** * Reserve room for the surrounding (non-swap) instructions + ALTs so the * router sizes routes to fit. Mutually exclusive with `sizeConstraint` / * `accountsLimitTotal` / `accountsLimitWritable`. Available since v1.2. */ transactionTemplate?: TransactionTemplate; } interface TransactionParams { userPublicKey: Pubkey; closeInputTokenAccount?: boolean; createOutputTokenAccount?: boolean; feeAccount?: Pubkey; feeBps?: number; feeFromInputMint?: boolean; outputAccount?: Pubkey; titanSwapVersion?: SwapVersion; /** * `true` leaves a wSOL output as wrapped SOL (the wSOL SPL token) instead of * unwrapping it to native lamports. Default `false`. Only has an effect when * `outputMint == wSOL`; ignored otherwise. Requires `titanSwapVersion=3`. */ outputWsol?: boolean; } declare enum SwapVersion { V2 = 2, V3 = 3 } interface QuoteUpdateParams { intervalMs?: Uint64; num_quotes: number; } interface StopStreamRequest { id: number; } type ServerMessage = { Response: ResponseSuccess; } | { Error: ResponseError; } | { StreamData: StreamData; } | { StreamEnd: StreamEnd; }; type ResponseData = { NewSwapQuoteStream: QuoteSwapStreamResponse; } | { StreamStopped: StopStreamResponse; }; interface StreamStart { id: number; dataType: string; } interface ResponseSuccess { requestId: number; data: ResponseData; stream?: StreamStart; } interface ResponseError { requestId: number; code: number; message: string; } type StreamDataPayload = { SwapQuotes: SwapQuotes; }; interface StreamData { id: number; seq: number; payload: StreamDataPayload; } interface StreamEnd { id: number; errorCode?: number; errorMessage?: string; } interface QuoteSwapStreamResponse { intervalMs: number; } interface StopStreamResponse { id: number; } interface SwapQuotes { id: string; inputMint: Uint8Array; outputMint: Uint8Array; swapMode: SwapMode; amount: number; quotes: { [key: string]: SwapRoute; }; /** Present when DART is enabled; names the route Titan recommends. */ metadata?: { ExpectedWinner?: string; }; } interface SwapRoute { inAmount: number; outAmount: number; slippageBps: number; platformFee?: PlatformFee; steps: RoutePlanStep[]; instructions: Instruction[]; addressLookupTables: Pubkey[]; contextSlot?: number; timeTaken?: number; expiresAtMs?: number; expiresAfterSlot?: number; computeUnits?: number; computeUnitsSafe?: number; transaction?: Uint8Array; referenceId?: string; } interface PlatformFee { amount: number; fee_bps: number; } interface RoutePlanStep { ammKey: Uint8Array; label: string; inputMint: Uint8Array; outputMint: Uint8Array; inAmount: number; outAmount: number; allocPpb: number; feeMint?: Uint8Array; feeAmount?: number; contextSlot?: number; } declare class ConnectionClosed extends Error { code: number; reason: string; constructor(code: number, reason: string); } declare class ErrorResponse extends Error { response: ResponseError; constructor(response: ResponseError); } declare class StreamError extends Error { streamId: number; errorCode: number; errorMessage: string; constructor(packet: StreamEnd); } interface ResponseWithStream { response: T; stream: ReadableStream; streamId: number; } declare class V1Client { private socket; private nextId; private _closed; private _closing; private pending; private streams; private streamStopping; private closeListeners; static connect(url: string): Promise; private constructor(); private nextRequestId; get closed(): boolean; close(): Promise; newSwapQuoteStream(params: SwapQuoteRequest): Promise>; stopStream(streamId: number): Promise; private send; private handleMessage; private handleResponse; private handleResponseError; private handleStreamData; private handleStreamEnd; private cancelStream; private rejectAll; private handleClose; private handleError; } interface SerializedInstruction { p: string; a: { p: string; s: boolean; w: boolean; }[]; d: string; } interface SerializedSwapRoute { inAmount: number; outAmount: number; slippageBps: number; platformFee?: { amount: number; fee_bps: number; }; instructions: SerializedInstruction[]; addressLookupTables: string[]; contextSlot?: number; timeTaken?: number; } interface TitanProxySwapQuoteResponse { quotes: { [providerId: string]: SerializedSwapRoute; }; inputMint: string; outputMint: string; swapMode: string; amount: number; } interface TitanProxyExactOutResponse { inAmount: number; outAmount: number; otherAmountThreshold: string; slippageBps: number; } /** * Titan's router stamps a read-only `jitodontfront…` MEV-guard account onto the * swap instruction. Jito refuses to bundle any transaction that touches a `jito*` * marker, so we drop it to keep the swap landable inside a Jito bundle (our * flashloan swaps are bundled). */ declare const isJitoDontFront: (pubkey: PublicKey) => boolean; declare function deserializeSerializedInstruction(ix: SerializedInstruction): TransactionInstruction; declare function selectBestRoute(quotes: { [id: string]: T; }, swapMode: "ExactIn" | "ExactOut"): T | null; interface TitanSwapQuoteResult { inAmount: string; outAmount: string; otherAmountThreshold: string; slippageBps: number; platformFee?: { amount: string; feeBps: number; }; contextSlot?: number; timeTaken?: number; } declare function buildSwapQuoteResult(route: { inAmount: number | bigint; outAmount: number | bigint; slippageBps: number; platformFee?: { amount: number | bigint; fee_bps: number; }; contextSlot?: number; timeTaken?: number; }, swapMode: "ExactIn" | "ExactOut"): TitanSwapQuoteResult; declare function resolveLookupTables(connection: Connection, lutPubkeys: PublicKey[]): Promise; interface TitanTemplateLut { /** ALT account address (32 raw bytes). */ p: Uint8Array; /** Addresses stored inside the ALT, in order (32 raw bytes each). */ a: Uint8Array[]; } interface TitanTransactionTemplate { i: Instruction[]; a: TitanTemplateLut[]; m: { p: Uint8Array; s: boolean; w: boolean; }[]; } /** Convert a web3.js instruction into Titan wire format (raw bytes). */ declare function instructionToTitanWire(ix: TransactionInstruction): Instruction; /** Convert a web3.js ALT into Titan wire format (key + inner addresses). */ declare function lutToTitanWire(lut: AddressLookupTableAccount): TitanTemplateLut; /** * Build a Titan `transactionTemplate` from the surrounding (non-swap) footprint. * ALT order is preserved — pass them in the order the final message will use. */ declare function buildTitanTemplate(footprint: { instructions: TransactionInstruction[]; luts: AddressLookupTableAccount[]; extraAccountMetas?: { pubkey: PublicKey; isSigner: boolean; isWritable: boolean; }[]; }): TitanTransactionTemplate; /** msgpack-encode then base64 a template for the gateway query string. */ declare function encodeTitanTemplate(template: TitanTransactionTemplate): string; interface TitanGatewayQuoteParams { /** Gateway base path, e.g. `https:///api/v1`. `/quote/swap` is appended. */ basePath: string; apiKey?: string; headers?: Record; inputMint: string; outputMint: string; amount: number; userPublicKey: string; outputAccount: string; slippageBps?: number; swapMode?: "ExactIn" | "ExactOut"; dexes?: string[]; excludeDexes?: string[]; onlyDirectRoutes?: boolean; /** Allowlist of quote providers by id. The gateway has no exclude-list, so to * drop a provider (e.g. Titan-DART) we list the ones we want. */ providers?: string[]; /** msgpack+base64 template. Mutually exclusive with the size/account limits * below. Note: sent as a query-string value, so a template that embeds large * ALTs can exceed the gateway's URI limit (414) — prefer the numeric limits * for flashloan footprints that reference big lookup tables. */ transactionTemplate?: string; /** Numeric sizing (small query params; safe for LUT-heavy footprints). */ addSizeConstraint?: boolean; sizeConstraint?: number; accountsLimitTotal?: number; accountsLimitWritable?: number; feeBps?: number; feeAccount?: string; } interface TitanGatewayQuoteResponse { quotes: { [id: string]: SwapRoute; }; metadata?: { ExpectedWinner?: string; }; } /** * Fetch a V3 quote/swap from the Titan gateway and return the best route. * Honors the gateway's `ExpectedWinner` when present, otherwise falls back to * `selectBestRoute` semantics (max out for ExactIn, min in for ExactOut). */ declare function fetchTitanQuoteSwapV3(params: TitanGatewayQuoteParams): Promise<{ route: SwapRoute; raw: TitanGatewayQuoteResponse; }>; /** * Pick the best usable route from a quotes map, honoring Titan's * `ExpectedWinner` when present and skipping non-viable (zero-amount) routes. * Shared by the gateway REST path and the WebSocket adapter. */ declare function selectGatewayRoute(raw: TitanGatewayQuoteResponse, swapMode: "ExactIn" | "ExactOut"): SwapRoute | null; /** Deserialize a Titan wire instruction (raw bytes) into a web3.js instruction. */ declare function deserializeTitanWireInstruction(ix: Instruction): TransactionInstruction; export { ACCOUNT_SIZE, ACCOUNT_TYPE_SIZE, ASSOCIATED_TOKEN_PROGRAM_ID, type Account, AccountLayout, type AccountMeta, AccountState, AccountType, type ApproveInstructionData, type Base, type BigFractionBytesFields, type BorrowRateCurveFields, type ClientRequest, type CloseAccountInstructionData, ConnectionClosed, CorpAction, type CurvePointFields, DEFAULT_RECENT_SLOT_DURATION_MS, DRIFT_IDL, DRIFT_PROGRAM_ID, type DriftIdlType, type DriftInterestRateCurvePoint, DriftRewards, DriftRewardsJSON, DriftSpotBalanceType, DriftSpotMarket, DriftSpotMarketJSON, type DriftSpotMarketRaw, type DriftState, type DriftStateJSON, DriftUser, DriftUserJSON, type DriftUserRaw, DriftUserStats, DriftUserStatsJSON, EXPONENT_CLMM_IDL, EXPONENT_CLMM_PROGRAM_ID, EXPONENT_CORE_IDL, EXPONENT_CORE_PROGRAM_ID, EXPONENT_EVENT_AUTHORITY_SEED, EXPONENT_GENERIC_SY_PROGRAM_ID, EXPONENT_JITO_RESTAKING_SY_PROGRAM_ID, EXPONENT_KAMINO_SY_PROGRAM_ID, EXPONENT_MARGINFI_SY_PROGRAM_ID, EXPONENT_NUMBER_DENOM, EXPONENT_ORDERBOOK_PROGRAM_ID, EXPONENT_PERENA_SY_PROGRAM_ID, EXPONENT_VAULTS_PROGRAM_ID, type Ema, ErrorResponse, type ExponentClmmTradePtAccounts, type ExponentClmmTradePtContext, ExponentCpiInterfaceContext, type ExponentMarketThree, type ExponentMarketThreeCpiAccounts, ExponentMarketTwo, type ExponentMergeAccounts, type ExponentMergeContext, type ExponentStripAccounts, type ExponentStripContext, ExponentSwapDirection, ExponentTradePtAccounts, ExponentTradePtContext, ExponentVault, type ExponentWrapperMergeAccounts, type ExponentWrapperMergeContext, ExtensionType, FARMS_PROGRAM_ID, type FarmStateRaw, FeeStructure, FeeStructureJSON, GAMMA_VAULT_IDL, GAMMA_VAULT_PROGRAM_ID, type GammaCompleteWithdrawalAccounts, type GammaDepositAccounts, GammaLpVaultRaw, type GammaVaultIdlType, type GammaWithdrawAccounts, GammaWithdrawReceiptRaw, HistoricalIndexData, HistoricalOracleData, type InitializeAccountInstructionData, type Instruction, InsuranceFund, JUP_EXCHANGE_PRICES_PRECISION, JUP_LEND_IDL, JUP_LEND_PROGRAM_ID, JUP_LIQUIDITY_IDL, JUP_LIQUIDITY_PROGRAM_ID, JUP_MAX_REWARDS_RATE, JUP_REWARDS_PROGRAM_ID, JUP_SECONDS_PER_YEAR, type JupLendIdlType, type JupLendInterestRateCurvePoint, type JupLendRewardsResult, JupLendingRewardsRateModel, JupLendingRewardsRateModelJSON, type JupLendingRewardsRateModelRaw, JupLendingState, JupLendingStateJSON, type JupLendingStateRaw, type JupLiquidityIdlType, JupRateModel, JupRateModelJSON, type JupRateModelRaw, JupTokenReserve, JupTokenReserveJSON, type JupTokenReserveRaw, KFARMS_IDL, KLEND_ACCOUNT_CODER, KLEND_IDL, KLEND_PROGRAM_ID, KaminoBorrowRateCurvePoint, KaminoFarmRewardInfo, KaminoFarmState, KaminoFarmStateJSON, KaminoInterestRateBasis, KaminoObligation, KaminoObligationJSON, type KaminoRateBasis, KaminoReserve, type KaminoReserveCurveData, KaminoReserveJSON, type KfarmsIdlType, type KlendIdlType, type KlendInterestRateCurvePoint, LENGTH_SIZE, type LastUpdateFields, MARINADE_PROGRAM_ID, MARINADE_STATE_DISCRIMINATOR, MARINADE_STATE_MIN_SIZE, MAX_SLOT_DIFFERENCE, MEMO_PROGRAM_ID, MINT_SIZE, MULTISIG_SIZE, type MarinadeState, type Mint, MintLayout, type Multisig, MultisigLayout, NATIVE_MINT, ONE, ONE_HUNDRED_PCT_IN_BPS, ONE_YEAR, type ObligationCollateralFields, type ObligationLiquidityFields, type ObligationOrderFields, type ObligationRaw, OracleGuardRails, OracleGuardRailsJSON, PERCENTAGE_PRECISION, PERCENTAGE_PRECISION_EXP, type PlatformFee, PoolBalance, type Price, type PriceComponent, type PriceData, type PriceHeuristicFields, PriceStatus, PriceType, type Pubkey, type PythConfigurationFields, type QuoteSwapStreamResponse, type QuoteUpdateParams, REFRESH_OBLIGATION_DISCRIMINATOR, type RawAccount, type RawMint, type RawMultisig, type RefreshObligationAccounts, type RequestData, type ReserveCollateralFields, type ReserveConfigFields, type ReserveFeesFields, type ReserveLiquidityFields, type ReserveRaw, type ResolveExponentClmmTradePtContextParams, type ResolveExponentMergeContextParams, type ResolveExponentStripContextParams, ResolveExponentTradePtContextParams, type ResolveExponentWrapperMergeContextParams, type ResponseData, type ResponseError, type ResponseSuccess, type ResponseWithStream, type RewardInfoFields, type RewardPerTimeUnitPointFields, type RewardScheduleCurveFields, type RoutePlanStep, SANCTUM_SPL_MULTI_STAKE_POOL_PROGRAM_ID, SANCTUM_SPL_STAKE_POOL_PROGRAM_ID, SCOPE_MAX_ENTRIES, SCOPE_ORACLE_PRICES_DISCRIMINATOR, SCOPE_ORACLE_PRICES_SIZE, SCOPE_PROGRAM_ID, SECONDS_PER_YEAR, SEED_BASE_REFERRER_STATE, SEED_BASE_REFERRER_TOKEN_STATE, SEED_BASE_SHORT_URL, SEED_BASE_USER_METADATA, SEED_DEPOSIT_POLICY, SEED_DEPOSIT_RECEIPT, SEED_DRIFT_SIGNER, SEED_DRIFT_STATE, SEED_FEE_RECEIVER, SEED_F_TOKEN_MINT, SEED_LENDING, SEED_LENDING_ADMIN, SEED_LENDING_MARKET_AUTH, SEED_LENDING_REWARDS_RATE_MODEL, SEED_LIQUIDITY, SEED_RATE_MODEL, SEED_RESERVE, SEED_RESERVE_COLL_MINT, SEED_RESERVE_COLL_SUPPLY, SEED_RESERVE_LIQ_SUPPLY, SEED_SPOT_MARKET, SEED_SPOT_MARKET_VAULT, SEED_USER, SEED_USER_CLAIM, SEED_USER_STATE, SEED_USER_STATS, SEED_USER_SUPPLY_POSITION, SEED_WITHDRAWAL_POLICY, SEED_WITHDRAW_ESCROW, SEED_WITHDRAW_RECEIPT, SLOTS_PER_DAY, SLOTS_PER_HOUR, SLOTS_PER_MINUTE, SLOTS_PER_SECOND, SLOTS_PER_YEAR, SPL_STAKE_POOL_PROGRAM_ID, SPOT_MARKET_RATE_PRECISION, SPOT_MARKET_RATE_PRECISION_EXP, SPOT_MARKET_UTILIZATION_PRECISION, SPOT_MARKET_UTILIZATION_PRECISION_EXP, type ScopeConfigurationFields, type ScopeDatedPrice, type SerializedInstruction, type SerializedSwapRoute, type ServerMessage, SinglePoolInstruction, SplAccountType, SpotPosition, type StakeAccount, type StakePool, type StopStreamRequest, type StopStreamResponse, type StreamData, type StreamDataPayload, type StreamEnd, StreamError, type StreamStart, SwapMode, type SwapParams, type SwapQuoteRequest, type SwapQuotes, type SwapRoute, SwapVersion, type SwitchboardConfigurationFields, type SyncNativeInstructionData, TEN, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, TYPE_SIZE, type TitanGatewayQuoteParams, type TitanGatewayQuoteResponse, type TitanProxyExactOutResponse, type TitanProxySwapQuoteResponse, type TitanSwapQuoteResult, type TitanTemplateLut, type TitanTransactionTemplate, TokenAccountNotFoundError, TokenError, type TokenInfoFields$1 as TokenInfoFields, TokenInstruction, TokenInvalidAccountError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError, TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, TokenInvalidMintError, TokenInvalidOwnerError, TokenOwnerOffCurveError, TokenUnsupportedInstructionError, type TransactionParams, type TransactionTemplate, type TransactionTemplateLut, type TransferCheckedInstructionData, type Uint64, V1Client, type WithdrawalCapsFields, ZERO, addSigners, approveInstructionData, buildSwapQuoteResult, buildTitanTemplate, calculateAPYFromAPR, calculateDriftBorrowAPR, calculateDriftBorrowAPY, calculateDriftBorrowRate, calculateDriftDepositRate, calculateDriftInterestRate, calculateDriftLendingAPR, calculateDriftLendingAPY, calculateDriftUtilization, calculateJupLendBorrowRate, calculateJupLendLiquiditySupplyRate, calculateJupLendNewExchangePrice, calculateJupLendRewardsRate, calculateJupLendRewardsRateForExchangePrice, calculateJupLendSupplyAPY, calculateJupLendSupplyRate, calculateJupLendTotalAssets, calculateKaminoEstimatedBorrowRate, calculateKaminoEstimatedSupplyRate, calculateKaminoSupplyAPY, calculateRewardApy, calculateSlotAdjustmentFactor, calculateUtilizationRatio, closeAccountInstructionData, createAccountIx, createApproveInstruction, createAssociatedTokenAccountIdempotentInstruction, createAssociatedTokenAccountInstruction, createCloseAccountInstruction, createInitializeAccountInstruction, createMemoInstruction, createPoolOnrampIx, createSyncNativeInstruction, createTransferCheckedInstruction, decodeDriftSpotMarketData, decodeDriftStateData, decodeDriftUserData, decodeDriftUserStatsData, decodeExponentMarketThree, decodeExponentMarketTwo, decodeExponentMarketVault, decodeExponentVault, decodeFarmDataRaw, decodeGammaLpVaultData, decodeGammaWithdrawReceiptData, decodeJupLendingRewardsRateModelData, decodeJupLendingStateData, decodeJupRateModelData, decodeJupTokenReserveData, decodeKlendObligationData, decodeKlendReserveData, decodeMarinadeState, decodeScopePriceAtIndex, decodeStakePool, deriveBaseObligation, deriveDriftSigner, deriveDriftSpotMarket, deriveDriftSpotMarketVault, deriveDriftState, deriveDriftUser, deriveDriftUserStats, deriveExponentClmmEventAuthority, deriveExponentEventAuthority, deriveFeeReceiver, deriveGammaAta, deriveGammaDepositPolicy, deriveGammaDepositReceipt, deriveGammaWithdrawEscrow, deriveGammaWithdrawReceipt, deriveGammaWithdrawalPolicy, deriveJupLendClaimAccount, deriveJupLendFTokenMint, deriveJupLendLending, deriveJupLendLendingAdmin, deriveJupLendLendingPdas, deriveJupLendLendingRewardsRateModel, deriveJupLendLiquidity, deriveJupLendLiquiditySupplyPositionPda, deriveJupLendLiquidityVaultAta, deriveJupLendRateModel, deriveJupLendTokenReserve, deriveLendingMarketAuthority, deriveObligation, deriveReferrerState, deriveReferrerTokenState, deriveReserveCollateralMint, deriveReserveCollateralSupply, deriveReserveLiquiditySupply, deriveShortUrl, deriveUserMetadata, deriveUserState, deserializeSerializedInstruction, deserializeTitanWireInstruction, driftRewardsRawToDto, driftSpotMarketRawToDto, driftStateRawToDto, driftUserRawToDto, driftUserStatsRawToDto, dtoToDriftRewardsRaw, dtoToDriftSpotMarketRaw, dtoToDriftStateRaw, dtoToDriftUserRaw, dtoToDriftUserStatsRaw, dtoToJupLendingRewardsRateModelRaw, dtoToJupLendingStateRaw, dtoToJupRateModelRaw, dtoToJupTokenReserveRaw, dtoToKaminoFarmState, dtoToKaminoObligation, dtoToKaminoReserve, encodeTitanTemplate, exponentBuyPtArgs, exponentClmmBuyPtArgs, exponentNumberToBigNumber, fetchExponentMarketThree, fetchExponentMarketTwo, fetchExponentVault, fetchExponentVaultFromMarket, fetchTitanQuoteSwapV3, findMplMetadataAddress, findPoolAddress, findPoolMintAddress, findPoolMintAddressByVoteAccount, findPoolMintAuthorityAddress, findPoolMplAuthorityAddress, findPoolOnRampAddress, findPoolStakeAddress, findPoolStakeAuthorityAddress, generateDriftReserveCurve, generateJupLendSupplyCurve, generateKaminoReserveCurve, generateKaminoReserveCurveFromReserve, getAccount, getAccountLen, getAllDerivedDriftAccounts, getAllDerivedJupLendAccounts, getAllDerivedKaminoAccounts, getAllRequiredMarkets, getAssociatedTokenAddressSync, getDriftRewards, getDriftTokenAmount, getFixedHostInterestRate, getJupLendRewards, getKaminoBorrowRate, getKaminoInterestRateBasis, getKaminoRateBasis, getKaminoTotalSupply, getMinimumBalanceForRentExemptAccount, getMinimumBalanceForRentExemptAccountWithExtensions, getMint, getMintDecimals, getMultipleAccounts, getProtocolTakeRatePct, getReserveRewardsApy, getRewardPerTimeUnitSecond, getStakeAccount, initializeAccountInstructionData, initializeStakedPoolIxs, initializeStakedPoolTx, instructionToTitanWire, interpolateLinear, isJitoDontFront, jupLendingRewardsRateModelRawToDto, jupLendingStateRawToDto, jupRateModelRawToDto, jupTokenReserveRawToDto, kaminoFarmStateToDto, kaminoObligationToDto, kaminoReserveToDto, layout, lutToTitanWire, makeExponentClmmTradePtIx, makeExponentMergeIx, makeExponentStripIx, makeExponentTradePtIx, makeExponentWrapperMergeIx, makeGammaCompleteWithdrawalIx, makeGammaDepositIx, makeGammaWithdrawIx, makeRefreshObligationIx, makeRefreshReservesBatchIx, makeRefreshingIxs, makeSplStakePoolUpdateBalanceIx, makeUpdateJupLendRate, makeUpdateJupLendRateIx, makeUpdateSpotMarketCumulativeInterestIx, makeUpdateSpotMarketIx, parsePriceData, parsePriceInfo, replenishPoolIx, resolveExponentClmmTradePtContext, resolveExponentMergeContext, resolveExponentStripContext, resolveExponentTradePtContext, resolveExponentWrapperMergeContext, resolveLookupTables, scaledSupplies, selectBestRoute, selectGatewayRoute, slotAdjustmentFactor, syncNativeInstructionData, transferCheckedInstructionData, truncateBorrowCurve, unpackAccount };