@defisaver/positions-sdk 0.0.99 → 0.0.100

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 (71) hide show
  1. package/README.md +63 -63
  2. package/cjs/config/contracts.d.ts +316 -14
  3. package/cjs/config/contracts.js +34 -12
  4. package/cjs/maker/index.js +1 -1
  5. package/cjs/types/contracts/generated/AaveV3View.d.ts +29 -2
  6. package/cjs/types/contracts/generated/SparkView.d.ts +29 -2
  7. package/esm/config/contracts.d.ts +316 -14
  8. package/esm/config/contracts.js +34 -12
  9. package/esm/maker/index.js +1 -1
  10. package/esm/types/contracts/generated/AaveV3View.d.ts +29 -2
  11. package/esm/types/contracts/generated/SparkView.d.ts +29 -2
  12. package/package.json +41 -40
  13. package/src/aaveV2/index.ts +227 -227
  14. package/src/aaveV3/index.ts +558 -558
  15. package/src/assets/index.ts +60 -60
  16. package/src/chickenBonds/index.ts +123 -123
  17. package/src/compoundV2/index.ts +219 -219
  18. package/src/compoundV3/index.ts +266 -266
  19. package/src/config/contracts.js +871 -848
  20. package/src/constants/index.ts +5 -5
  21. package/src/contracts.ts +128 -128
  22. package/src/curveUsd/index.ts +229 -229
  23. package/src/exchange/index.ts +17 -17
  24. package/src/helpers/aaveHelpers/index.ts +134 -134
  25. package/src/helpers/chickenBondsHelpers/index.ts +23 -23
  26. package/src/helpers/compoundHelpers/index.ts +181 -181
  27. package/src/helpers/curveUsdHelpers/index.ts +40 -40
  28. package/src/helpers/index.ts +7 -7
  29. package/src/helpers/llamaLendHelpers/index.ts +45 -45
  30. package/src/helpers/makerHelpers/index.ts +94 -94
  31. package/src/helpers/morphoBlueHelpers/index.ts +117 -117
  32. package/src/helpers/sparkHelpers/index.ts +106 -106
  33. package/src/index.ts +46 -46
  34. package/src/liquity/index.ts +116 -116
  35. package/src/llamaLend/index.ts +268 -268
  36. package/src/maker/index.ts +117 -117
  37. package/src/markets/aave/index.ts +80 -80
  38. package/src/markets/aave/marketAssets.ts +24 -24
  39. package/src/markets/compound/index.ts +142 -142
  40. package/src/markets/compound/marketsAssets.ts +50 -50
  41. package/src/markets/curveUsd/index.ts +69 -69
  42. package/src/markets/index.ts +5 -5
  43. package/src/markets/llamaLend/contractAddresses.ts +95 -95
  44. package/src/markets/llamaLend/index.ts +150 -150
  45. package/src/markets/morphoBlue/index.ts +611 -611
  46. package/src/markets/spark/index.ts +29 -29
  47. package/src/markets/spark/marketAssets.ts +10 -10
  48. package/src/moneymarket/moneymarketCommonService.ts +76 -76
  49. package/src/morphoAaveV2/index.ts +256 -256
  50. package/src/morphoAaveV3/index.ts +612 -612
  51. package/src/morphoBlue/index.ts +171 -171
  52. package/src/multicall/index.ts +22 -22
  53. package/src/services/dsrService.ts +15 -15
  54. package/src/services/priceService.ts +21 -21
  55. package/src/services/utils.ts +51 -51
  56. package/src/setup.ts +8 -8
  57. package/src/spark/index.ts +424 -424
  58. package/src/staking/staking.ts +187 -187
  59. package/src/types/aave.ts +256 -256
  60. package/src/types/chickenBonds.ts +45 -45
  61. package/src/types/common.ts +84 -84
  62. package/src/types/compound.ts +128 -128
  63. package/src/types/contracts/generated/AaveV3View.ts +43 -3
  64. package/src/types/contracts/generated/SparkView.ts +43 -3
  65. package/src/types/curveUsd.ts +118 -118
  66. package/src/types/index.ts +8 -8
  67. package/src/types/liquity.ts +30 -30
  68. package/src/types/llamaLend.ts +143 -143
  69. package/src/types/maker.ts +50 -50
  70. package/src/types/morphoBlue.ts +139 -139
  71. package/src/types/spark.ts +106 -106
@@ -29,7 +29,7 @@ const getMakerAccountBalances = (web3, network, block, addressMapping, cdpId, _m
29
29
  }
30
30
  const viewContract = (0, contracts_1.McdViewContract)(web3, network, block);
31
31
  let ilk;
32
- const needsIlk = new decimal_js_1.default(block).lt(14410792) && new decimal_js_1.default(block).gte(14384301);
32
+ const needsIlk = block !== 'latest' && new decimal_js_1.default(block).lt(14410792) && new decimal_js_1.default(block).gte(14384301);
33
33
  if (needsIlk) {
34
34
  ilk = (yield viewContract.methods.getUrnAndIlk(managerAddress, cdpId).call({}, block)).ilk;
35
35
  }
@@ -10,6 +10,30 @@ export interface EventOptions {
10
10
  topics?: string[];
11
11
  }
12
12
  export declare namespace AaveV3View {
13
+ type LiquidityChangeParamsStruct = [string, number | string | BN, number | string | BN] | {
14
+ reserveAddress: string;
15
+ liquidityAdded: number | string | BN;
16
+ liquidityTaken: number | string | BN;
17
+ };
18
+ type LiquidityChangeParamsStructOutputArray = [string, string, string];
19
+ type LiquidityChangeParamsStructOutputStruct = {
20
+ reserveAddress: string;
21
+ liquidityAdded: string;
22
+ liquidityTaken: string;
23
+ };
24
+ type LiquidityChangeParamsStructOutput = LiquidityChangeParamsStructOutputArray & LiquidityChangeParamsStructOutputStruct;
25
+ type EstimatedRatesStruct = [string, number | string | BN, number | string | BN] | {
26
+ reserveAddress: string;
27
+ supplyRate: number | string | BN;
28
+ variableBorrowRate: number | string | BN;
29
+ };
30
+ type EstimatedRatesStructOutputArray = [string, string, string];
31
+ type EstimatedRatesStructOutputStruct = {
32
+ reserveAddress: string;
33
+ supplyRate: string;
34
+ variableBorrowRate: string;
35
+ };
36
+ type EstimatedRatesStructOutput = EstimatedRatesStructOutputArray & EstimatedRatesStructOutputStruct;
13
37
  type TokenInfoFullStruct = [
14
38
  string,
15
39
  string,
@@ -159,6 +183,7 @@ export declare namespace AaveV3View {
159
183
  number | string | BN,
160
184
  number | string | BN,
161
185
  string[],
186
+ boolean[],
162
187
  string[],
163
188
  number | string | BN[],
164
189
  number | string | BN[],
@@ -173,6 +198,7 @@ export declare namespace AaveV3View {
173
198
  ratio: number | string | BN;
174
199
  eMode: number | string | BN;
175
200
  collAddr: string[];
201
+ enabledAsColl: boolean[];
176
202
  borrowAddr: string[];
177
203
  collAmounts: number | string | BN[];
178
204
  borrowStableAmounts: number | string | BN[];
@@ -188,6 +214,7 @@ export declare namespace AaveV3View {
188
214
  string,
189
215
  string,
190
216
  string[],
217
+ boolean[],
191
218
  string[],
192
219
  string[],
193
220
  string[],
@@ -203,6 +230,7 @@ export declare namespace AaveV3View {
203
230
  ratio: string;
204
231
  eMode: string;
205
232
  collAddr: string[];
233
+ enabledAsColl: boolean[];
206
234
  borrowAddr: string[];
207
235
  collAmounts: string[];
208
236
  borrowStableAmounts: string[];
@@ -276,8 +304,7 @@ export interface AaveV3View extends BaseContract {
276
304
  clone(): AaveV3View;
277
305
  methods: {
278
306
  AAVE_REFERRAL_CODE(): NonPayableTransactionObject<string>;
279
- STABLE_ID(): NonPayableTransactionObject<string>;
280
- VARIABLE_ID(): NonPayableTransactionObject<string>;
307
+ getApyAfterValuesEstimation(_market: string, _reserveParams: AaveV3View.LiquidityChangeParamsStruct[]): NonPayableTransactionObject<AaveV3View.EstimatedRatesStructOutput[]>;
281
308
  getAssetPrice(_market: string, _tokenAddr: string): NonPayableTransactionObject<string>;
282
309
  getCollFactors(_market: string, _tokens: string[]): NonPayableTransactionObject<string[]>;
283
310
  getEModeCollateralFactor(emodeCategory: number | string | BN, lendingPool: string): NonPayableTransactionObject<string>;
@@ -10,6 +10,30 @@ export interface EventOptions {
10
10
  topics?: string[];
11
11
  }
12
12
  export declare namespace SparkView {
13
+ type LiquidityChangeParamsStruct = [string, number | string | BN, number | string | BN] | {
14
+ reserveAddress: string;
15
+ liquidityAdded: number | string | BN;
16
+ liquidityTaken: number | string | BN;
17
+ };
18
+ type LiquidityChangeParamsStructOutputArray = [string, string, string];
19
+ type LiquidityChangeParamsStructOutputStruct = {
20
+ reserveAddress: string;
21
+ liquidityAdded: string;
22
+ liquidityTaken: string;
23
+ };
24
+ type LiquidityChangeParamsStructOutput = LiquidityChangeParamsStructOutputArray & LiquidityChangeParamsStructOutputStruct;
25
+ type EstimatedRatesStruct = [string, number | string | BN, number | string | BN] | {
26
+ reserveAddress: string;
27
+ supplyRate: number | string | BN;
28
+ variableBorrowRate: number | string | BN;
29
+ };
30
+ type EstimatedRatesStructOutputArray = [string, string, string];
31
+ type EstimatedRatesStructOutputStruct = {
32
+ reserveAddress: string;
33
+ supplyRate: string;
34
+ variableBorrowRate: string;
35
+ };
36
+ type EstimatedRatesStructOutput = EstimatedRatesStructOutputArray & EstimatedRatesStructOutputStruct;
13
37
  type TokenInfoFullStruct = [
14
38
  string,
15
39
  string,
@@ -159,6 +183,7 @@ export declare namespace SparkView {
159
183
  number | string | BN,
160
184
  number | string | BN,
161
185
  string[],
186
+ boolean[],
162
187
  string[],
163
188
  number | string | BN[],
164
189
  number | string | BN[],
@@ -173,6 +198,7 @@ export declare namespace SparkView {
173
198
  ratio: number | string | BN;
174
199
  eMode: number | string | BN;
175
200
  collAddr: string[];
201
+ enabledAsColl: boolean[];
176
202
  borrowAddr: string[];
177
203
  collAmounts: number | string | BN[];
178
204
  borrowStableAmounts: number | string | BN[];
@@ -188,6 +214,7 @@ export declare namespace SparkView {
188
214
  string,
189
215
  string,
190
216
  string[],
217
+ boolean[],
191
218
  string[],
192
219
  string[],
193
220
  string[],
@@ -203,6 +230,7 @@ export declare namespace SparkView {
203
230
  ratio: string;
204
231
  eMode: string;
205
232
  collAddr: string[];
233
+ enabledAsColl: boolean[];
206
234
  borrowAddr: string[];
207
235
  collAmounts: string[];
208
236
  borrowStableAmounts: string[];
@@ -276,8 +304,7 @@ export interface SparkView extends BaseContract {
276
304
  clone(): SparkView;
277
305
  methods: {
278
306
  SPARK_REFERRAL_CODE(): NonPayableTransactionObject<string>;
279
- STABLE_ID(): NonPayableTransactionObject<string>;
280
- VARIABLE_ID(): NonPayableTransactionObject<string>;
307
+ getApyAfterValuesEstimation(_market: string, _reserveParams: SparkView.LiquidityChangeParamsStruct[]): NonPayableTransactionObject<SparkView.EstimatedRatesStructOutput[]>;
281
308
  getAssetPrice(_market: string, _tokenAddr: string): NonPayableTransactionObject<string>;
282
309
  getCollFactors(_market: string, _tokens: string[]): NonPayableTransactionObject<string[]>;
283
310
  getEModeCollateralFactor(emodeCategory: number | string | BN, lendingPool: string): NonPayableTransactionObject<string>;
@@ -1,12 +1,27 @@
1
1
  export namespace AaveV3View {
2
2
  let abi: ({
3
- inputs: {
3
+ inputs: ({
4
4
  internalType: string;
5
5
  name: string;
6
6
  type: string;
7
- }[];
7
+ components?: undefined;
8
+ } | {
9
+ components: {
10
+ internalType: string;
11
+ name: string;
12
+ type: string;
13
+ }[];
14
+ internalType: string;
15
+ name: string;
16
+ type: string;
17
+ })[];
8
18
  name: string;
9
19
  outputs: {
20
+ components: {
21
+ internalType: string;
22
+ name: string;
23
+ type: string;
24
+ }[];
10
25
  internalType: string;
11
26
  name: string;
12
27
  type: string;
@@ -21,11 +36,6 @@ export namespace AaveV3View {
21
36
  }[];
22
37
  name: string;
23
38
  outputs: {
24
- components: {
25
- internalType: string;
26
- name: string;
27
- type: string;
28
- }[];
29
39
  internalType: string;
30
40
  name: string;
31
41
  type: string;
@@ -57,6 +67,62 @@ export namespace AaveV3View {
57
67
  address: string;
58
68
  createdBlock: number;
59
69
  oldVersions: {
70
+ "17870436": {
71
+ abi: ({
72
+ inputs: {
73
+ internalType: string;
74
+ name: string;
75
+ type: string;
76
+ }[];
77
+ name: string;
78
+ outputs: {
79
+ internalType: string;
80
+ name: string;
81
+ type: string;
82
+ }[];
83
+ stateMutability: string;
84
+ type: string;
85
+ } | {
86
+ inputs: {
87
+ internalType: string;
88
+ name: string;
89
+ type: string;
90
+ }[];
91
+ name: string;
92
+ outputs: {
93
+ components: {
94
+ internalType: string;
95
+ name: string;
96
+ type: string;
97
+ }[];
98
+ internalType: string;
99
+ name: string;
100
+ type: string;
101
+ }[];
102
+ stateMutability: string;
103
+ type: string;
104
+ } | {
105
+ inputs: {
106
+ components: {
107
+ internalType: string;
108
+ name: string;
109
+ type: string;
110
+ }[];
111
+ internalType: string;
112
+ name: string;
113
+ type: string;
114
+ }[];
115
+ name: string;
116
+ outputs: {
117
+ internalType: string;
118
+ name: string;
119
+ type: string;
120
+ }[];
121
+ stateMutability: string;
122
+ type: string;
123
+ })[];
124
+ address: string;
125
+ };
60
126
  "16483408": {
61
127
  abi: {
62
128
  inputs: {
@@ -109,6 +175,62 @@ export namespace AaveV3View {
109
175
  address: string;
110
176
  createdBlock: number;
111
177
  oldVersions: {
178
+ "107950604": {
179
+ address: string;
180
+ abi: ({
181
+ inputs: {
182
+ internalType: string;
183
+ name: string;
184
+ type: string;
185
+ }[];
186
+ name: string;
187
+ outputs: {
188
+ internalType: string;
189
+ name: string;
190
+ type: string;
191
+ }[];
192
+ stateMutability: string;
193
+ type: string;
194
+ } | {
195
+ inputs: {
196
+ internalType: string;
197
+ name: string;
198
+ type: string;
199
+ }[];
200
+ name: string;
201
+ outputs: {
202
+ components: {
203
+ internalType: string;
204
+ name: string;
205
+ type: string;
206
+ }[];
207
+ internalType: string;
208
+ name: string;
209
+ type: string;
210
+ }[];
211
+ stateMutability: string;
212
+ type: string;
213
+ } | {
214
+ inputs: {
215
+ components: {
216
+ internalType: string;
217
+ name: string;
218
+ type: string;
219
+ }[];
220
+ internalType: string;
221
+ name: string;
222
+ type: string;
223
+ }[];
224
+ name: string;
225
+ outputs: {
226
+ internalType: string;
227
+ name: string;
228
+ type: string;
229
+ }[];
230
+ stateMutability: string;
231
+ type: string;
232
+ })[];
233
+ };
112
234
  "6723401": {
113
235
  abi: {
114
236
  inputs: {
@@ -299,6 +421,62 @@ export namespace AaveV3View {
299
421
  address: string;
300
422
  createdBlock: number;
301
423
  oldVersions: {
424
+ "119382184": {
425
+ address: string;
426
+ abi: ({
427
+ inputs: {
428
+ internalType: string;
429
+ name: string;
430
+ type: string;
431
+ }[];
432
+ name: string;
433
+ outputs: {
434
+ internalType: string;
435
+ name: string;
436
+ type: string;
437
+ }[];
438
+ stateMutability: string;
439
+ type: string;
440
+ } | {
441
+ inputs: {
442
+ internalType: string;
443
+ name: string;
444
+ type: string;
445
+ }[];
446
+ name: string;
447
+ outputs: {
448
+ components: {
449
+ internalType: string;
450
+ name: string;
451
+ type: string;
452
+ }[];
453
+ internalType: string;
454
+ name: string;
455
+ type: string;
456
+ }[];
457
+ stateMutability: string;
458
+ type: string;
459
+ } | {
460
+ inputs: {
461
+ components: {
462
+ internalType: string;
463
+ name: string;
464
+ type: string;
465
+ }[];
466
+ internalType: string;
467
+ name: string;
468
+ type: string;
469
+ }[];
470
+ name: string;
471
+ outputs: {
472
+ internalType: string;
473
+ name: string;
474
+ type: string;
475
+ }[];
476
+ stateMutability: string;
477
+ type: string;
478
+ })[];
479
+ };
302
480
  "12855842": {
303
481
  abi: {
304
482
  inputs: {
@@ -465,6 +643,64 @@ export namespace AaveV3View {
465
643
  "8453": {
466
644
  address: string;
467
645
  createdBlock: number;
646
+ oldVersions: {
647
+ "3907180": {
648
+ address: string;
649
+ abi: ({
650
+ inputs: {
651
+ internalType: string;
652
+ name: string;
653
+ type: string;
654
+ }[];
655
+ name: string;
656
+ outputs: {
657
+ internalType: string;
658
+ name: string;
659
+ type: string;
660
+ }[];
661
+ stateMutability: string;
662
+ type: string;
663
+ } | {
664
+ inputs: {
665
+ internalType: string;
666
+ name: string;
667
+ type: string;
668
+ }[];
669
+ name: string;
670
+ outputs: {
671
+ components: {
672
+ internalType: string;
673
+ name: string;
674
+ type: string;
675
+ }[];
676
+ internalType: string;
677
+ name: string;
678
+ type: string;
679
+ }[];
680
+ stateMutability: string;
681
+ type: string;
682
+ } | {
683
+ inputs: {
684
+ components: {
685
+ internalType: string;
686
+ name: string;
687
+ type: string;
688
+ }[];
689
+ internalType: string;
690
+ name: string;
691
+ type: string;
692
+ }[];
693
+ name: string;
694
+ outputs: {
695
+ internalType: string;
696
+ name: string;
697
+ type: string;
698
+ }[];
699
+ stateMutability: string;
700
+ type: string;
701
+ })[];
702
+ };
703
+ };
468
704
  };
469
705
  };
470
706
  }
@@ -2697,13 +2933,28 @@ export namespace MorphoAaveV2View {
2697
2933
  }
2698
2934
  export namespace SparkView {
2699
2935
  let abi_34: ({
2700
- inputs: {
2936
+ inputs: ({
2701
2937
  internalType: string;
2702
2938
  name: string;
2703
2939
  type: string;
2704
- }[];
2940
+ components?: undefined;
2941
+ } | {
2942
+ components: {
2943
+ internalType: string;
2944
+ name: string;
2945
+ type: string;
2946
+ }[];
2947
+ internalType: string;
2948
+ name: string;
2949
+ type: string;
2950
+ })[];
2705
2951
  name: string;
2706
2952
  outputs: {
2953
+ components: {
2954
+ internalType: string;
2955
+ name: string;
2956
+ type: string;
2957
+ }[];
2707
2958
  internalType: string;
2708
2959
  name: string;
2709
2960
  type: string;
@@ -2718,11 +2969,6 @@ export namespace SparkView {
2718
2969
  }[];
2719
2970
  name: string;
2720
2971
  outputs: {
2721
- components: {
2722
- internalType: string;
2723
- name: string;
2724
- type: string;
2725
- }[];
2726
2972
  internalType: string;
2727
2973
  name: string;
2728
2974
  type: string;
@@ -2755,6 +3001,62 @@ export namespace SparkView {
2755
3001
  address: string;
2756
3002
  createdBlock: number;
2757
3003
  oldVersions: {
3004
+ "17870357": {
3005
+ abi: ({
3006
+ inputs: {
3007
+ internalType: string;
3008
+ name: string;
3009
+ type: string;
3010
+ }[];
3011
+ name: string;
3012
+ outputs: {
3013
+ internalType: string;
3014
+ name: string;
3015
+ type: string;
3016
+ }[];
3017
+ stateMutability: string;
3018
+ type: string;
3019
+ } | {
3020
+ inputs: {
3021
+ internalType: string;
3022
+ name: string;
3023
+ type: string;
3024
+ }[];
3025
+ name: string;
3026
+ outputs: {
3027
+ components: {
3028
+ internalType: string;
3029
+ name: string;
3030
+ type: string;
3031
+ }[];
3032
+ internalType: string;
3033
+ name: string;
3034
+ type: string;
3035
+ }[];
3036
+ stateMutability: string;
3037
+ type: string;
3038
+ } | {
3039
+ inputs: {
3040
+ components: {
3041
+ internalType: string;
3042
+ name: string;
3043
+ type: string;
3044
+ }[];
3045
+ internalType: string;
3046
+ name: string;
3047
+ type: string;
3048
+ }[];
3049
+ name: string;
3050
+ outputs: {
3051
+ internalType: string;
3052
+ name: string;
3053
+ type: string;
3054
+ }[];
3055
+ stateMutability: string;
3056
+ type: string;
3057
+ })[];
3058
+ address: string;
3059
+ };
2758
3060
  "17734126": {
2759
3061
  abi: {
2760
3062
  inputs: {