@strkfarm/sdk 2.0.0-staging.71 → 2.0.0-staging.72

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strkfarm/sdk",
3
- "version": "2.0.0-staging.71",
3
+ "version": "2.0.0-staging.72",
4
4
  "description": "STRKFarm TS SDK (Meant for our internal use, but feel free to use it)",
5
5
  "typings": "dist/index.d.ts",
6
6
  "types": "dist/index.d.ts",
package/src/global.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import axios from 'axios';
2
- import { TokenInfo } from './interfaces';
2
+ import { TokenIndexingType, TokenInfo } from './interfaces';
3
3
  import { ContractAddr } from './dataTypes';
4
4
  import { logger } from '@/utils/logger';
5
5
 
@@ -23,7 +23,8 @@ const defaultTokens: TokenInfo[] = [{
23
23
  coingeckId: 'starknet',
24
24
  displayDecimals: 2,
25
25
  priceCheckAmount: 5000,
26
- priceMethod: 'Avnu'
26
+ priceMethod: 'Avnu',
27
+ indexingType: TokenIndexingType.INDEXER,
27
28
  }, {
28
29
  name: 'xSTRK',
29
30
  symbol: 'xSTRK',
@@ -33,7 +34,8 @@ const defaultTokens: TokenInfo[] = [{
33
34
  coingeckId: undefined,
34
35
  priceCheckAmount: 5000,
35
36
  displayDecimals: 2,
36
- priceMethod: 'Avnu'
37
+ priceMethod: 'Avnu',
38
+ indexingType: TokenIndexingType.LST_SCRIPT,
37
39
  }, {
38
40
  name: 'ETH',
39
41
  symbol: 'ETH',
@@ -43,6 +45,7 @@ const defaultTokens: TokenInfo[] = [{
43
45
  coingeckId: undefined,
44
46
  priceCheckAmount: 0.1,
45
47
  displayDecimals: 6,
48
+ indexingType: TokenIndexingType.INDEXER,
46
49
  }, {
47
50
  name: 'USDC.e',
48
51
  symbol: 'USDC.e',
@@ -52,6 +55,8 @@ const defaultTokens: TokenInfo[] = [{
52
55
  coingeckId: undefined,
53
56
  displayDecimals: 2,
54
57
  priceCheckAmount: 1000,
58
+ priceProxySymbol: 'USDC',
59
+ indexingType: TokenIndexingType.PEGGED,
55
60
  }, {
56
61
  name: 'USDC',
57
62
  symbol: 'USDC',
@@ -61,6 +66,7 @@ const defaultTokens: TokenInfo[] = [{
61
66
  coingeckId: undefined,
62
67
  displayDecimals: 2,
63
68
  priceCheckAmount: 1000,
69
+ indexingType: TokenIndexingType.INDEXER,
64
70
  }, {
65
71
  name: 'USDT',
66
72
  symbol: 'USDT',
@@ -70,6 +76,7 @@ const defaultTokens: TokenInfo[] = [{
70
76
  coingeckId: undefined,
71
77
  priceCheckAmount: 1000,
72
78
  displayDecimals: 2,
79
+ indexingType: TokenIndexingType.INDEXER,
73
80
  }, {
74
81
  name: 'WBTC',
75
82
  symbol: 'WBTC',
@@ -79,6 +86,7 @@ const defaultTokens: TokenInfo[] = [{
79
86
  coingeckId: undefined,
80
87
  displayDecimals: 6,
81
88
  priceCheckAmount: 0.001, // 112000 * 0.0001 = $110.2
89
+ indexingType: TokenIndexingType.INDEXER,
82
90
  }, {
83
91
  name: 'tBTC',
84
92
  symbol: 'tBTC',
@@ -88,6 +96,8 @@ const defaultTokens: TokenInfo[] = [{
88
96
  coingeckId: undefined,
89
97
  displayDecimals: 6,
90
98
  priceCheckAmount: 0.001, // 112000 * 0.0001 = $110.2
99
+ priceProxySymbol: 'WBTC',
100
+ indexingType: TokenIndexingType.PEGGED,
91
101
  }, {
92
102
  name: 'solvBTC',
93
103
  symbol: 'solvBTC',
@@ -98,6 +108,7 @@ const defaultTokens: TokenInfo[] = [{
98
108
  priceProxySymbol: 'WBTC',
99
109
  displayDecimals: 6,
100
110
  priceCheckAmount: 0.0001, // 112000 * 0.0001 = $11.2
111
+ indexingType: TokenIndexingType.PEGGED,
101
112
  }, {
102
113
  name: 'LBTC',
103
114
  symbol: 'LBTC',
@@ -108,6 +119,7 @@ const defaultTokens: TokenInfo[] = [{
108
119
  displayDecimals: 6,
109
120
  priceProxySymbol: 'WBTC',
110
121
  priceCheckAmount: 0.0001, // 112000 * 0.0001 = $11.2
122
+ indexingType: TokenIndexingType.PEGGED,
111
123
  }, {
112
124
  name: 'xWBTC',
113
125
  symbol: 'xWBTC',
@@ -117,7 +129,8 @@ const defaultTokens: TokenInfo[] = [{
117
129
  coingeckId: undefined,
118
130
  displayDecimals: 6,
119
131
  priceCheckAmount: 0.001, // 112000 * 0.0001 = $110.2
120
- priceMethod: 'Avnu'
132
+ priceMethod: 'Avnu',
133
+ indexingType: TokenIndexingType.LST_SCRIPT,
121
134
  }, {
122
135
  name: 'xsBTC',
123
136
  symbol: 'xsBTC',
@@ -127,7 +140,8 @@ const defaultTokens: TokenInfo[] = [{
127
140
  coingeckId: undefined,
128
141
  displayDecimals: 6,
129
142
  priceCheckAmount: 0.0001, // 112000 * 0.0001 = $11.2
130
- priceMethod: 'Avnu'
143
+ priceMethod: 'Avnu',
144
+ indexingType: TokenIndexingType.LST_SCRIPT,
131
145
  }, {
132
146
  name: 'xtBTC',
133
147
  symbol: 'xtBTC',
@@ -137,7 +151,8 @@ const defaultTokens: TokenInfo[] = [{
137
151
  coingeckId: undefined,
138
152
  displayDecimals: 6,
139
153
  priceCheckAmount: 0.001, // 112000 * 0.0001 = $110.2
140
- priceMethod: 'Avnu'
154
+ priceMethod: 'Avnu',
155
+ indexingType: TokenIndexingType.LST_SCRIPT,
141
156
  }, {
142
157
  name: 'xLBTC',
143
158
  symbol: 'xLBTC',
@@ -147,7 +162,8 @@ const defaultTokens: TokenInfo[] = [{
147
162
  coingeckId: undefined,
148
163
  displayDecimals: 6,
149
164
  priceCheckAmount: 0.0001, // 112000 * 0.0001 = $11.2
150
- priceMethod: 'Avnu'
165
+ priceMethod: 'Avnu',
166
+ indexingType: TokenIndexingType.LST_SCRIPT,
151
167
  }, {
152
168
  name: 'mRe7BTC',
153
169
  symbol: 'mRe7BTC',
@@ -158,6 +174,7 @@ const defaultTokens: TokenInfo[] = [{
158
174
  displayDecimals: 6,
159
175
  priceCheckAmount: 0.0001, // 112000 * 0.0001 = $11.2
160
176
  dontPrice: true,
177
+ indexingType: TokenIndexingType.IGNORE,
161
178
  }, {
162
179
  name: 'mRe7YIELD',
163
180
  symbol: 'mRe7YIELD',
@@ -168,6 +185,7 @@ const defaultTokens: TokenInfo[] = [{
168
185
  displayDecimals: 2,
169
186
  priceCheckAmount: 100,
170
187
  dontPrice: true,
188
+ indexingType: TokenIndexingType.IGNORE,
171
189
  }, {
172
190
  name: "fyeWBTC",
173
191
  symbol: "fyeWBTC",
@@ -178,6 +196,7 @@ const defaultTokens: TokenInfo[] = [{
178
196
  displayDecimals: 6,
179
197
  priceCheckAmount: 0.001, // 112000 * 0.0001 = $110.2
180
198
  dontPrice: true,
199
+ indexingType: TokenIndexingType.IGNORE,
181
200
  }, {
182
201
  name: "fyETH",
183
202
  symbol: "fyETH",
@@ -188,6 +207,7 @@ const defaultTokens: TokenInfo[] = [{
188
207
  displayDecimals: 4,
189
208
  priceCheckAmount: 0.1,
190
209
  dontPrice: true,
210
+ indexingType: TokenIndexingType.IGNORE,
191
211
  }, {
192
212
  name: "fyeUSDC",
193
213
  symbol: "fyeUSDC",
@@ -198,6 +218,7 @@ const defaultTokens: TokenInfo[] = [{
198
218
  displayDecimals: 2,
199
219
  priceCheckAmount: 100,
200
220
  dontPrice: true,
221
+ indexingType: TokenIndexingType.IGNORE,
201
222
  }, {
202
223
  name: 'strkBTC',
203
224
  symbol: 'strkBTC',
@@ -207,7 +228,9 @@ const defaultTokens: TokenInfo[] = [{
207
228
  coingeckId: undefined,
208
229
  displayDecimals: 6,
209
230
  priceCheckAmount: 0.001, // 112000 * 0.0001 = $110.2
210
- priceMethod: 'Avnu'
231
+ priceMethod: 'Avnu',
232
+ priceProxySymbol: 'WBTC',
233
+ indexingType: TokenIndexingType.PEGGED,
211
234
  }, {
212
235
  name: 'xstrkBTC',
213
236
  symbol: 'xstrkBTC',
@@ -217,8 +240,9 @@ const defaultTokens: TokenInfo[] = [{
217
240
  coingeckId: undefined,
218
241
  displayDecimals: 6,
219
242
  priceCheckAmount: 0.001,
220
- priceMethod: 'Avnu'
221
- },]
243
+ priceMethod: 'Avnu',
244
+ indexingType: TokenIndexingType.LST_SCRIPT,
245
+ }];
222
246
  const tokens: TokenInfo[] = defaultTokens;
223
247
 
224
248
  /** Contains globally useful functions.
@@ -282,7 +306,8 @@ export class Global {
282
306
  decimals: token.decimals,
283
307
  logo: token.logoUri,
284
308
  coingeckId: token.extensions.coingeckoId,
285
- displayDecimals: 2
309
+ displayDecimals: 2,
310
+ indexingType: TokenIndexingType.IGNORE,
286
311
  });
287
312
  });
288
313
  console.log(tokens);
@@ -26,6 +26,12 @@ export interface RiskFactor {
26
26
  }
27
27
 
28
28
  export type PriceMethod = 'AvnuApi' | 'Coinbase' | 'Coinmarketcap' | 'Ekubo' | 'Avnu';
29
+ export enum TokenIndexingType {
30
+ PEGGED = "pegged",
31
+ INDEXER = "indexer",
32
+ LST_SCRIPT = "lstScript",
33
+ IGNORE = "ignore",
34
+ }
29
35
 
30
36
  export interface TokenInfo {
31
37
  name: string;
@@ -39,6 +45,7 @@ export interface TokenInfo {
39
45
  priceCheckAmount?: number; // for tokens like BTC, doing 1BTC price check may not be ideal, esp on illiquid netwrks like sn
40
46
  priceMethod?: PriceMethod; // preferred price source; tried first, then falls back to other methods
41
47
  dontPrice?: boolean; // a flag that skips pricer to check these tokens.
48
+ indexingType: TokenIndexingType;
42
49
  }
43
50
 
44
51
  export enum Network {
@@ -7,7 +7,8 @@ import { PriceInfo } from "./pricer";
7
7
  export class EkuboPricer extends PricerBase {
8
8
  EKUBO_PRICE_FETCHER_ADDRESS = '0x04946fb4ad5237d97bbb1256eba2080c4fe1de156da6a7f83e3b4823bb6d7da1';
9
9
  readonly contract: Contract;
10
- private readonly USDC_ADDRESS = '0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8';
10
+ // Updating to new USDC_ADDRESS
11
+ private readonly USDC_ADDRESS = '0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb';
11
12
  private readonly USDC_DECIMALS = 6;
12
13
 
13
14
  constructor(config: IConfig, tokens: TokenInfo[]) {
@@ -2,7 +2,7 @@ import axios from "axios";
2
2
  import BigNumber from "bignumber.js";
3
3
  import { Web3Number } from "@/dataTypes/bignumber.browser";
4
4
  import { FatalError, Global } from "@/global";
5
- import { TokenInfo } from "@/interfaces";
5
+ import { TokenIndexingType, TokenInfo } from "@/interfaces";
6
6
  import { ILending, ILendingPosition, LendingToken, MarginType } from "@/interfaces/lending";
7
7
  import { ContractAddr } from "@/dataTypes/address";
8
8
  import { IConfig } from "@/interfaces";
@@ -42,7 +42,8 @@ export class ZkLend extends ILending implements ILending {
42
42
  decimals: pool.token.decimals,
43
43
  borrowFactor: Web3Number.fromWei(pool.borrow_factor.value, pool.borrow_factor.decimals),
44
44
  collareralFactor,
45
- displayDecimals: 2
45
+ displayDecimals: 2,
46
+ indexingType: TokenIndexingType.IGNORE,
46
47
  }
47
48
  this.tokens.push(token);
48
49
  });
@@ -9,6 +9,7 @@ import {
9
9
  RiskFactor,
10
10
  SourceCodeType,
11
11
  StrategyLiveStatus,
12
+ TokenIndexingType,
12
13
  TokenInfo,
13
14
  UnwrapLabsCurator,
14
15
  VaultPosition,
@@ -875,6 +876,7 @@ const vesuPrimeUSDC: TokenInfo = {
875
876
  decimals: 18,
876
877
  logo: usdc.logo,
877
878
  displayDecimals: 2,
879
+ indexingType: TokenIndexingType.IGNORE,
878
880
  };
879
881
 
880
882
  const strk = Global.getDefaultTokens().find((t) => t.symbol === "STRK")!;