Solana IDL reference › Drift V2 › PerpMarket
Drift V2 account type. Program ID dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH. Data starts with the 8-byte account discriminator, computed with the standard Anchor rule: first 8 bytes of sha256("account:PerpMarket").
Discriminator (computed with the standard Anchor rule: first 8 bytes of sha256("account:PerpMarket"))
hex 0x0adf0c2c6bf537f7
bytes [10, 223, 12, 44, 107, 245, 55, 247]
base58 2pTyMkwXuti
| Field | Type | Offset | Size |
|---|---|---|---|
| pubkey | pubkey | 8 | 32 |
| amm | AMM | 40 | 936 |
| oracle | pubkey | 40 | 32 |
| historicalOracleData | HistoricalOracleData | 72 | 48 |
| lastOraclePrice | i64 | 72 | 8 |
| lastOracleConf | u64 | 80 | 8 |
| lastOracleDelay | i64 | 88 | 8 |
| lastOraclePriceTwap | i64 | 96 | 8 |
| lastOraclePriceTwap5min | i64 | 104 | 8 |
| lastOraclePriceTwapTs | i64 | 112 | 8 |
| baseAssetAmountPerLp | i128 | 120 | 16 |
| quoteAssetAmountPerLp | i128 | 136 | 16 |
| feePool | PoolBalance | 152 | 24 |
| scaledBalance | u128 | 152 | 16 |
| marketIndex | u16 | 168 | 2 |
| padding | [u8; 6] | 170 | 6 |
| baseAssetReserve | u128 | 176 | 16 |
| quoteAssetReserve | u128 | 192 | 16 |
| concentrationCoef | u128 | 208 | 16 |
| minBaseAssetReserve | u128 | 224 | 16 |
| maxBaseAssetReserve | u128 | 240 | 16 |
| sqrtK | u128 | 256 | 16 |
| pegMultiplier | u128 | 272 | 16 |
| terminalQuoteAssetReserve | u128 | 288 | 16 |
| baseAssetAmountLong | i128 | 304 | 16 |
| baseAssetAmountShort | i128 | 320 | 16 |
| baseAssetAmountWithAmm | i128 | 336 | 16 |
| baseAssetAmountWithUnsettledLp | i128 | 352 | 16 |
| maxOpenInterest | u128 | 368 | 16 |
| quoteAssetAmount | i128 | 384 | 16 |
| quoteEntryAmountLong | i128 | 400 | 16 |
| quoteEntryAmountShort | i128 | 416 | 16 |
| quoteBreakEvenAmountLong | i128 | 432 | 16 |
| quoteBreakEvenAmountShort | i128 | 448 | 16 |
| userLpShares | u128 | 464 | 16 |
| lastFundingRate | i64 | 480 | 8 |
| lastFundingRateLong | i64 | 488 | 8 |
| lastFundingRateShort | i64 | 496 | 8 |
| last24hAvgFundingRate | i64 | 504 | 8 |
| totalFee | i128 | 512 | 16 |
| totalMmFee | i128 | 528 | 16 |
| totalExchangeFee | u128 | 544 | 16 |
| totalFeeMinusDistributions | i128 | 560 | 16 |
| totalFeeWithdrawn | u128 | 576 | 16 |
| totalLiquidationFee | u128 | 592 | 16 |
| cumulativeFundingRateLong | i128 | 608 | 16 |
| cumulativeFundingRateShort | i128 | 624 | 16 |
| totalSocialLoss | u128 | 640 | 16 |
| askBaseAssetReserve | u128 | 656 | 16 |
| askQuoteAssetReserve | u128 | 672 | 16 |
| bidBaseAssetReserve | u128 | 688 | 16 |
| bidQuoteAssetReserve | u128 | 704 | 16 |
| lastOracleNormalisedPrice | i64 | 720 | 8 |
| lastOracleReservePriceSpreadPct | i64 | 728 | 8 |
| lastBidPriceTwap | u64 | 736 | 8 |
| lastAskPriceTwap | u64 | 744 | 8 |
| lastMarkPriceTwap | u64 | 752 | 8 |
| lastMarkPriceTwap5min | u64 | 760 | 8 |
| lastUpdateSlot | u64 | 768 | 8 |
| lastOracleConfPct | u64 | 776 | 8 |
| netRevenueSinceLastFunding | i64 | 784 | 8 |
| lastFundingRateTs | i64 | 792 | 8 |
| fundingPeriod | i64 | 800 | 8 |
| orderStepSize | u64 | 808 | 8 |
| orderTickSize | u64 | 816 | 8 |
| minOrderSize | u64 | 824 | 8 |
| mmOracleSlot | u64 | 832 | 8 |
| volume24h | u64 | 840 | 8 |
| longIntensityVolume | u64 | 848 | 8 |
| shortIntensityVolume | u64 | 856 | 8 |
| lastTradeTs | i64 | 864 | 8 |
| markStd | u64 | 872 | 8 |
| oracleStd | u64 | 880 | 8 |
| lastMarkPriceTwapTs | i64 | 888 | 8 |
| baseSpread | u32 | 896 | 4 |
| maxSpread | u32 | 900 | 4 |
| longSpread | u32 | 904 | 4 |
| shortSpread | u32 | 908 | 4 |
| mmOraclePrice | i64 | 912 | 8 |
| maxFillReserveFraction | u16 | 920 | 2 |
| maxSlippageRatio | u16 | 922 | 2 |
| curveUpdateIntensity | u8 | 924 | 1 |
| ammJitIntensity | u8 | 925 | 1 |
| oracleSource | OracleSource | 926 | 1 |
| lastOracleValid | bool | 927 | 1 |
| targetBaseAssetAmountPerLp | i32 | 928 | 4 |
| perLpBase | i8 | 932 | 1 |
| oracleLowRiskSlotDelayOverride | i8 | 933 | 1 |
| ammSpreadAdjustment | i8 | 934 | 1 |
| oracleSlotDelayOverride | i8 | 935 | 1 |
| mmOracleSequenceId | u64 | 936 | 8 |
| netUnsettledFundingPnl | i64 | 944 | 8 |
| quoteAssetAmountWithUnsettledLp | i64 | 952 | 8 |
| referencePriceOffset | i32 | 960 | 4 |
| ammInventorySpreadAdjustment | i8 | 964 | 1 |
| referencePriceOffsetDeadbandPct | u8 | 965 | 1 |
| padding | [u8; 2] | 966 | 2 |
| lastFundingOracleTwap | i64 | 968 | 8 |
| pnlPool | PoolBalance | 976 | 24 |
| scaledBalance | u128 | 976 | 16 |
| marketIndex | u16 | 992 | 2 |
| padding | [u8; 6] | 994 | 6 |
| name | [u8; 32] | 1000 | 32 |
| insuranceClaim | InsuranceClaim | 1032 | 40 |
| revenueWithdrawSinceLastSettle | i64 | 1032 | 8 |
| maxRevenueWithdrawPerPeriod | u64 | 1040 | 8 |
| quoteMaxInsurance | u64 | 1048 | 8 |
| quoteSettledInsurance | u64 | 1056 | 8 |
| lastRevenueWithdrawTs | i64 | 1064 | 8 |
| unrealizedPnlMaxImbalance | u64 | 1072 | 8 |
| expiryTs | i64 | 1080 | 8 |
| expiryPrice | i64 | 1088 | 8 |
| nextFillRecordId | u64 | 1096 | 8 |
| nextFundingRateRecordId | u64 | 1104 | 8 |
| nextCurveRecordId | u64 | 1112 | 8 |
| imfFactor | u32 | 1120 | 4 |
| unrealizedPnlImfFactor | u32 | 1124 | 4 |
| liquidatorFee | u32 | 1128 | 4 |
| ifLiquidationFee | u32 | 1132 | 4 |
| marginRatioInitial | u32 | 1136 | 4 |
| marginRatioMaintenance | u32 | 1140 | 4 |
| unrealizedPnlInitialAssetWeight | u32 | 1144 | 4 |
| unrealizedPnlMaintenanceAssetWeight | u32 | 1148 | 4 |
| numberOfUsersWithBase | u32 | 1152 | 4 |
| numberOfUsers | u32 | 1156 | 4 |
| marketIndex | u16 | 1160 | 2 |
| status | MarketStatus | 1162 | 1 |
| contractType | ContractType | 1163 | 1 |
| contractTier | ContractTier | 1164 | 1 |
| pausedOperations | u8 | 1165 | 1 |
| quoteSpotMarketIndex | u16 | 1166 | 2 |
| feeAdjustment | i16 | 1168 | 2 |
| fuelBoostPosition | u8 | 1170 | 1 |
| fuelBoostTaker | u8 | 1171 | 1 |
| fuelBoostMaker | u8 | 1172 | 1 |
| poolId | u8 | 1173 | 1 |
| highLeverageMarginRatioInitial | u16 | 1174 | 2 |
| highLeverageMarginRatioMaintenance | u16 | 1176 | 2 |
| protectedMakerLimitPriceDivisor | u8 | 1178 | 1 |
| protectedMakerDynamicDivisor | u8 | 1179 | 1 |
| lpFeeTransferScalar | u8 | 1180 | 1 |
| lpStatus | u8 | 1181 | 1 |
| lpPausedOperations | u8 | 1182 | 1 |
| lpExchangeFeeExcluscionScalar | u8 | 1183 | 1 |
| lastFillPrice | u64 | 1184 | 8 |
| lpPoolId | u8 | 1192 | 1 |
| padding | [u8; 23] | 1193 | 23 |
Every PerpMarket account starts with the same discriminator, so a memcmp at offset 0 selects this account type. The second filter matches pubkey at offset 8. A dataSize: 1216 filter would also work only while live accounts still have the snapshot size; programs often add fields in upgrades, so it is left out here. getProgramAccounts on a large program is heavy; many RPC providers limit or disable it.
{
"jsonrpc": "2.0",
"id": 1,
"method": "getProgramAccounts",
"params": [
"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH",
{
"encoding": "base64",
"filters": [
{
"memcmp": {
"offset": 0,
"bytes": "2pTyMkwXuti"
}
},
{
"memcmp": {
"offset": 8,
"bytes": "<pubkey as base58>"
}
}
]
}
]
}
Decoding runs on Rugsight's server against the bundled snapshot. Nothing is fetched from the chain. Paste public account data only; never paste a private key or seed phrase.
Drift V2 instructions · Explain a transaction
Data: solana-idls@1.2.1 (MIT, © Obsidian Protocol) and SPL Token / Token-2022 state layouts (Apache-2.0), snapshot 2026-11-17. Programs can upgrade and an IDL snapshot can lag the deployed program, so check important offsets against current account data.