@drift-labs/sdk 2.86.0-beta.9 → 2.87.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/VERSION +1 -1
  2. package/lib/addresses/pda.d.ts +1 -0
  3. package/lib/addresses/pda.js +8 -1
  4. package/lib/adminClient.d.ts +8 -4
  5. package/lib/adminClient.js +51 -8
  6. package/lib/bankrun/bankrunConnection.d.ts +1 -0
  7. package/lib/bankrun/bankrunConnection.js +6 -0
  8. package/lib/constants/numericConstants.d.ts +2 -0
  9. package/lib/constants/numericConstants.js +3 -1
  10. package/lib/constants/perpMarkets.js +139 -126
  11. package/lib/constants/spotMarkets.js +52 -40
  12. package/lib/driftClient.d.ts +12 -14
  13. package/lib/driftClient.js +147 -9
  14. package/lib/idl/drift.json +344 -10
  15. package/lib/idl/pyth_solana_receiver.json +628 -0
  16. package/lib/math/fuel.d.ts +1 -0
  17. package/lib/math/fuel.js +12 -2
  18. package/lib/types.d.ts +25 -6
  19. package/lib/types.js +3 -2
  20. package/lib/user.d.ts +6 -5
  21. package/lib/user.js +36 -18
  22. package/package.json +1 -1
  23. package/src/addresses/pda.ts +15 -0
  24. package/src/adminClient.ts +119 -7
  25. package/src/bankrun/bankrunConnection.ts +13 -0
  26. package/src/constants/numericConstants.ts +2 -0
  27. package/src/constants/perpMarkets.ts +142 -126
  28. package/src/constants/spotMarkets.ts +54 -40
  29. package/src/driftClient.ts +203 -16
  30. package/src/idl/drift.json +344 -10
  31. package/src/idl/openbook.json +3854 -0
  32. package/src/idl/pyth_solana_receiver.json +628 -0
  33. package/src/math/fuel.ts +15 -1
  34. package/src/types.ts +28 -7
  35. package/src/user.ts +119 -55
  36. package/tests/ci/verifyConstants.ts +214 -0
  37. package/tests/dlob/helpers.ts +30 -0
  38. package/tests/user/helpers.ts +1 -0
  39. package/tests/user/test.ts +2 -0
package/src/types.ts CHANGED
@@ -44,8 +44,9 @@ export enum PerpOperation {
44
44
  export enum SpotOperation {
45
45
  UPDATE_CUMULATIVE_INTEREST = 1,
46
46
  FILL = 2,
47
- WITHDRAW = 4,
48
- LIQUIDATION = 8,
47
+ DEPOSIT = 4,
48
+ WITHDRAW = 8,
49
+ LIQUIDATION = 16,
49
50
  }
50
51
 
51
52
  export enum InsuranceFundOperation {
@@ -637,9 +638,9 @@ export type PerpMarketAccount = {
637
638
  feeAdjustment: number;
638
639
  pausedOperations: number;
639
640
 
640
- fuelBoostPosition: number;
641
- fuelBoostMaker: number;
642
641
  fuelBoostTaker: number;
642
+ fuelBoostMaker: number;
643
+ fuelBoostPosition: number;
643
644
  };
644
645
 
645
646
  export type HistoricalOracleData = {
@@ -741,8 +742,9 @@ export type SpotMarketAccount = {
741
742
 
742
743
  fuelBoostDeposits: number;
743
744
  fuelBoostBorrows: number;
744
- fuelBoostMaker: number;
745
745
  fuelBoostTaker: number;
746
+ fuelBoostMaker: number;
747
+ fuelBoostInsurance: number;
746
748
  };
747
749
 
748
750
  export type PoolBalance = {
@@ -886,6 +888,9 @@ export type UserStatsAccount = {
886
888
  authority: PublicKey;
887
889
  ifStakedQuoteAssetAmount: BN;
888
890
 
891
+ lastFuelIfBonusUpdateTs: number; // u32 onchain
892
+
893
+ fuelInsurance: number;
889
894
  fuelDeposits: number;
890
895
  fuelBorrows: number;
891
896
  fuelPositions: number;
@@ -922,8 +927,7 @@ export type UserAccount = {
922
927
  hasOpenOrder: boolean;
923
928
  openAuctions: number;
924
929
  hasOpenAuction: boolean;
925
-
926
- lastFuelBonusUpdateTs: BN;
930
+ lastFuelBonusUpdateTs: number;
927
931
  };
928
932
 
929
933
  export type SpotPosition = {
@@ -1178,6 +1182,23 @@ export type PhoenixV1FulfillmentConfigAccount = {
1178
1182
  status: SpotFulfillmentStatus;
1179
1183
  };
1180
1184
 
1185
+ export type OpenbookV2FulfillmentConfigAccount = {
1186
+ pubkey: PublicKey;
1187
+ openbookV2ProgramId: PublicKey;
1188
+ openbookV2Market: PublicKey;
1189
+ openbookV2MarketAuthority: PublicKey;
1190
+ openbookV2EventHeap: PublicKey;
1191
+ openbookV2Bids: PublicKey;
1192
+ openbookV2Asks: PublicKey;
1193
+ openbookV2BaseVault: PublicKey;
1194
+ openbookV2QuoteVault: PublicKey;
1195
+ marketIndex: number;
1196
+ fulfillmentType: SpotFulfillmentType;
1197
+ status: SpotFulfillmentStatus;
1198
+ // not actually on the account, just used to pass around remaining accounts in ts
1199
+ remainingAccounts?: PublicKey[];
1200
+ };
1201
+
1181
1202
  export type ReferrerNameAccount = {
1182
1203
  name: number[];
1183
1204
  user: PublicKey;
package/src/user.ts CHANGED
@@ -31,10 +31,12 @@ import {
31
31
  QUOTE_PRECISION_EXP,
32
32
  QUOTE_SPOT_MARKET_INDEX,
33
33
  SPOT_MARKET_WEIGHT_PRECISION,
34
+ GOV_SPOT_MARKET_INDEX,
34
35
  TEN,
35
36
  TEN_THOUSAND,
36
37
  TWO,
37
38
  ZERO,
39
+ FUEL_START_TS,
38
40
  } from './constants/numericConstants';
39
41
  import {
40
42
  DataAndSlot,
@@ -88,7 +90,11 @@ import { calculateLiveOracleTwap } from './math/oracles';
88
90
  import { getPerpMarketTierNumber, getSpotMarketTierNumber } from './math/tiers';
89
91
  import { StrictOraclePrice } from './oracles/strictOraclePrice';
90
92
 
91
- import { calculateSpotFuelBonus, calculatePerpFuelBonus } from './math/fuel';
93
+ import {
94
+ calculateSpotFuelBonus,
95
+ calculatePerpFuelBonus,
96
+ calculateInsuranceFuelBonus,
97
+ } from './math/fuel';
92
98
 
93
99
  export class User {
94
100
  driftClient: DriftClient;
@@ -880,15 +886,17 @@ export class User {
880
886
  includeSettled = true,
881
887
  includeUnsettled = true
882
888
  ): {
883
- depositFuel;
884
- borrowFuel;
885
- positionFuel;
886
- takerFuel;
887
- makerFuel;
889
+ depositFuel: BN;
890
+ borrowFuel: BN;
891
+ positionFuel: BN;
892
+ takerFuel: BN;
893
+ makerFuel: BN;
894
+ insuranceFuel: BN;
888
895
  } {
889
896
  const userAccount: UserAccount = this.getUserAccount();
890
897
 
891
898
  const result = {
899
+ insuranceFuel: ZERO,
892
900
  takerFuel: ZERO,
893
901
  makerFuel: ZERO,
894
902
  depositFuel: ZERO,
@@ -900,6 +908,9 @@ export class User {
900
908
  const userStats: UserStatsAccount = this.driftClient
901
909
  .getUserStats()
902
910
  .getAccount();
911
+ result.insuranceFuel = result.insuranceFuel.add(
912
+ new BN(userStats.fuelInsurance)
913
+ );
903
914
  result.takerFuel = result.takerFuel.add(new BN(userStats.fuelTaker));
904
915
  result.makerFuel = result.makerFuel.add(new BN(userStats.fuelMaker));
905
916
  result.depositFuel = result.depositFuel.add(
@@ -912,72 +923,125 @@ export class User {
912
923
  }
913
924
 
914
925
  if (includeUnsettled) {
915
- const fuelBonusNumerator = now.sub(userAccount.lastFuelBonusUpdateTs);
916
- for (const spotPosition of this.getActiveSpotPositions()) {
917
- const spotMarketAccount: SpotMarketAccount =
918
- this.driftClient.getSpotMarketAccount(spotPosition.marketIndex);
926
+ const fuelBonusNumerator = BN.max(
927
+ now.sub(
928
+ BN.max(new BN(userAccount.lastFuelBonusUpdateTs), FUEL_START_TS)
929
+ ),
930
+ ZERO
931
+ );
919
932
 
920
- const tokenAmount = this.getTokenAmount(spotPosition.marketIndex);
921
- const oraclePriceData = this.getOracleDataForSpotMarket(
922
- spotPosition.marketIndex
923
- );
933
+ if (fuelBonusNumerator.gt(ZERO)) {
934
+ for (const spotPosition of this.getActiveSpotPositions()) {
935
+ const spotMarketAccount: SpotMarketAccount =
936
+ this.driftClient.getSpotMarketAccount(spotPosition.marketIndex);
924
937
 
925
- const twap5min = calculateLiveOracleTwap(
926
- spotMarketAccount.historicalOracleData,
927
- oraclePriceData,
928
- now,
929
- FIVE_MINUTE // 5MIN
930
- );
931
- const strictOraclePrice = new StrictOraclePrice(
932
- oraclePriceData.price,
933
- twap5min
934
- );
938
+ const tokenAmount = this.getTokenAmount(spotPosition.marketIndex);
939
+ const oraclePriceData = this.getOracleDataForSpotMarket(
940
+ spotPosition.marketIndex
941
+ );
935
942
 
936
- const signedTokenValue = getStrictTokenValue(
937
- tokenAmount,
938
- spotMarketAccount.decimals,
939
- strictOraclePrice
940
- );
943
+ const twap5min = calculateLiveOracleTwap(
944
+ spotMarketAccount.historicalOracleData,
945
+ oraclePriceData,
946
+ now,
947
+ FIVE_MINUTE // 5MIN
948
+ );
949
+ const strictOraclePrice = new StrictOraclePrice(
950
+ oraclePriceData.price,
951
+ twap5min
952
+ );
941
953
 
942
- if (signedTokenValue.gt(ZERO)) {
943
- result.depositFuel = result.depositFuel.add(
944
- calculateSpotFuelBonus(
945
- spotMarketAccount,
946
- signedTokenValue,
947
- fuelBonusNumerator
948
- )
954
+ const signedTokenValue = getStrictTokenValue(
955
+ tokenAmount,
956
+ spotMarketAccount.decimals,
957
+ strictOraclePrice
949
958
  );
950
- } else {
951
- result.borrowFuel = result.borrowFuel.add(
952
- calculateSpotFuelBonus(
953
- spotMarketAccount,
954
- signedTokenValue,
959
+
960
+ if (signedTokenValue.gt(ZERO)) {
961
+ result.depositFuel = result.depositFuel.add(
962
+ calculateSpotFuelBonus(
963
+ spotMarketAccount,
964
+ signedTokenValue,
965
+ fuelBonusNumerator
966
+ )
967
+ );
968
+ } else {
969
+ result.borrowFuel = result.borrowFuel.add(
970
+ calculateSpotFuelBonus(
971
+ spotMarketAccount,
972
+ signedTokenValue,
973
+ fuelBonusNumerator
974
+ )
975
+ );
976
+ }
977
+ }
978
+
979
+ for (const perpPosition of this.getActivePerpPositions()) {
980
+ const oraclePriceData = this.getOracleDataForPerpMarket(
981
+ perpPosition.marketIndex
982
+ );
983
+
984
+ const perpMarketAccount = this.driftClient.getPerpMarketAccount(
985
+ perpPosition.marketIndex
986
+ );
987
+
988
+ const baseAssetValue = this.getPerpPositionValue(
989
+ perpPosition.marketIndex,
990
+ oraclePriceData,
991
+ false
992
+ );
993
+
994
+ result.positionFuel = result.positionFuel.add(
995
+ calculatePerpFuelBonus(
996
+ perpMarketAccount,
997
+ baseAssetValue,
955
998
  fuelBonusNumerator
956
999
  )
957
1000
  );
958
1001
  }
959
1002
  }
960
1003
 
961
- for (const perpPosition of this.getActivePerpPositions()) {
962
- const oraclePriceData = this.getOracleDataForPerpMarket(
963
- perpPosition.marketIndex
1004
+ const userStats: UserStatsAccount = this.driftClient
1005
+ .getUserStats()
1006
+ .getAccount();
1007
+
1008
+ // todo: get real time ifStakedGovTokenAmount using ifStakeAccount
1009
+ if (userStats.ifStakedGovTokenAmount.gt(ZERO)) {
1010
+ const spotMarketAccount: SpotMarketAccount =
1011
+ this.driftClient.getSpotMarketAccount(GOV_SPOT_MARKET_INDEX);
1012
+
1013
+ const fuelBonusNumeratorUserStats = BN.max(
1014
+ now.sub(
1015
+ BN.max(new BN(userStats.lastFuelIfBonusUpdateTs), FUEL_START_TS)
1016
+ ),
1017
+ ZERO
964
1018
  );
965
1019
 
966
- const perpMarketAccount = this.driftClient.getPerpMarketAccount(
967
- perpPosition.marketIndex
1020
+ result.insuranceFuel = result.insuranceFuel.add(
1021
+ calculateInsuranceFuelBonus(
1022
+ spotMarketAccount,
1023
+ userStats.ifStakedGovTokenAmount,
1024
+ fuelBonusNumeratorUserStats
1025
+ )
968
1026
  );
1027
+ }
969
1028
 
970
- const baseAssetValue = this.getPerpPositionValue(
971
- perpPosition.marketIndex,
972
- oraclePriceData,
973
- false
1029
+ if (userStats.ifStakedQuoteAssetAmount.gt(ZERO)) {
1030
+ const spotMarketAccount: SpotMarketAccount =
1031
+ this.driftClient.getSpotMarketAccount(QUOTE_SPOT_MARKET_INDEX);
1032
+
1033
+ const fuelBonusNumeratorUserStats = BN.max(
1034
+ now.sub(
1035
+ BN.max(new BN(userStats.lastFuelIfBonusUpdateTs), FUEL_START_TS)
1036
+ ),
1037
+ ZERO
974
1038
  );
975
1039
 
976
- result.positionFuel = result.positionFuel.add(
977
- calculatePerpFuelBonus(
978
- perpMarketAccount,
979
- baseAssetValue,
980
- fuelBonusNumerator
1040
+ result.insuranceFuel = result.insuranceFuel.add(
1041
+ calculateInsuranceFuelBonus(
1042
+ spotMarketAccount,
1043
+ userStats.ifStakedQuoteAssetAmount,
1044
+ fuelBonusNumeratorUserStats
981
1045
  )
982
1046
  );
983
1047
  }
@@ -0,0 +1,214 @@
1
+ import {
2
+ DriftClient,
3
+ DevnetSpotMarkets,
4
+ MainnetSpotMarkets,
5
+ DevnetPerpMarkets,
6
+ MainnetPerpMarkets,
7
+ BulkAccountLoader,
8
+ getVariant,
9
+ } from '../../src';
10
+ import { Connection, Keypair } from '@solana/web3.js';
11
+ import { Wallet } from '@coral-xyz/anchor';
12
+ import dotenv from 'dotenv';
13
+ import { assert } from 'chai';
14
+
15
+ dotenv.config();
16
+
17
+ describe('Verify Constants', function () {
18
+ this.timeout(100_000);
19
+ const MAINNET_RPC_ENDPOINT = process.env.MAINNET_RPC_ENDPOINT;
20
+ const DEVNET_RPC_ENDPOINT = process.env.DEVNET_RPC_ENDPOINT;
21
+
22
+ if (MAINNET_RPC_ENDPOINT === undefined) {
23
+ throw new Error('MAINNET_RPC_ENDPOINT not found in .env');
24
+ }
25
+
26
+ if (DEVNET_RPC_ENDPOINT === undefined) {
27
+ throw new Error('DEVNET_RPC_ENDPOINT not found in .env');
28
+ }
29
+
30
+ const wallet = new Wallet(Keypair.generate());
31
+
32
+ const devnetConnection = new Connection(DEVNET_RPC_ENDPOINT);
33
+ const mainnetConnection = new Connection(MAINNET_RPC_ENDPOINT);
34
+
35
+ const devnetBulkAccountLoader = new BulkAccountLoader(
36
+ devnetConnection,
37
+ 'processed',
38
+ 1
39
+ );
40
+
41
+ const mainnetBulkAccountLoader = new BulkAccountLoader(
42
+ mainnetConnection,
43
+ 'processed',
44
+ 1
45
+ );
46
+
47
+ const devnetDriftClient = new DriftClient({
48
+ connection: devnetConnection,
49
+ wallet,
50
+ env: 'devnet',
51
+ accountSubscription: {
52
+ type: 'polling',
53
+ accountLoader: devnetBulkAccountLoader,
54
+ },
55
+ });
56
+
57
+ const mainnetDriftClient = new DriftClient({
58
+ connection: mainnetConnection,
59
+ wallet,
60
+ env: 'mainnet-beta',
61
+ accountSubscription: {
62
+ type: 'polling',
63
+ accountLoader: mainnetBulkAccountLoader,
64
+ },
65
+ });
66
+
67
+ before(async () => {
68
+ await devnetDriftClient.subscribe();
69
+ await mainnetDriftClient.subscribe();
70
+ });
71
+
72
+ after(async () => {
73
+ await devnetDriftClient.unsubscribe();
74
+ await mainnetDriftClient.unsubscribe();
75
+ });
76
+
77
+ it('has all mainnet markets', async () => {
78
+ const spotMarkets = mainnetDriftClient.getSpotMarketAccounts();
79
+ spotMarkets.sort((a, b) => a.marketIndex - b.marketIndex);
80
+
81
+ for (const market of spotMarkets) {
82
+ const correspondingConfigMarket = MainnetSpotMarkets.find(
83
+ (configMarket) => configMarket.marketIndex === market.marketIndex
84
+ );
85
+ assert(
86
+ correspondingConfigMarket !== undefined,
87
+ `Market ${
88
+ market.marketIndex
89
+ } not found in MainnetSpotMarkets. market: ${market.pubkey.toBase58()}`
90
+ );
91
+ assert(
92
+ correspondingConfigMarket.oracle.toBase58() == market.oracle.toBase58(),
93
+ `Oracle mismatch for mainnet spot market ${
94
+ market.marketIndex
95
+ }, market: ${market.pubkey.toBase58()}, constants: ${correspondingConfigMarket.oracle.toBase58()}, chain: ${market.oracle.toBase58()}`
96
+ );
97
+ assert(
98
+ getVariant(correspondingConfigMarket.oracleSource) ===
99
+ getVariant(market.oracleSource),
100
+ `Oracle source mismatch for mainnet spot market ${
101
+ market.marketIndex
102
+ }, market: ${market.pubkey.toBase58()}, constants: ${getVariant(
103
+ correspondingConfigMarket.oracleSource
104
+ )}, chain: ${getVariant(market.oracleSource)}`
105
+ );
106
+ assert(
107
+ correspondingConfigMarket.mint.toBase58() === market.mint.toBase58(),
108
+ `Mint mismatch for mainnet spot market ${
109
+ market.marketIndex
110
+ }, market: ${market.pubkey.toBase58()}, constants: ${correspondingConfigMarket.mint.toBase58()}, chain: ${market.mint.toBase58()}`
111
+ );
112
+ }
113
+
114
+ const perpMarkets = mainnetDriftClient.getPerpMarketAccounts();
115
+ perpMarkets.sort((a, b) => a.marketIndex - b.marketIndex);
116
+
117
+ for (const market of perpMarkets) {
118
+ const correspondingConfigMarket = MainnetPerpMarkets.find(
119
+ (configMarket) => configMarket.marketIndex === market.marketIndex
120
+ );
121
+ assert(
122
+ correspondingConfigMarket !== undefined,
123
+ `Market ${
124
+ market.marketIndex
125
+ } not found in MainnetPerpMarkets, market: ${market.pubkey.toBase58()}`
126
+ );
127
+ assert(
128
+ correspondingConfigMarket.oracle.toBase58() ==
129
+ market.amm.oracle.toBase58(),
130
+ `Oracle mismatch for mainnet perp market ${
131
+ market.marketIndex
132
+ }, market: ${market.pubkey.toBase58()}, constants: ${correspondingConfigMarket.oracle.toBase58()}, chain: ${market.amm.oracle.toBase58()}`
133
+ );
134
+ assert(
135
+ getVariant(correspondingConfigMarket.oracleSource) ===
136
+ getVariant(market.amm.oracleSource),
137
+ `Oracle source mismatch for mainnet perp market ${
138
+ market.marketIndex
139
+ }, market: ${market.pubkey.toBase58()}, constants: ${getVariant(
140
+ correspondingConfigMarket.oracleSource
141
+ )}, chain: ${getVariant(market.amm.oracleSource)}`
142
+ );
143
+ }
144
+ });
145
+
146
+ it('has all devnet markets', async () => {
147
+ const spotMarkets = devnetDriftClient.getSpotMarketAccounts();
148
+ spotMarkets.sort((a, b) => a.marketIndex - b.marketIndex);
149
+
150
+ for (const market of spotMarkets) {
151
+ const correspondingConfigMarket = DevnetSpotMarkets.find(
152
+ (configMarket) => configMarket.marketIndex === market.marketIndex
153
+ );
154
+ assert(
155
+ correspondingConfigMarket !== undefined,
156
+ `Market ${
157
+ market.marketIndex
158
+ } not found in DevnetSpotMarkets, market: ${market.pubkey.toBase58()}`
159
+ );
160
+ assert(
161
+ correspondingConfigMarket.oracle.toBase58() == market.oracle.toBase58(),
162
+ `Oracle mismatch for devnet spot market ${
163
+ market.marketIndex
164
+ }, market: ${market.pubkey.toBase58()}, constants: ${correspondingConfigMarket.oracle.toBase58()}, chain: ${market.oracle.toBase58()}`
165
+ );
166
+ assert(
167
+ getVariant(correspondingConfigMarket.oracleSource) ===
168
+ getVariant(market.oracleSource),
169
+ `Oracle source mismatch for devnet spot market ${
170
+ market.marketIndex
171
+ }, market: ${market.pubkey.toBase58()}, constants: ${getVariant(
172
+ correspondingConfigMarket.oracleSource
173
+ )}, chain: ${getVariant(market.oracleSource)}`
174
+ );
175
+ assert(
176
+ correspondingConfigMarket.mint.toBase58() === market.mint.toBase58(),
177
+ `Mint mismatch for devnet spot market ${
178
+ market.marketIndex
179
+ }, market: ${market.pubkey.toBase58()}, constants: ${correspondingConfigMarket.mint.toBase58()}, chain: ${market.mint.toBase58()}`
180
+ );
181
+ }
182
+
183
+ const perpMarkets = devnetDriftClient.getPerpMarketAccounts();
184
+ perpMarkets.sort((a, b) => a.marketIndex - b.marketIndex);
185
+
186
+ for (const market of perpMarkets) {
187
+ const correspondingConfigMarket = DevnetPerpMarkets.find(
188
+ (configMarket) => configMarket.marketIndex === market.marketIndex
189
+ );
190
+ assert(
191
+ correspondingConfigMarket !== undefined,
192
+ `Market ${
193
+ market.marketIndex
194
+ } not found in DevnetPerpMarkets, market: ${market.pubkey.toBase58()}`
195
+ );
196
+ assert(
197
+ correspondingConfigMarket.oracle.toBase58() ==
198
+ market.amm.oracle.toBase58(),
199
+ `Oracle mismatch for devnet perp market ${
200
+ market.marketIndex
201
+ }, market: ${market.pubkey.toBase58()}, constants: ${correspondingConfigMarket.oracle.toBase58()}, chain: ${market.amm.oracle.toBase58()}`
202
+ );
203
+ assert(
204
+ getVariant(correspondingConfigMarket.oracleSource) ===
205
+ getVariant(market.amm.oracleSource),
206
+ `Oracle source mismatch for devnet perp market ${
207
+ market.marketIndex
208
+ }, market: ${market.pubkey.toBase58()}, constants: ${getVariant(
209
+ correspondingConfigMarket.oracleSource
210
+ )}, chain: ${getVariant(market.amm.oracleSource)}`
211
+ );
212
+ }
213
+ });
214
+ });
@@ -187,6 +187,9 @@ export const mockPerpMarkets: Array<PerpMarketAccount> = [
187
187
  quoteSpotMarketIndex: 0,
188
188
  feeAdjustment: 0,
189
189
  pausedOperations: 0,
190
+ fuelBoostPosition: 0,
191
+ fuelBoostMaker: 0,
192
+ fuelBoostTaker: 0,
190
193
  },
191
194
  {
192
195
  status: MarketStatus.INITIALIZED,
@@ -226,6 +229,9 @@ export const mockPerpMarkets: Array<PerpMarketAccount> = [
226
229
  quoteSpotMarketIndex: 0,
227
230
  feeAdjustment: 0,
228
231
  pausedOperations: 0,
232
+ fuelBoostPosition: 0,
233
+ fuelBoostMaker: 0,
234
+ fuelBoostTaker: 0,
229
235
  },
230
236
  {
231
237
  status: MarketStatus.INITIALIZED,
@@ -265,6 +271,9 @@ export const mockPerpMarkets: Array<PerpMarketAccount> = [
265
271
  quoteSpotMarketIndex: 0,
266
272
  feeAdjustment: 0,
267
273
  pausedOperations: 0,
274
+ fuelBoostPosition: 0,
275
+ fuelBoostMaker: 0,
276
+ fuelBoostTaker: 0,
268
277
  },
269
278
  ];
270
279
 
@@ -351,6 +360,13 @@ export const mockSpotMarkets: Array<SpotMarketAccount> = [
351
360
  },
352
361
  pausedOperations: 0,
353
362
  ifPausedOperations: 0,
363
+ maxTokenBorrowsFraction: 0,
364
+ minBorrowRate: 0,
365
+ fuelBoostDeposits: 0,
366
+ fuelBoostBorrows: 0,
367
+ fuelBoostTaker: 0,
368
+ fuelBoostMaker: 0,
369
+ fuelBoostInsurance: 0,
354
370
  },
355
371
  {
356
372
  status: MarketStatus.ACTIVE,
@@ -434,6 +450,13 @@ export const mockSpotMarkets: Array<SpotMarketAccount> = [
434
450
  },
435
451
  pausedOperations: 0,
436
452
  ifPausedOperations: 0,
453
+ maxTokenBorrowsFraction: 0,
454
+ minBorrowRate: 0,
455
+ fuelBoostDeposits: 0,
456
+ fuelBoostBorrows: 0,
457
+ fuelBoostTaker: 0,
458
+ fuelBoostMaker: 0,
459
+ fuelBoostInsurance: 0,
437
460
  },
438
461
  {
439
462
  status: MarketStatus.ACTIVE,
@@ -517,6 +540,13 @@ export const mockSpotMarkets: Array<SpotMarketAccount> = [
517
540
  },
518
541
  pausedOperations: 0,
519
542
  ifPausedOperations: 0,
543
+ maxTokenBorrowsFraction: 0,
544
+ minBorrowRate: 0,
545
+ fuelBoostDeposits: 0,
546
+ fuelBoostBorrows: 0,
547
+ fuelBoostTaker: 0,
548
+ fuelBoostMaker: 0,
549
+ fuelBoostInsurance: 0,
520
550
  },
521
551
  ];
522
552
 
@@ -85,4 +85,5 @@ export const mockUserAccount: UserAccount = {
85
85
  hasOpenOrder: false,
86
86
  openAuctions: 0,
87
87
  hasOpenAuction: false,
88
+ lastFuelBonusUpdateTs: 0,
88
89
  };
@@ -35,6 +35,8 @@ async function makeMockUser(
35
35
  const mockUser: User = await umap.mustGet('1');
36
36
  mockUser._isSubscribed = true;
37
37
  mockUser.driftClient._isSubscribed = true;
38
+ mockUser.driftClient.accountSubscriber.isSubscribed = true;
39
+
38
40
  const oraclePriceMap = {};
39
41
  // console.log(perpOraclePriceList, myMockPerpMarkets.length);
40
42
  // console.log(spotOraclePriceList, myMockSpotMarkets.length);