@defisaver/positions-sdk 0.0.20 → 0.0.22

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 (99) hide show
  1. package/README.md +63 -0
  2. package/cjs/aaveV2/index.js +9 -4
  3. package/cjs/aaveV3/index.js +9 -4
  4. package/cjs/compoundV2/index.d.ts +1 -0
  5. package/cjs/compoundV2/index.js +15 -8
  6. package/cjs/config/contracts.d.ts +373 -201
  7. package/cjs/config/contracts.js +22 -0
  8. package/cjs/helpers/aaveHelpers/index.js +0 -5
  9. package/cjs/helpers/compoundHelpers/index.js +2 -2
  10. package/cjs/markets/compound/index.d.ts +2 -0
  11. package/cjs/markets/compound/index.js +60 -13
  12. package/cjs/markets/compound/marketsAssets.d.ts +7 -1
  13. package/cjs/markets/compound/marketsAssets.js +12 -2
  14. package/cjs/morphoAaveV2/index.js +4 -3
  15. package/cjs/morphoAaveV3/index.js +9 -4
  16. package/cjs/spark/index.js +9 -4
  17. package/cjs/types/aave.d.ts +0 -5
  18. package/cjs/types/compound.d.ts +6 -4
  19. package/cjs/types/compound.js +1 -0
  20. package/cjs/types/contracts/generated/CUSDCev3.d.ts +441 -0
  21. package/cjs/types/contracts/generated/CUSDCev3.js +5 -0
  22. package/cjs/types/contracts/generated/CompV3USDCBulkerArb.d.ts +41 -0
  23. package/cjs/types/contracts/generated/CompV3USDCBulkerArb.js +5 -0
  24. package/cjs/types/contracts/generated/index.d.ts +2 -0
  25. package/esm/aaveV2/index.js +11 -6
  26. package/esm/aaveV3/index.js +11 -6
  27. package/esm/compoundV2/index.d.ts +1 -0
  28. package/esm/compoundV2/index.js +13 -7
  29. package/esm/config/contracts.d.ts +373 -201
  30. package/esm/config/contracts.js +22 -0
  31. package/esm/helpers/aaveHelpers/index.js +0 -5
  32. package/esm/helpers/compoundHelpers/index.js +2 -2
  33. package/esm/markets/compound/index.d.ts +2 -0
  34. package/esm/markets/compound/index.js +59 -13
  35. package/esm/markets/compound/marketsAssets.d.ts +7 -1
  36. package/esm/markets/compound/marketsAssets.js +11 -1
  37. package/esm/morphoAaveV2/index.js +4 -3
  38. package/esm/morphoAaveV3/index.js +9 -4
  39. package/esm/spark/index.js +11 -6
  40. package/esm/types/aave.d.ts +0 -5
  41. package/esm/types/compound.d.ts +6 -4
  42. package/esm/types/compound.js +1 -0
  43. package/esm/types/contracts/generated/CUSDCev3.d.ts +441 -0
  44. package/esm/types/contracts/generated/CUSDCev3.js +4 -0
  45. package/esm/types/contracts/generated/CompV3USDCBulkerArb.d.ts +41 -0
  46. package/esm/types/contracts/generated/CompV3USDCBulkerArb.js +4 -0
  47. package/esm/types/contracts/generated/index.d.ts +2 -0
  48. package/package.json +40 -40
  49. package/src/aaveV2/index.ts +226 -220
  50. package/src/aaveV3/index.ts +561 -554
  51. package/src/assets/index.ts +60 -60
  52. package/src/chickenBonds/index.ts +123 -123
  53. package/src/compoundV2/index.ts +219 -206
  54. package/src/compoundV3/index.ts +275 -275
  55. package/src/config/contracts.js +673 -651
  56. package/src/constants/index.ts +3 -3
  57. package/src/contracts.ts +100 -100
  58. package/src/curveUsd/index.ts +228 -228
  59. package/src/exchange/index.ts +17 -17
  60. package/src/helpers/aaveHelpers/index.ts +134 -141
  61. package/src/helpers/chickenBondsHelpers/index.ts +23 -23
  62. package/src/helpers/compoundHelpers/index.ts +181 -181
  63. package/src/helpers/curveUsdHelpers/index.ts +32 -32
  64. package/src/helpers/index.ts +5 -5
  65. package/src/helpers/makerHelpers/index.ts +94 -94
  66. package/src/helpers/sparkHelpers/index.ts +106 -106
  67. package/src/index.ts +40 -40
  68. package/src/liquity/index.ts +116 -116
  69. package/src/maker/index.ts +101 -101
  70. package/src/markets/aave/index.ts +80 -80
  71. package/src/markets/aave/marketAssets.ts +32 -32
  72. package/src/markets/compound/index.ts +141 -85
  73. package/src/markets/compound/marketsAssets.ts +46 -35
  74. package/src/markets/curveUsd/index.ts +69 -69
  75. package/src/markets/index.ts +3 -3
  76. package/src/markets/spark/index.ts +29 -29
  77. package/src/markets/spark/marketAssets.ts +9 -9
  78. package/src/moneymarket/moneymarketCommonService.ts +75 -75
  79. package/src/morpho/markets.ts +39 -39
  80. package/src/morphoAaveV2/index.ts +255 -254
  81. package/src/morphoAaveV3/index.ts +619 -614
  82. package/src/multicall/index.ts +22 -22
  83. package/src/services/dsrService.ts +15 -15
  84. package/src/services/priceService.ts +21 -21
  85. package/src/services/utils.ts +34 -34
  86. package/src/spark/index.ts +421 -413
  87. package/src/staking/staking.ts +167 -167
  88. package/src/types/aave.ts +256 -261
  89. package/src/types/chickenBonds.ts +45 -45
  90. package/src/types/common.ts +83 -83
  91. package/src/types/compound.ts +128 -122
  92. package/src/types/contracts/generated/CUSDCev3.ts +685 -0
  93. package/src/types/contracts/generated/CompV3USDCBulkerArb.ts +85 -0
  94. package/src/types/contracts/generated/index.ts +2 -0
  95. package/src/types/curveUsd.ts +112 -112
  96. package/src/types/index.ts +6 -6
  97. package/src/types/liquity.ts +30 -30
  98. package/src/types/maker.ts +50 -50
  99. package/src/types/spark.ts +106 -106
@@ -0,0 +1,85 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+
5
+ import type BN from "bn.js";
6
+ import type { ContractOptions } from "web3-eth-contract";
7
+ import type { EventLog } from "web3-core";
8
+ import type { EventEmitter } from "events";
9
+ import type {
10
+ Callback,
11
+ PayableTransactionObject,
12
+ NonPayableTransactionObject,
13
+ BlockType,
14
+ ContractEventLog,
15
+ BaseContract,
16
+ } from "./types";
17
+
18
+ export interface EventOptions {
19
+ filter?: object;
20
+ fromBlock?: BlockType;
21
+ topics?: string[];
22
+ }
23
+
24
+ export type AdminTransferred = ContractEventLog<{
25
+ oldAdmin: string;
26
+ newAdmin: string;
27
+ 0: string;
28
+ 1: string;
29
+ }>;
30
+
31
+ export interface CompV3USDCBulkerArb extends BaseContract {
32
+ constructor(
33
+ jsonInterface: any[],
34
+ address?: string,
35
+ options?: ContractOptions
36
+ ): CompV3USDCBulkerArb;
37
+ clone(): CompV3USDCBulkerArb;
38
+ methods: {
39
+ ACTION_CLAIM_REWARD(): NonPayableTransactionObject<string>;
40
+
41
+ ACTION_SUPPLY_ASSET(): NonPayableTransactionObject<string>;
42
+
43
+ ACTION_SUPPLY_NATIVE_TOKEN(): NonPayableTransactionObject<string>;
44
+
45
+ ACTION_TRANSFER_ASSET(): NonPayableTransactionObject<string>;
46
+
47
+ ACTION_WITHDRAW_ASSET(): NonPayableTransactionObject<string>;
48
+
49
+ ACTION_WITHDRAW_NATIVE_TOKEN(): NonPayableTransactionObject<string>;
50
+
51
+ admin(): NonPayableTransactionObject<string>;
52
+
53
+ invoke(
54
+ actions: string | number[][],
55
+ data: string | number[][]
56
+ ): PayableTransactionObject<void>;
57
+
58
+ sweepNativeToken(recipient: string): NonPayableTransactionObject<void>;
59
+
60
+ sweepToken(
61
+ recipient: string,
62
+ asset: string
63
+ ): NonPayableTransactionObject<void>;
64
+
65
+ transferAdmin(newAdmin: string): NonPayableTransactionObject<void>;
66
+
67
+ wrappedNativeToken(): NonPayableTransactionObject<string>;
68
+ };
69
+ events: {
70
+ AdminTransferred(cb?: Callback<AdminTransferred>): EventEmitter;
71
+ AdminTransferred(
72
+ options?: EventOptions,
73
+ cb?: Callback<AdminTransferred>
74
+ ): EventEmitter;
75
+
76
+ allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
77
+ };
78
+
79
+ once(event: "AdminTransferred", cb: Callback<AdminTransferred>): void;
80
+ once(
81
+ event: "AdminTransferred",
82
+ options: EventOptions,
83
+ cb: Callback<AdminTransferred>
84
+ ): void;
85
+ }
@@ -17,6 +17,7 @@ export type { ChickenBondsView } from "./ChickenBondsView";
17
17
  export type { CollSurplusPool } from "./CollSurplusPool";
18
18
  export type { CompV3ETHBulker } from "./CompV3ETHBulker";
19
19
  export type { CompV3USDCBulker } from "./CompV3USDCBulker";
20
+ export type { CompV3USDCBulkerArb } from "./CompV3USDCBulkerArb";
20
21
  export type { CompV3USDbCBulker } from "./CompV3USDbCBulker";
21
22
  export type { CompV3View } from "./CompV3View";
22
23
  export type { CompoundLoanInfo } from "./CompoundLoanInfo";
@@ -51,6 +52,7 @@ export type { TroveManager } from "./TroveManager";
51
52
  export type { USDCPriceFeed } from "./USDCPriceFeed";
52
53
  export type { UniMulticall } from "./UniMulticall";
53
54
  export type { CETHv3 } from "./CETHv3";
55
+ export type { CUSDCev3 } from "./CUSDCev3";
54
56
  export type { CUSDCv3 } from "./CUSDCv3";
55
57
  export type { CUSDbCv3 } from "./CUSDbCv3";
56
58
  export type { CrvUSDETHAmm } from "./CrvUSDETHAmm";
@@ -1,113 +1,113 @@
1
- import { NetworkNumber } from './common';
2
-
3
- export enum CrvUSDVersions {
4
- 'wstETH' = 'wstETH',
5
- 'WBTC' = 'WBTC',
6
- 'ETH' = 'ETH',
7
- 'tBTC' = 'tBTC',
8
- 'sfrxETH' = 'sfrxETH',
9
- }
10
-
11
- export enum CrvUSDStatus {
12
- Nonexistant = 'Nonexistant',
13
- Safe = 'Safe',
14
- Risk = 'Risk',
15
- SoftLiquidating = 'SoftLiquidating',
16
- SoftLiquidated = 'SoftLiquidated',
17
- }
18
-
19
- export interface CrvUSDMarketData {
20
- chainIds: NetworkNumber[],
21
- label: string,
22
- shortLabel: string,
23
- value: CrvUSDVersions,
24
- collAsset: string,
25
- baseAsset: string,
26
- controllerAddress: string,
27
- ammAddress: string,
28
- createCollAssets: string[],
29
- }
30
-
31
- export interface BandData {
32
- id: string,
33
- collAmount: string,
34
- debtAmount: string,
35
- lowPrice: string,
36
- highPrice: string,
37
- }
38
-
39
- export interface UserBandData {
40
- id: string,
41
- collAmount: string,
42
- debtAmount: string,
43
- lowPrice: string,
44
- highPrice: string,
45
- userDebtAmount: string,
46
- userCollAmount: string,
47
- }
48
-
49
- export interface CrvUSDGlobalMarketData {
50
- collateral: string,
51
- decimals: string,
52
- activeBand: string,
53
- totalDebt: string,
54
- ammPrice: string,
55
- basePrice: string,
56
- oraclePrice: string,
57
- minted: string,
58
- redeemed: string,
59
- monetaryPolicyRate: string,
60
- ammRate: string,
61
- minBand: string,
62
- maxBand: string,
63
- debtCeiling: string,
64
- borrowRate: string,
65
- futureBorrowRate: string,
66
- leftToBorrow: string,
67
- bands: BandData[],
68
- }
69
-
70
- export interface CrvUSDAggregatedPositionData {
71
- ratio: string,
72
- supplied: string,
73
- suppliedUsd: string,
74
- borrowedUsd: string,
75
- borrowed: string,
76
- safetyRatio: string,
77
- }
78
-
79
- export interface CrvUSDUsedAsset {
80
- isSupplied: boolean,
81
- supplied: string,
82
- suppliedUsd: string,
83
- borrowed: string,
84
- borrowedUsd: string,
85
- isBorrowed: boolean,
86
- symbol: string,
87
- collateral: boolean,
88
- price: string,
89
- interestRate?: string,
90
- }
91
-
92
- export interface CrvUSDUsedAssets {
93
- [key: string]: CrvUSDUsedAsset,
94
- }
95
-
96
- export interface CrvUSDUserData {
97
- debtAmount: string,
98
- health: string,
99
- healthPercent: string,
100
- priceHigh: string,
101
- priceLow: string,
102
- liquidationDiscount: string,
103
- numOfBands: string,
104
- usedAssets: CrvUSDUsedAssets,
105
- status: CrvUSDStatus,
106
- ratio: string,
107
- supplied: string,
108
- suppliedUsd: string,
109
- borrowedUsd: string,
110
- borrowed: string,
111
- safetyRatio: string,
112
- userBands: UserBandData[],
1
+ import { NetworkNumber } from './common';
2
+
3
+ export enum CrvUSDVersions {
4
+ 'wstETH' = 'wstETH',
5
+ 'WBTC' = 'WBTC',
6
+ 'ETH' = 'ETH',
7
+ 'tBTC' = 'tBTC',
8
+ 'sfrxETH' = 'sfrxETH',
9
+ }
10
+
11
+ export enum CrvUSDStatus {
12
+ Nonexistant = 'Nonexistant',
13
+ Safe = 'Safe',
14
+ Risk = 'Risk',
15
+ SoftLiquidating = 'SoftLiquidating',
16
+ SoftLiquidated = 'SoftLiquidated',
17
+ }
18
+
19
+ export interface CrvUSDMarketData {
20
+ chainIds: NetworkNumber[],
21
+ label: string,
22
+ shortLabel: string,
23
+ value: CrvUSDVersions,
24
+ collAsset: string,
25
+ baseAsset: string,
26
+ controllerAddress: string,
27
+ ammAddress: string,
28
+ createCollAssets: string[],
29
+ }
30
+
31
+ export interface BandData {
32
+ id: string,
33
+ collAmount: string,
34
+ debtAmount: string,
35
+ lowPrice: string,
36
+ highPrice: string,
37
+ }
38
+
39
+ export interface UserBandData {
40
+ id: string,
41
+ collAmount: string,
42
+ debtAmount: string,
43
+ lowPrice: string,
44
+ highPrice: string,
45
+ userDebtAmount: string,
46
+ userCollAmount: string,
47
+ }
48
+
49
+ export interface CrvUSDGlobalMarketData {
50
+ collateral: string,
51
+ decimals: string,
52
+ activeBand: string,
53
+ totalDebt: string,
54
+ ammPrice: string,
55
+ basePrice: string,
56
+ oraclePrice: string,
57
+ minted: string,
58
+ redeemed: string,
59
+ monetaryPolicyRate: string,
60
+ ammRate: string,
61
+ minBand: string,
62
+ maxBand: string,
63
+ debtCeiling: string,
64
+ borrowRate: string,
65
+ futureBorrowRate: string,
66
+ leftToBorrow: string,
67
+ bands: BandData[],
68
+ }
69
+
70
+ export interface CrvUSDAggregatedPositionData {
71
+ ratio: string,
72
+ supplied: string,
73
+ suppliedUsd: string,
74
+ borrowedUsd: string,
75
+ borrowed: string,
76
+ safetyRatio: string,
77
+ }
78
+
79
+ export interface CrvUSDUsedAsset {
80
+ isSupplied: boolean,
81
+ supplied: string,
82
+ suppliedUsd: string,
83
+ borrowed: string,
84
+ borrowedUsd: string,
85
+ isBorrowed: boolean,
86
+ symbol: string,
87
+ collateral: boolean,
88
+ price: string,
89
+ interestRate?: string,
90
+ }
91
+
92
+ export interface CrvUSDUsedAssets {
93
+ [key: string]: CrvUSDUsedAsset,
94
+ }
95
+
96
+ export interface CrvUSDUserData {
97
+ debtAmount: string,
98
+ health: string,
99
+ healthPercent: string,
100
+ priceHigh: string,
101
+ priceLow: string,
102
+ liquidationDiscount: string,
103
+ numOfBands: string,
104
+ usedAssets: CrvUSDUsedAssets,
105
+ status: CrvUSDStatus,
106
+ ratio: string,
107
+ supplied: string,
108
+ suppliedUsd: string,
109
+ borrowedUsd: string,
110
+ borrowed: string,
111
+ safetyRatio: string,
112
+ userBands: UserBandData[],
113
113
  }
@@ -1,7 +1,7 @@
1
- export * from './aave';
2
- export * from './compound';
3
- export * from './spark';
4
- export * from './curveUsd';
5
- export * from './liquity';
6
- export * from './maker';
1
+ export * from './aave';
2
+ export * from './compound';
3
+ export * from './spark';
4
+ export * from './curveUsd';
5
+ export * from './liquity';
6
+ export * from './maker';
7
7
  export * from './chickenBonds';
@@ -1,31 +1,31 @@
1
- export enum LIQUITY_TROVE_STATUS_ENUM {
2
- nonExistent,
3
- active,
4
- closedByOwner,
5
- closedByLiquidation,
6
- closedByRedemption,
7
- }
8
-
9
- export const LIQUITY_STATUS_MAPPING = {
10
- nonExistent: 'Non existent',
11
- active: 'Active',
12
- closedByOwner: 'Closed',
13
- closedByLiquidation: 'Liquidated',
14
- closedByRedemption: 'Redeemed',
15
- };
16
-
17
- export interface LiquityTroveInfo {
18
- troveStatus: string,
19
- collateral: string,
20
- debtInAsset: string,
21
- TCRatio: string,
22
- recoveryMode: boolean,
23
- claimableCollateral: string,
24
- borrowingRateWithDecay: string,
25
- assetPrice: string,
26
- totalETH: string,
27
- totalLUSD: string,
28
- minCollateralRatio: number,
29
- priceForRecovery: string,
30
- debtInFront: string,
1
+ export enum LIQUITY_TROVE_STATUS_ENUM {
2
+ nonExistent,
3
+ active,
4
+ closedByOwner,
5
+ closedByLiquidation,
6
+ closedByRedemption,
7
+ }
8
+
9
+ export const LIQUITY_STATUS_MAPPING = {
10
+ nonExistent: 'Non existent',
11
+ active: 'Active',
12
+ closedByOwner: 'Closed',
13
+ closedByLiquidation: 'Liquidated',
14
+ closedByRedemption: 'Redeemed',
15
+ };
16
+
17
+ export interface LiquityTroveInfo {
18
+ troveStatus: string,
19
+ collateral: string,
20
+ debtInAsset: string,
21
+ TCRatio: string,
22
+ recoveryMode: boolean,
23
+ claimableCollateral: string,
24
+ borrowingRateWithDecay: string,
25
+ assetPrice: string,
26
+ totalETH: string,
27
+ totalLUSD: string,
28
+ minCollateralRatio: number,
29
+ priceForRecovery: string,
30
+ debtInFront: string,
31
31
  }
@@ -1,51 +1,51 @@
1
- import { EthAddress } from './common';
2
-
3
- export interface IlkInfo {
4
- ilkLabel: string;
5
- currentRate: string;
6
- futureRate: string;
7
- minDebt: string;
8
- globalDebtCeiling: string;
9
- globalDebtCurrent: string;
10
- assetPrice: string;
11
- liqRatio: string;
12
- liqPercent: number;
13
- stabilityFee: number;
14
- liquidationFee: string;
15
- creatableDebt: string;
16
- }
17
-
18
- export interface CdpData {
19
- owner: EthAddress,
20
- userAddress: EthAddress,
21
- id: string,
22
- urn: EthAddress,
23
- type: string,
24
- ilk: string,
25
- ilkLabel: string,
26
- asset: string,
27
- collateral: string,
28
- collateralUsd: string,
29
- futureDebt: string,
30
- debtDai: string,
31
- debtUsd: string,
32
- debtInAsset: string,
33
- debtAssetPrice: string,
34
- debtAssetMarketPrice: string,
35
- liquidationPrice: string,
36
- ratio: string,
37
- liqRatio: string,
38
- liqPercent: number,
39
- assetPrice: string,
40
- daiLabel: string,
41
- debtAsset: string,
42
- unclaimedCollateral: string,
43
- debtTooLow: boolean,
44
- minDebt: string,
45
- stabilityFee: number,
46
- creatableDebt: string,
47
- globalDebtCeiling: string,
48
- globalDebtCurrent: string,
49
- liquidationFee: string,
50
- lastUpdated: number,
1
+ import { EthAddress } from './common';
2
+
3
+ export interface IlkInfo {
4
+ ilkLabel: string;
5
+ currentRate: string;
6
+ futureRate: string;
7
+ minDebt: string;
8
+ globalDebtCeiling: string;
9
+ globalDebtCurrent: string;
10
+ assetPrice: string;
11
+ liqRatio: string;
12
+ liqPercent: number;
13
+ stabilityFee: number;
14
+ liquidationFee: string;
15
+ creatableDebt: string;
16
+ }
17
+
18
+ export interface CdpData {
19
+ owner: EthAddress,
20
+ userAddress: EthAddress,
21
+ id: string,
22
+ urn: EthAddress,
23
+ type: string,
24
+ ilk: string,
25
+ ilkLabel: string,
26
+ asset: string,
27
+ collateral: string,
28
+ collateralUsd: string,
29
+ futureDebt: string,
30
+ debtDai: string,
31
+ debtUsd: string,
32
+ debtInAsset: string,
33
+ debtAssetPrice: string,
34
+ debtAssetMarketPrice: string,
35
+ liquidationPrice: string,
36
+ ratio: string,
37
+ liqRatio: string,
38
+ liqPercent: number,
39
+ assetPrice: string,
40
+ daiLabel: string,
41
+ debtAsset: string,
42
+ unclaimedCollateral: string,
43
+ debtTooLow: boolean,
44
+ minDebt: string,
45
+ stabilityFee: number,
46
+ creatableDebt: string,
47
+ globalDebtCeiling: string,
48
+ globalDebtCurrent: string,
49
+ liquidationFee: string,
50
+ lastUpdated: number,
51
51
  }