@drift-labs/sdk 2.86.0-beta.3 → 2.86.0-beta.31

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 (42) 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 -0
  5. package/lib/adminClient.js +79 -0
  6. package/lib/bankrun/bankrunConnection.d.ts +1 -0
  7. package/lib/bankrun/bankrunConnection.js +6 -0
  8. package/lib/constants/numericConstants.d.ts +3 -0
  9. package/lib/constants/numericConstants.js +4 -1
  10. package/lib/constants/perpMarkets.js +142 -118
  11. package/lib/constants/spotMarkets.js +50 -38
  12. package/lib/driftClient.d.ts +12 -14
  13. package/lib/driftClient.js +144 -9
  14. package/lib/idl/drift.json +551 -4
  15. package/lib/idl/pyth_solana_receiver.json +628 -0
  16. package/lib/index.d.ts +1 -0
  17. package/lib/index.js +1 -0
  18. package/lib/math/fuel.d.ts +6 -0
  19. package/lib/math/fuel.js +55 -0
  20. package/lib/types.d.ts +35 -2
  21. package/lib/types.js +3 -2
  22. package/lib/user.d.ts +8 -0
  23. package/lib/user.js +64 -0
  24. package/package.json +1 -1
  25. package/src/addresses/pda.ts +15 -0
  26. package/src/adminClient.ts +208 -0
  27. package/src/bankrun/bankrunConnection.ts +13 -0
  28. package/src/constants/numericConstants.ts +4 -0
  29. package/src/constants/perpMarkets.ts +146 -118
  30. package/src/constants/spotMarkets.ts +52 -38
  31. package/src/driftClient.ts +197 -16
  32. package/src/idl/drift.json +551 -4
  33. package/src/idl/openbook.json +3854 -0
  34. package/src/idl/pyth_solana_receiver.json +628 -0
  35. package/src/index.ts +1 -0
  36. package/src/math/fuel.ts +70 -0
  37. package/src/types.ts +42 -2
  38. package/src/user.ts +177 -0
  39. package/tests/ci/verifyConstants.ts +214 -0
  40. package/tests/dlob/helpers.ts +30 -0
  41. package/tests/user/helpers.ts +1 -0
  42. 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 {
@@ -636,6 +637,10 @@ export type PerpMarketAccount = {
636
637
  quoteSpotMarketIndex: number;
637
638
  feeAdjustment: number;
638
639
  pausedOperations: number;
640
+
641
+ fuelBoostTaker: number;
642
+ fuelBoostMaker: number;
643
+ fuelBoostPosition: number;
639
644
  };
640
645
 
641
646
  export type HistoricalOracleData = {
@@ -734,6 +739,12 @@ export type SpotMarketAccount = {
734
739
 
735
740
  maxTokenBorrowsFraction: number;
736
741
  minBorrowRate: number;
742
+
743
+ fuelBoostDeposits: number;
744
+ fuelBoostBorrows: number;
745
+ fuelBoostTaker: number;
746
+ fuelBoostMaker: number;
747
+ fuelBoostInsurance: number;
737
748
  };
738
749
 
739
750
  export type PoolBalance = {
@@ -876,6 +887,17 @@ export type UserStatsAccount = {
876
887
  isReferrer: boolean;
877
888
  authority: PublicKey;
878
889
  ifStakedQuoteAssetAmount: BN;
890
+
891
+ lastFuelIfBonusUpdateTs: number; // u32 onchain
892
+
893
+ fuelInsurance: number;
894
+ fuelDeposits: number;
895
+ fuelBorrows: number;
896
+ fuelPositions: number;
897
+ fuelTaker: number;
898
+ fuelMaker: number;
899
+
900
+ ifStakedGovTokenAmount: BN;
879
901
  };
880
902
 
881
903
  export type UserAccount = {
@@ -905,6 +927,7 @@ export type UserAccount = {
905
927
  hasOpenOrder: boolean;
906
928
  openAuctions: number;
907
929
  hasOpenAuction: boolean;
930
+ lastFuelBonusUpdateTs: number;
908
931
  };
909
932
 
910
933
  export type SpotPosition = {
@@ -1159,6 +1182,23 @@ export type PhoenixV1FulfillmentConfigAccount = {
1159
1182
  status: SpotFulfillmentStatus;
1160
1183
  };
1161
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
+
1162
1202
  export type ReferrerNameAccount = {
1163
1203
  name: number[];
1164
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,6 +90,12 @@ import { calculateLiveOracleTwap } from './math/oracles';
88
90
  import { getPerpMarketTierNumber, getSpotMarketTierNumber } from './math/tiers';
89
91
  import { StrictOraclePrice } from './oracles/strictOraclePrice';
90
92
 
93
+ import {
94
+ calculateSpotFuelBonus,
95
+ calculatePerpFuelBonus,
96
+ calculateInsuranceFuelBonus,
97
+ } from './math/fuel';
98
+
91
99
  export class User {
92
100
  driftClient: DriftClient;
93
101
  userAccountPublicKey: PublicKey;
@@ -873,6 +881,175 @@ export class User {
873
881
  }, ZERO);
874
882
  }
875
883
 
884
+ public getFuelBonus(
885
+ now: BN,
886
+ includeSettled = true,
887
+ includeUnsettled = true
888
+ ): {
889
+ depositFuel: BN;
890
+ borrowFuel: BN;
891
+ positionFuel: BN;
892
+ takerFuel: BN;
893
+ makerFuel: BN;
894
+ insuranceFuel: BN;
895
+ } {
896
+ const userAccount: UserAccount = this.getUserAccount();
897
+
898
+ const result = {
899
+ insuranceFuel: ZERO,
900
+ takerFuel: ZERO,
901
+ makerFuel: ZERO,
902
+ depositFuel: ZERO,
903
+ borrowFuel: ZERO,
904
+ positionFuel: ZERO,
905
+ };
906
+
907
+ if (includeSettled) {
908
+ const userStats: UserStatsAccount = this.driftClient
909
+ .getUserStats()
910
+ .getAccount();
911
+ result.insuranceFuel = result.insuranceFuel.add(
912
+ new BN(userStats.fuelInsurance)
913
+ );
914
+ result.takerFuel = result.takerFuel.add(new BN(userStats.fuelTaker));
915
+ result.makerFuel = result.makerFuel.add(new BN(userStats.fuelMaker));
916
+ result.depositFuel = result.depositFuel.add(
917
+ new BN(userStats.fuelDeposits)
918
+ );
919
+ result.borrowFuel = result.borrowFuel.add(new BN(userStats.fuelBorrows));
920
+ result.positionFuel = result.positionFuel.add(
921
+ new BN(userStats.fuelPositions)
922
+ );
923
+ }
924
+
925
+ if (includeUnsettled) {
926
+ const fuelBonusNumerator = BN.max(
927
+ now.sub(
928
+ BN.max(new BN(userAccount.lastFuelBonusUpdateTs), FUEL_START_TS)
929
+ ),
930
+ ZERO
931
+ );
932
+
933
+ if (fuelBonusNumerator.gt(ZERO)) {
934
+ for (const spotPosition of this.getActiveSpotPositions()) {
935
+ const spotMarketAccount: SpotMarketAccount =
936
+ this.driftClient.getSpotMarketAccount(spotPosition.marketIndex);
937
+
938
+ const tokenAmount = this.getTokenAmount(spotPosition.marketIndex);
939
+ const oraclePriceData = this.getOracleDataForSpotMarket(
940
+ spotPosition.marketIndex
941
+ );
942
+
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
+ );
953
+
954
+ const signedTokenValue = getStrictTokenValue(
955
+ tokenAmount,
956
+ spotMarketAccount.decimals,
957
+ strictOraclePrice
958
+ );
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,
998
+ fuelBonusNumerator
999
+ )
1000
+ );
1001
+ }
1002
+ }
1003
+
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
1018
+ );
1019
+
1020
+ result.insuranceFuel = result.insuranceFuel.add(
1021
+ calculateInsuranceFuelBonus(
1022
+ spotMarketAccount,
1023
+ userStats.ifStakedGovTokenAmount,
1024
+ fuelBonusNumeratorUserStats
1025
+ )
1026
+ );
1027
+ }
1028
+
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
1038
+ );
1039
+
1040
+ result.insuranceFuel = result.insuranceFuel.add(
1041
+ calculateInsuranceFuelBonus(
1042
+ spotMarketAccount,
1043
+ userStats.ifStakedQuoteAssetAmount,
1044
+ fuelBonusNumeratorUserStats
1045
+ )
1046
+ );
1047
+ }
1048
+ }
1049
+
1050
+ return result;
1051
+ }
1052
+
876
1053
  public getSpotMarketAssetAndLiabilityValue(
877
1054
  marketIndex?: number,
878
1055
  marginCategory?: MarginCategory,
@@ -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);