Solana IDL reference › Drift V2 › PerpMarket

PerpMarket account layout

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

Fields (offsets include the 8-byte discriminator)

FieldTypeOffsetSize
pubkeypubkey832
ammAMM40936
oraclepubkey4032
historicalOracleDataHistoricalOracleData7248
lastOraclePricei64728
lastOracleConfu64808
lastOracleDelayi64888
lastOraclePriceTwapi64968
lastOraclePriceTwap5mini641048
lastOraclePriceTwapTsi641128
baseAssetAmountPerLpi12812016
quoteAssetAmountPerLpi12813616
feePoolPoolBalance15224
scaledBalanceu12815216
marketIndexu161682
padding[u8; 6]1706
baseAssetReserveu12817616
quoteAssetReserveu12819216
concentrationCoefu12820816
minBaseAssetReserveu12822416
maxBaseAssetReserveu12824016
sqrtKu12825616
pegMultiplieru12827216
terminalQuoteAssetReserveu12828816
baseAssetAmountLongi12830416
baseAssetAmountShorti12832016
baseAssetAmountWithAmmi12833616
baseAssetAmountWithUnsettledLpi12835216
maxOpenInterestu12836816
quoteAssetAmounti12838416
quoteEntryAmountLongi12840016
quoteEntryAmountShorti12841616
quoteBreakEvenAmountLongi12843216
quoteBreakEvenAmountShorti12844816
userLpSharesu12846416
lastFundingRatei644808
lastFundingRateLongi644888
lastFundingRateShorti644968
last24hAvgFundingRatei645048
totalFeei12851216
totalMmFeei12852816
totalExchangeFeeu12854416
totalFeeMinusDistributionsi12856016
totalFeeWithdrawnu12857616
totalLiquidationFeeu12859216
cumulativeFundingRateLongi12860816
cumulativeFundingRateShorti12862416
totalSocialLossu12864016
askBaseAssetReserveu12865616
askQuoteAssetReserveu12867216
bidBaseAssetReserveu12868816
bidQuoteAssetReserveu12870416
lastOracleNormalisedPricei647208
lastOracleReservePriceSpreadPcti647288
lastBidPriceTwapu647368
lastAskPriceTwapu647448
lastMarkPriceTwapu647528
lastMarkPriceTwap5minu647608
lastUpdateSlotu647688
lastOracleConfPctu647768
netRevenueSinceLastFundingi647848
lastFundingRateTsi647928
fundingPeriodi648008
orderStepSizeu648088
orderTickSizeu648168
minOrderSizeu648248
mmOracleSlotu648328
volume24hu648408
longIntensityVolumeu648488
shortIntensityVolumeu648568
lastTradeTsi648648
markStdu648728
oracleStdu648808
lastMarkPriceTwapTsi648888
baseSpreadu328964
maxSpreadu329004
longSpreadu329044
shortSpreadu329084
mmOraclePricei649128
maxFillReserveFractionu169202
maxSlippageRatiou169222
curveUpdateIntensityu89241
ammJitIntensityu89251
oracleSourceOracleSource9261
lastOracleValidbool9271
targetBaseAssetAmountPerLpi329284
perLpBasei89321
oracleLowRiskSlotDelayOverridei89331
ammSpreadAdjustmenti89341
oracleSlotDelayOverridei89351
mmOracleSequenceIdu649368
netUnsettledFundingPnli649448
quoteAssetAmountWithUnsettledLpi649528
referencePriceOffseti329604
ammInventorySpreadAdjustmenti89641
referencePriceOffsetDeadbandPctu89651
padding[u8; 2]9662
lastFundingOracleTwapi649688
pnlPoolPoolBalance97624
scaledBalanceu12897616
marketIndexu169922
padding[u8; 6]9946
name[u8; 32]100032
insuranceClaimInsuranceClaim103240
revenueWithdrawSinceLastSettlei6410328
maxRevenueWithdrawPerPeriodu6410408
quoteMaxInsuranceu6410488
quoteSettledInsuranceu6410568
lastRevenueWithdrawTsi6410648
unrealizedPnlMaxImbalanceu6410728
expiryTsi6410808
expiryPricei6410888
nextFillRecordIdu6410968
nextFundingRateRecordIdu6411048
nextCurveRecordIdu6411128
imfFactoru3211204
unrealizedPnlImfFactoru3211244
liquidatorFeeu3211284
ifLiquidationFeeu3211324
marginRatioInitialu3211364
marginRatioMaintenanceu3211404
unrealizedPnlInitialAssetWeightu3211444
unrealizedPnlMaintenanceAssetWeightu3211484
numberOfUsersWithBaseu3211524
numberOfUsersu3211564
marketIndexu1611602
statusMarketStatus11621
contractTypeContractType11631
contractTierContractTier11641
pausedOperationsu811651
quoteSpotMarketIndexu1611662
feeAdjustmenti1611682
fuelBoostPositionu811701
fuelBoostTakeru811711
fuelBoostMakeru811721
poolIdu811731
highLeverageMarginRatioInitialu1611742
highLeverageMarginRatioMaintenanceu1611762
protectedMakerLimitPriceDivisoru811781
protectedMakerDynamicDivisoru811791
lpFeeTransferScalaru811801
lpStatusu811811
lpPausedOperationsu811821
lpExchangeFeeExcluscionScalaru811831
lastFillPriceu6411848
lpPoolIdu811921
padding[u8; 23]119323

getProgramAccounts filter

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>"
          }
        }
      ]
    }
  ]
}

Decode account data

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.

Other Drift V2 account types

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.