@defisaver/positions-sdk 0.0.165 → 0.0.166-dev
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/cjs/config/contracts.d.ts +72 -0
- package/cjs/config/contracts.js +6 -0
- package/cjs/contracts.d.ts +1 -0
- package/cjs/contracts.js +2 -1
- package/cjs/eulerV2/index.d.ts +40 -0
- package/cjs/eulerV2/index.js +207 -0
- package/cjs/helpers/eulerHelpers/index.d.ts +27 -0
- package/cjs/helpers/eulerHelpers/index.js +232 -0
- package/cjs/helpers/index.d.ts +1 -0
- package/cjs/helpers/index.js +2 -1
- package/cjs/index.d.ts +2 -1
- package/cjs/index.js +3 -1
- package/cjs/markets/compound/marketsAssets.js +3 -3
- package/cjs/markets/euler/index.d.ts +10 -0
- package/cjs/markets/euler/index.js +41 -0
- package/cjs/markets/index.d.ts +1 -0
- package/cjs/markets/index.js +3 -1
- package/cjs/markets/morphoBlue/index.d.ts +0 -4
- package/cjs/markets/morphoBlue/index.js +1 -36
- package/cjs/markets/spark/marketAssets.js +1 -1
- package/cjs/services/utils.d.ts +2 -0
- package/cjs/services/utils.js +4 -1
- package/cjs/staking/staking.js +1 -22
- package/cjs/types/contracts/generated/EulerV2View.d.ts +333 -0
- package/cjs/types/contracts/generated/EulerV2View.js +5 -0
- package/cjs/types/contracts/generated/index.d.ts +1 -0
- package/cjs/types/euler.d.ts +148 -0
- package/cjs/types/euler.js +15 -0
- package/cjs/types/index.d.ts +1 -0
- package/cjs/types/index.js +1 -0
- package/cjs/types/morphoBlue.d.ts +1 -3
- package/cjs/types/morphoBlue.js +0 -2
- package/esm/config/contracts.d.ts +72 -0
- package/esm/config/contracts.js +6 -0
- package/esm/contracts.d.ts +1 -0
- package/esm/contracts.js +1 -0
- package/esm/eulerV2/index.d.ts +40 -0
- package/esm/eulerV2/index.js +199 -0
- package/esm/helpers/eulerHelpers/index.d.ts +27 -0
- package/esm/helpers/eulerHelpers/index.js +219 -0
- package/esm/helpers/index.d.ts +1 -0
- package/esm/helpers/index.js +1 -0
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -1
- package/esm/markets/compound/marketsAssets.js +3 -3
- package/esm/markets/euler/index.d.ts +10 -0
- package/esm/markets/euler/index.js +34 -0
- package/esm/markets/index.d.ts +1 -0
- package/esm/markets/index.js +1 -0
- package/esm/markets/morphoBlue/index.d.ts +0 -4
- package/esm/markets/morphoBlue/index.js +0 -33
- package/esm/markets/spark/marketAssets.js +1 -1
- package/esm/services/utils.d.ts +2 -0
- package/esm/services/utils.js +2 -0
- package/esm/staking/staking.js +1 -22
- package/esm/types/contracts/generated/EulerV2View.d.ts +333 -0
- package/esm/types/contracts/generated/EulerV2View.js +4 -0
- package/esm/types/contracts/generated/index.d.ts +1 -0
- package/esm/types/euler.d.ts +148 -0
- package/esm/types/euler.js +12 -0
- package/esm/types/index.d.ts +1 -0
- package/esm/types/index.js +1 -0
- package/esm/types/morphoBlue.d.ts +1 -3
- package/esm/types/morphoBlue.js +0 -2
- package/package.json +5 -9
- package/src/config/contracts.js +6 -0
- package/src/contracts.ts +2 -0
- package/src/eulerV2/index.ts +286 -0
- package/src/helpers/eulerHelpers/index.ts +231 -0
- package/src/helpers/index.ts +2 -1
- package/src/index.ts +2 -0
- package/src/markets/compound/marketsAssets.ts +3 -3
- package/src/markets/euler/index.ts +38 -0
- package/src/markets/index.ts +3 -1
- package/src/markets/morphoBlue/index.ts +0 -37
- package/src/markets/spark/marketAssets.ts +1 -1
- package/src/services/utils.ts +3 -0
- package/src/staking/staking.ts +2 -24
- package/src/types/contracts/generated/EulerV2View.ts +434 -0
- package/src/types/contracts/generated/index.ts +1 -0
- package/src/types/euler.ts +171 -0
- package/src/types/index.ts +2 -1
- package/src/types/morphoBlue.ts +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NetworkNumber } from '../../types/common';
|
|
2
2
|
|
|
3
|
-
export const sparkAssetsDefaultMarketEth = ['DAI', 'sDAI', 'USDC', 'ETH', 'wstETH', 'WBTC', 'GNO', 'rETH', 'USDT', 'weETH', 'cbBTC'
|
|
3
|
+
export const sparkAssetsDefaultMarketEth = ['DAI', 'sDAI', 'USDC', 'ETH', 'wstETH', 'WBTC', 'GNO', 'rETH', 'USDT', 'weETH', 'cbBTC'];
|
|
4
4
|
|
|
5
5
|
// @dev Keep assets in array, do not assign directly, so we can parse it and edit it programmatically with `scripts/updateMarkets`
|
|
6
6
|
export const sparkAssetsDefaultMarket = {
|
package/src/services/utils.ts
CHANGED
|
@@ -52,3 +52,6 @@ export const mapRange = (input: number | string, minInput: number | string, maxI
|
|
|
52
52
|
// eslint-disable-next-line no-bitwise
|
|
53
53
|
export const isEnabledOnBitmap = (bitmap: number, assetId: number) => (BigInt(bitmap) >> BigInt(assetId)) & BigInt(1);
|
|
54
54
|
|
|
55
|
+
export const MAXUINT:string = '115792089237316195423570985008687907853269984665640564039457584007913129639935';
|
|
56
|
+
|
|
57
|
+
export const isMaxuint = (amount: string) => compareAddresses(MAXUINT, amount);
|
package/src/staking/staking.ts
CHANGED
|
@@ -77,36 +77,15 @@ export const getDsrApy = async (web3: Web3, blockNumber: 'latest' | number = 'la
|
|
|
77
77
|
.toString();
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
const getSuperOETHApy = async () => {
|
|
81
|
-
console.log('getSuperOETHApy');
|
|
82
|
-
const res = await fetch('https://origin.squids.live/origin-squid/graphql', {
|
|
83
|
-
method: 'POST',
|
|
84
|
-
headers: {
|
|
85
|
-
'Content-Type': 'application/json',
|
|
86
|
-
},
|
|
87
|
-
body: JSON.stringify({
|
|
88
|
-
query: '\n query OTokenApy($chainId: Int!, $token: String!) {\n oTokenApies(\n limit: 1\n orderBy: timestamp_DESC\n where: {chainId_eq: $chainId, otoken_containsInsensitive: $token}\n ) {\n apy7DayAvg\n apy14DayAvg\n apy30DayAvg\n apr\n apy\n }\n}\n ',
|
|
89
|
-
variables: {
|
|
90
|
-
token: '0xdbfefd2e8460a6ee4955a68582f85708baea60a3',
|
|
91
|
-
chainId: 8453,
|
|
92
|
-
},
|
|
93
|
-
}),
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
const data = await res.json();
|
|
97
|
-
return new Dec(data.data.oTokenApies[0].apy).mul(100).toString();
|
|
98
|
-
};
|
|
99
|
-
|
|
100
80
|
const getApyFromDfsApi = async (asset: string) => {
|
|
101
81
|
const res = await fetch(`https://app.defisaver.com/api/staking/apy?asset=${asset}`);
|
|
102
82
|
const data = await res.json();
|
|
103
83
|
return data.apy;
|
|
104
84
|
};
|
|
105
85
|
|
|
106
|
-
export const STAKING_ASSETS = ['cbETH', 'wstETH', 'cbETH', 'rETH', 'sDAI', 'weETH', 'sUSDe', 'osETH', 'ezETH', 'ETHx', 'rsETH', 'pufETH', 'wrsETH'
|
|
86
|
+
export const STAKING_ASSETS = ['cbETH', 'wstETH', 'cbETH', 'rETH', 'sDAI', 'weETH', 'sUSDe', 'osETH', 'ezETH', 'ETHx', 'rsETH', 'pufETH', 'wrsETH'];
|
|
107
87
|
|
|
108
88
|
export const getStakingApy = (asset: string, web3: Web3, blockNumber: 'latest' | number = 'latest', fromBlock: number | undefined = undefined) => {
|
|
109
|
-
console.log('getStakingApy', asset, blockNumber, fromBlock);
|
|
110
89
|
try {
|
|
111
90
|
if (asset === 'stETH' || asset === 'wstETH') return getStETHApr(web3, fromBlock, blockNumber);
|
|
112
91
|
if (asset === 'cbETH') return getCbETHApr(web3, blockNumber);
|
|
@@ -119,7 +98,6 @@ export const getStakingApy = (asset: string, web3: Web3, blockNumber: 'latest' |
|
|
|
119
98
|
if (asset === 'ETHx') return getApyFromDfsApi('ETHx');
|
|
120
99
|
if (asset === 'rsETH' || asset === 'wrsETH') return getApyFromDfsApi('rsETH');
|
|
121
100
|
if (asset === 'pufETH') return getApyFromDfsApi('pufETH');
|
|
122
|
-
if (asset === 'wsuperOETHb') return getSuperOETHApy();
|
|
123
101
|
} catch (e) {
|
|
124
102
|
console.error(`Failed to fetch APY for ${asset}`);
|
|
125
103
|
return '0';
|
|
@@ -139,7 +117,7 @@ export const calculateInterestEarned = (principal: string, interest: string, typ
|
|
|
139
117
|
return (+principal * (1 + (+interest / 100 * interval))) - +principal;
|
|
140
118
|
}
|
|
141
119
|
|
|
142
|
-
|
|
120
|
+
return (+principal * (((1 + (+interest / 100) / BLOCKS_IN_A_YEAR)) ** (BLOCKS_IN_A_YEAR * interval))) - +principal; // eslint-disable-line
|
|
143
121
|
};
|
|
144
122
|
|
|
145
123
|
export const calculateNetApy = (usedAssets: MMUsedAssets, assetsData: MMAssetsData, isMorpho = false) => {
|
|
@@ -0,0 +1,434 @@
|
|
|
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 declare namespace EulerV2View {
|
|
25
|
+
export type LiquidityChangeParamsStruct =
|
|
26
|
+
| [string, boolean, number | string | BN, number | string | BN]
|
|
27
|
+
| {
|
|
28
|
+
vault: string;
|
|
29
|
+
isBorrowOperation: boolean;
|
|
30
|
+
liquidityAdded: number | string | BN;
|
|
31
|
+
liquidityRemoved: number | string | BN;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export type LiquidityChangeParamsStructOutputArray = [
|
|
35
|
+
string,
|
|
36
|
+
boolean,
|
|
37
|
+
string,
|
|
38
|
+
string
|
|
39
|
+
];
|
|
40
|
+
export type LiquidityChangeParamsStructOutputStruct = {
|
|
41
|
+
vault: string;
|
|
42
|
+
isBorrowOperation: boolean;
|
|
43
|
+
liquidityAdded: string;
|
|
44
|
+
liquidityRemoved: string;
|
|
45
|
+
};
|
|
46
|
+
export type LiquidityChangeParamsStructOutput =
|
|
47
|
+
LiquidityChangeParamsStructOutputArray &
|
|
48
|
+
LiquidityChangeParamsStructOutputStruct;
|
|
49
|
+
|
|
50
|
+
export type UserCollateralInfoStruct =
|
|
51
|
+
| [
|
|
52
|
+
string,
|
|
53
|
+
boolean,
|
|
54
|
+
number | string | BN,
|
|
55
|
+
number | string | BN,
|
|
56
|
+
number | string | BN
|
|
57
|
+
]
|
|
58
|
+
| {
|
|
59
|
+
collateralVault: string;
|
|
60
|
+
usedInBorrow: boolean;
|
|
61
|
+
collateralAmountInUnit: number | string | BN;
|
|
62
|
+
collateralAmountInAsset: number | string | BN;
|
|
63
|
+
collateralAmountInUSD: number | string | BN;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export type UserCollateralInfoStructOutputArray = [
|
|
67
|
+
string,
|
|
68
|
+
boolean,
|
|
69
|
+
string,
|
|
70
|
+
string,
|
|
71
|
+
string
|
|
72
|
+
];
|
|
73
|
+
export type UserCollateralInfoStructOutputStruct = {
|
|
74
|
+
collateralVault: string;
|
|
75
|
+
usedInBorrow: boolean;
|
|
76
|
+
collateralAmountInUnit: string;
|
|
77
|
+
collateralAmountInAsset: string;
|
|
78
|
+
collateralAmountInUSD: string;
|
|
79
|
+
};
|
|
80
|
+
export type UserCollateralInfoStructOutput =
|
|
81
|
+
UserCollateralInfoStructOutputArray & UserCollateralInfoStructOutputStruct;
|
|
82
|
+
|
|
83
|
+
export type UserDataStruct =
|
|
84
|
+
| [
|
|
85
|
+
string,
|
|
86
|
+
string,
|
|
87
|
+
boolean,
|
|
88
|
+
boolean,
|
|
89
|
+
string,
|
|
90
|
+
number | string | BN,
|
|
91
|
+
number | string | BN,
|
|
92
|
+
EulerV2View.UserCollateralInfoStruct[]
|
|
93
|
+
]
|
|
94
|
+
| {
|
|
95
|
+
user: string;
|
|
96
|
+
owner: string;
|
|
97
|
+
inLockDownMode: boolean;
|
|
98
|
+
inPermitDisabledMode: boolean;
|
|
99
|
+
borrowVault: string;
|
|
100
|
+
borrowAmountInUnit: number | string | BN;
|
|
101
|
+
borrowAmountInAsset: number | string | BN;
|
|
102
|
+
collaterals: EulerV2View.UserCollateralInfoStruct[];
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export type UserDataStructOutputArray = [
|
|
106
|
+
string,
|
|
107
|
+
string,
|
|
108
|
+
boolean,
|
|
109
|
+
boolean,
|
|
110
|
+
string,
|
|
111
|
+
string,
|
|
112
|
+
string,
|
|
113
|
+
EulerV2View.UserCollateralInfoStructOutput[]
|
|
114
|
+
];
|
|
115
|
+
export type UserDataStructOutputStruct = {
|
|
116
|
+
user: string;
|
|
117
|
+
owner: string;
|
|
118
|
+
inLockDownMode: boolean;
|
|
119
|
+
inPermitDisabledMode: boolean;
|
|
120
|
+
borrowVault: string;
|
|
121
|
+
borrowAmountInUnit: string;
|
|
122
|
+
borrowAmountInAsset: string;
|
|
123
|
+
collaterals: EulerV2View.UserCollateralInfoStructOutput[];
|
|
124
|
+
};
|
|
125
|
+
export type UserDataStructOutput = UserDataStructOutputArray &
|
|
126
|
+
UserDataStructOutputStruct;
|
|
127
|
+
|
|
128
|
+
export type CollateralInfoStruct =
|
|
129
|
+
| [
|
|
130
|
+
string,
|
|
131
|
+
string,
|
|
132
|
+
string,
|
|
133
|
+
number | string | BN,
|
|
134
|
+
number | string | BN,
|
|
135
|
+
number | string | BN,
|
|
136
|
+
number | string | BN,
|
|
137
|
+
number | string | BN,
|
|
138
|
+
number | string | BN,
|
|
139
|
+
number | string | BN,
|
|
140
|
+
number | string | BN,
|
|
141
|
+
number | string | BN,
|
|
142
|
+
number | string | BN,
|
|
143
|
+
number | string | BN,
|
|
144
|
+
number | string | BN,
|
|
145
|
+
number | string | BN
|
|
146
|
+
]
|
|
147
|
+
| {
|
|
148
|
+
vaultAddr: string;
|
|
149
|
+
assetAddr: string;
|
|
150
|
+
vaultSymbol: string;
|
|
151
|
+
decimals: number | string | BN;
|
|
152
|
+
sharePriceInUnit: number | string | BN;
|
|
153
|
+
assetPriceInUnit: number | string | BN;
|
|
154
|
+
cash: number | string | BN;
|
|
155
|
+
totalBorrows: number | string | BN;
|
|
156
|
+
supplyCap: number | string | BN;
|
|
157
|
+
borrowLTV: number | string | BN;
|
|
158
|
+
liquidationLTV: number | string | BN;
|
|
159
|
+
initialLiquidationLTV: number | string | BN;
|
|
160
|
+
targetTimestamp: number | string | BN;
|
|
161
|
+
rampDuration: number | string | BN;
|
|
162
|
+
interestFee: number | string | BN;
|
|
163
|
+
interestRate: number | string | BN;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export type CollateralInfoStructOutputArray = [
|
|
167
|
+
string,
|
|
168
|
+
string,
|
|
169
|
+
string,
|
|
170
|
+
string,
|
|
171
|
+
string,
|
|
172
|
+
string,
|
|
173
|
+
string,
|
|
174
|
+
string,
|
|
175
|
+
string,
|
|
176
|
+
string,
|
|
177
|
+
string,
|
|
178
|
+
string,
|
|
179
|
+
string,
|
|
180
|
+
string,
|
|
181
|
+
string,
|
|
182
|
+
string
|
|
183
|
+
];
|
|
184
|
+
export type CollateralInfoStructOutputStruct = {
|
|
185
|
+
vaultAddr: string;
|
|
186
|
+
assetAddr: string;
|
|
187
|
+
vaultSymbol: string;
|
|
188
|
+
decimals: string;
|
|
189
|
+
sharePriceInUnit: string;
|
|
190
|
+
assetPriceInUnit: string;
|
|
191
|
+
cash: string;
|
|
192
|
+
totalBorrows: string;
|
|
193
|
+
supplyCap: string;
|
|
194
|
+
borrowLTV: string;
|
|
195
|
+
liquidationLTV: string;
|
|
196
|
+
initialLiquidationLTV: string;
|
|
197
|
+
targetTimestamp: string;
|
|
198
|
+
rampDuration: string;
|
|
199
|
+
interestFee: string;
|
|
200
|
+
interestRate: string;
|
|
201
|
+
};
|
|
202
|
+
export type CollateralInfoStructOutput = CollateralInfoStructOutputArray &
|
|
203
|
+
CollateralInfoStructOutputStruct;
|
|
204
|
+
|
|
205
|
+
export type VaultInfoFullStruct =
|
|
206
|
+
| [
|
|
207
|
+
string,
|
|
208
|
+
string,
|
|
209
|
+
string,
|
|
210
|
+
string,
|
|
211
|
+
number | string | BN,
|
|
212
|
+
number | string | BN,
|
|
213
|
+
number | string | BN,
|
|
214
|
+
number | string | BN,
|
|
215
|
+
number | string | BN,
|
|
216
|
+
number | string | BN,
|
|
217
|
+
number | string | BN,
|
|
218
|
+
EulerV2View.CollateralInfoStruct[],
|
|
219
|
+
number | string | BN,
|
|
220
|
+
number | string | BN,
|
|
221
|
+
boolean,
|
|
222
|
+
string,
|
|
223
|
+
number | string | BN,
|
|
224
|
+
string,
|
|
225
|
+
number | string | BN,
|
|
226
|
+
number | string | BN,
|
|
227
|
+
number | string | BN,
|
|
228
|
+
string,
|
|
229
|
+
string,
|
|
230
|
+
string,
|
|
231
|
+
string,
|
|
232
|
+
number | string | BN
|
|
233
|
+
]
|
|
234
|
+
| {
|
|
235
|
+
vaultAddr: string;
|
|
236
|
+
assetAddr: string;
|
|
237
|
+
name: string;
|
|
238
|
+
symbol: string;
|
|
239
|
+
decimals: number | string | BN;
|
|
240
|
+
totalSupplyShares: number | string | BN;
|
|
241
|
+
cash: number | string | BN;
|
|
242
|
+
totalBorrows: number | string | BN;
|
|
243
|
+
totalAssets: number | string | BN;
|
|
244
|
+
supplyCap: number | string | BN;
|
|
245
|
+
borrowCap: number | string | BN;
|
|
246
|
+
collaterals: EulerV2View.CollateralInfoStruct[];
|
|
247
|
+
maxLiquidationDiscount: number | string | BN;
|
|
248
|
+
liquidationCoolOffTime: number | string | BN;
|
|
249
|
+
badDebtSocializationEnabled: boolean;
|
|
250
|
+
unitOfAccount: string;
|
|
251
|
+
unitOfAccountInUsd: number | string | BN;
|
|
252
|
+
oracle: string;
|
|
253
|
+
assetPriceInUnit: number | string | BN;
|
|
254
|
+
sharePriceInUnit: number | string | BN;
|
|
255
|
+
interestRate: number | string | BN;
|
|
256
|
+
irm: string;
|
|
257
|
+
balanceTrackerAddress: string;
|
|
258
|
+
creator: string;
|
|
259
|
+
governorAdmin: string;
|
|
260
|
+
interestFee: number | string | BN;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
export type VaultInfoFullStructOutputArray = [
|
|
264
|
+
string,
|
|
265
|
+
string,
|
|
266
|
+
string,
|
|
267
|
+
string,
|
|
268
|
+
string,
|
|
269
|
+
string,
|
|
270
|
+
string,
|
|
271
|
+
string,
|
|
272
|
+
string,
|
|
273
|
+
string,
|
|
274
|
+
string,
|
|
275
|
+
EulerV2View.CollateralInfoStructOutput[],
|
|
276
|
+
string,
|
|
277
|
+
string,
|
|
278
|
+
boolean,
|
|
279
|
+
string,
|
|
280
|
+
string,
|
|
281
|
+
string,
|
|
282
|
+
string,
|
|
283
|
+
string,
|
|
284
|
+
string,
|
|
285
|
+
string,
|
|
286
|
+
string,
|
|
287
|
+
string,
|
|
288
|
+
string,
|
|
289
|
+
string
|
|
290
|
+
];
|
|
291
|
+
export type VaultInfoFullStructOutputStruct = {
|
|
292
|
+
vaultAddr: string;
|
|
293
|
+
assetAddr: string;
|
|
294
|
+
name: string;
|
|
295
|
+
symbol: string;
|
|
296
|
+
decimals: string;
|
|
297
|
+
totalSupplyShares: string;
|
|
298
|
+
cash: string;
|
|
299
|
+
totalBorrows: string;
|
|
300
|
+
totalAssets: string;
|
|
301
|
+
supplyCap: string;
|
|
302
|
+
borrowCap: string;
|
|
303
|
+
collaterals: EulerV2View.CollateralInfoStructOutput[];
|
|
304
|
+
maxLiquidationDiscount: string;
|
|
305
|
+
liquidationCoolOffTime: string;
|
|
306
|
+
badDebtSocializationEnabled: boolean;
|
|
307
|
+
unitOfAccount: string;
|
|
308
|
+
unitOfAccountInUsd: string;
|
|
309
|
+
oracle: string;
|
|
310
|
+
assetPriceInUnit: string;
|
|
311
|
+
sharePriceInUnit: string;
|
|
312
|
+
interestRate: string;
|
|
313
|
+
irm: string;
|
|
314
|
+
balanceTrackerAddress: string;
|
|
315
|
+
creator: string;
|
|
316
|
+
governorAdmin: string;
|
|
317
|
+
interestFee: string;
|
|
318
|
+
};
|
|
319
|
+
export type VaultInfoFullStructOutput = VaultInfoFullStructOutputArray &
|
|
320
|
+
VaultInfoFullStructOutputStruct;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export interface EulerV2View extends BaseContract {
|
|
324
|
+
constructor(
|
|
325
|
+
jsonInterface: any[],
|
|
326
|
+
address?: string,
|
|
327
|
+
options?: ContractOptions
|
|
328
|
+
): EulerV2View;
|
|
329
|
+
clone(): EulerV2View;
|
|
330
|
+
methods: {
|
|
331
|
+
USD(): NonPayableTransactionObject<string>;
|
|
332
|
+
|
|
333
|
+
feedRegistry(): NonPayableTransactionObject<string>;
|
|
334
|
+
|
|
335
|
+
fetchUsedAccounts(
|
|
336
|
+
_account: string,
|
|
337
|
+
_page: number | string | BN,
|
|
338
|
+
_perPage: number | string | BN
|
|
339
|
+
): NonPayableTransactionObject<
|
|
340
|
+
[string, string[]] & { owner: string; accounts: string[] }
|
|
341
|
+
>;
|
|
342
|
+
|
|
343
|
+
getAaveTokenPriceInETH(
|
|
344
|
+
_tokenAddr: string
|
|
345
|
+
): NonPayableTransactionObject<string>;
|
|
346
|
+
|
|
347
|
+
getAaveTokenPriceInUSD(
|
|
348
|
+
_tokenAddr: string
|
|
349
|
+
): NonPayableTransactionObject<string>;
|
|
350
|
+
|
|
351
|
+
getAaveV3TokenPriceInETH(
|
|
352
|
+
_tokenAddr: string
|
|
353
|
+
): NonPayableTransactionObject<string>;
|
|
354
|
+
|
|
355
|
+
getAaveV3TokenPriceInUSD(
|
|
356
|
+
_tokenAddr: string
|
|
357
|
+
): NonPayableTransactionObject<string>;
|
|
358
|
+
|
|
359
|
+
getAddrForChainlinkOracle(
|
|
360
|
+
_inputTokenAddr: string
|
|
361
|
+
): NonPayableTransactionObject<string>;
|
|
362
|
+
|
|
363
|
+
getApyAfterValuesEstimation(
|
|
364
|
+
params: EulerV2View.LiquidityChangeParamsStruct[]
|
|
365
|
+
): NonPayableTransactionObject<string[]>;
|
|
366
|
+
|
|
367
|
+
getChainlinkPriceInETH(
|
|
368
|
+
_inputTokenAddr: string
|
|
369
|
+
): NonPayableTransactionObject<string>;
|
|
370
|
+
|
|
371
|
+
getChainlinkPriceInUSD(
|
|
372
|
+
_inputTokenAddr: string,
|
|
373
|
+
_useFallback: boolean
|
|
374
|
+
): NonPayableTransactionObject<string>;
|
|
375
|
+
|
|
376
|
+
getPriceInETH(_inputTokenAddr: string): NonPayableTransactionObject<string>;
|
|
377
|
+
|
|
378
|
+
getPriceInUSD(_inputTokenAddr: string): NonPayableTransactionObject<string>;
|
|
379
|
+
|
|
380
|
+
"getRoundInfo(address,uint80,address)"(
|
|
381
|
+
_inputTokenAddr: string,
|
|
382
|
+
_roundId: number | string | BN,
|
|
383
|
+
aggregator: string
|
|
384
|
+
): NonPayableTransactionObject<
|
|
385
|
+
[string, string] & { updateTimestamp: string }
|
|
386
|
+
>;
|
|
387
|
+
|
|
388
|
+
"getRoundInfo(address,uint80)"(
|
|
389
|
+
_inputTokenAddr: string,
|
|
390
|
+
_roundId: number | string | BN
|
|
391
|
+
): NonPayableTransactionObject<
|
|
392
|
+
[string, string] & { updateTimestamp: string }
|
|
393
|
+
>;
|
|
394
|
+
|
|
395
|
+
getSparkTokenPriceInETH(
|
|
396
|
+
_tokenAddr: string
|
|
397
|
+
): NonPayableTransactionObject<string>;
|
|
398
|
+
|
|
399
|
+
getSparkTokenPriceInUSD(
|
|
400
|
+
_tokenAddr: string
|
|
401
|
+
): NonPayableTransactionObject<string>;
|
|
402
|
+
|
|
403
|
+
getUserData(
|
|
404
|
+
_user: string
|
|
405
|
+
): NonPayableTransactionObject<EulerV2View.UserDataStructOutput>;
|
|
406
|
+
|
|
407
|
+
getUsersData(
|
|
408
|
+
_users: string[]
|
|
409
|
+
): NonPayableTransactionObject<EulerV2View.UserDataStructOutput[]>;
|
|
410
|
+
|
|
411
|
+
getVaultCollaterals(
|
|
412
|
+
_vault: string
|
|
413
|
+
): NonPayableTransactionObject<EulerV2View.CollateralInfoStructOutput[]>;
|
|
414
|
+
|
|
415
|
+
getVaultInfoFull(
|
|
416
|
+
_vault: string
|
|
417
|
+
): NonPayableTransactionObject<EulerV2View.VaultInfoFullStructOutput>;
|
|
418
|
+
|
|
419
|
+
getVaultsInfosFull(
|
|
420
|
+
_vaults: string[]
|
|
421
|
+
): NonPayableTransactionObject<EulerV2View.VaultInfoFullStructOutput[]>;
|
|
422
|
+
|
|
423
|
+
getWBtcPrice(
|
|
424
|
+
_btcPrice: number | string | BN
|
|
425
|
+
): NonPayableTransactionObject<string>;
|
|
426
|
+
|
|
427
|
+
getWStEthPrice(
|
|
428
|
+
_stEthPrice: number | string | BN
|
|
429
|
+
): NonPayableTransactionObject<string>;
|
|
430
|
+
};
|
|
431
|
+
events: {
|
|
432
|
+
allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
|
|
433
|
+
};
|
|
434
|
+
}
|
|
@@ -29,6 +29,7 @@ export type { CompoundLoanInfo } from "./CompoundLoanInfo";
|
|
|
29
29
|
export type { Comptroller } from "./Comptroller";
|
|
30
30
|
export type { ETHPriceFeed } from "./ETHPriceFeed";
|
|
31
31
|
export type { Erc20 } from "./Erc20";
|
|
32
|
+
export type { EulerV2View } from "./EulerV2View";
|
|
32
33
|
export type { FeedRegistry } from "./FeedRegistry";
|
|
33
34
|
export type { GHO } from "./GHO";
|
|
34
35
|
export type { GhoDiscountRateStrategy } from "./GhoDiscountRateStrategy";
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MMPositionData, NetworkNumber,
|
|
3
|
+
} from './common';
|
|
4
|
+
|
|
5
|
+
export enum EulerV2Versions {
|
|
6
|
+
eUSDC2 = 'eUSDC-2',
|
|
7
|
+
eUSDC8 = 'eUSDC-8',
|
|
8
|
+
eWETH2 = 'eWETH-2',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export enum EulerV2VaultType {
|
|
12
|
+
Escrow = 'Escrow',
|
|
13
|
+
Governed = 'Governed',
|
|
14
|
+
Ungoverned = 'Ungoverned',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface EulerV2Market {
|
|
18
|
+
chainIds: NetworkNumber[],
|
|
19
|
+
label: string,
|
|
20
|
+
shortLabel: string,
|
|
21
|
+
asset: string,
|
|
22
|
+
value: EulerV2Versions,
|
|
23
|
+
secondLabel: string,
|
|
24
|
+
marketAddress: string,
|
|
25
|
+
// icon: Function,
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface EulerV2PositionData extends MMPositionData {
|
|
29
|
+
ratio: string,
|
|
30
|
+
minRatio: string,
|
|
31
|
+
borrowedUsd: string,
|
|
32
|
+
borrowLimitUsd: string,
|
|
33
|
+
incentiveUsd: string,
|
|
34
|
+
totalInterestUsd: string,
|
|
35
|
+
isSubscribedToAutomation?: boolean,
|
|
36
|
+
automationResubscribeRequired?: boolean,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface EulerV2AssetData {
|
|
40
|
+
vaultAddress: string,
|
|
41
|
+
vaultSymbol: string
|
|
42
|
+
sortIndex?: number
|
|
43
|
+
liquidationRatio: string
|
|
44
|
+
cash: string
|
|
45
|
+
supplyCap: string
|
|
46
|
+
assetAddress: string
|
|
47
|
+
decimals: string
|
|
48
|
+
symbol: string
|
|
49
|
+
price: string
|
|
50
|
+
borrowCap: string
|
|
51
|
+
canBeBorrowed: boolean
|
|
52
|
+
canBeSupplied: boolean
|
|
53
|
+
incentiveSupplyApy?: string
|
|
54
|
+
incentiveSupplyToken?: string
|
|
55
|
+
totalBorrow: string
|
|
56
|
+
collateralFactor: string
|
|
57
|
+
borrowRate: string
|
|
58
|
+
supplyRate: string
|
|
59
|
+
utilization: string
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface EulerV2UsedAsset {
|
|
63
|
+
isSupplied: boolean
|
|
64
|
+
isBorrowed: boolean
|
|
65
|
+
supplied: string
|
|
66
|
+
suppliedUsd: string
|
|
67
|
+
borrowed: string
|
|
68
|
+
borrowedUsd: string
|
|
69
|
+
symbol: string
|
|
70
|
+
collateral: boolean
|
|
71
|
+
vaultAddress: string
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface EulerV2MarketInfoData {
|
|
75
|
+
name: string,
|
|
76
|
+
symbol: string,
|
|
77
|
+
decimals: string,
|
|
78
|
+
vaultAddress: string,
|
|
79
|
+
irm: string,
|
|
80
|
+
creator: string,
|
|
81
|
+
governorAdmin: string,
|
|
82
|
+
unitOfAccount: string,
|
|
83
|
+
unitOfAccountUsdPrice: string,
|
|
84
|
+
isInUSD: boolean,
|
|
85
|
+
oracle: string,
|
|
86
|
+
collaterals: string[],
|
|
87
|
+
isEscrow: boolean,
|
|
88
|
+
isGoverned: boolean,
|
|
89
|
+
vaultType: EulerV2VaultType,
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export type EulerV2AssetsData = { [key: string]: EulerV2AssetData };
|
|
93
|
+
export type EulerV2UsedAssets = { [key: string]: EulerV2UsedAsset };
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
export interface EulerV2CollateralInfo {
|
|
97
|
+
lltv: string
|
|
98
|
+
borrowLtv: string
|
|
99
|
+
totalBorrows: string
|
|
100
|
+
cash: string
|
|
101
|
+
supplyCap: string
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface EulerV2MarketData {
|
|
105
|
+
name: string
|
|
106
|
+
symbol: string
|
|
107
|
+
decimals: number
|
|
108
|
+
|
|
109
|
+
totalSupplyShares: string
|
|
110
|
+
cash: string
|
|
111
|
+
totalBorrows: string
|
|
112
|
+
totalAssets: string
|
|
113
|
+
supplyCap: string
|
|
114
|
+
borrowCap: string
|
|
115
|
+
|
|
116
|
+
collaterals: string[]
|
|
117
|
+
|
|
118
|
+
badDebtSocializationEnabled: boolean
|
|
119
|
+
|
|
120
|
+
unitOfAccount: string
|
|
121
|
+
oracle: string
|
|
122
|
+
assetPrice: string
|
|
123
|
+
|
|
124
|
+
interestRate: string
|
|
125
|
+
irm: string
|
|
126
|
+
|
|
127
|
+
creator: string
|
|
128
|
+
|
|
129
|
+
governorAdmin: string
|
|
130
|
+
|
|
131
|
+
interestFee: string
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface EulerV2FullMarketData {
|
|
135
|
+
marketData: EulerV2MarketInfoData
|
|
136
|
+
assetsData: EulerV2AssetsData
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface EulerV2AccountData {
|
|
140
|
+
owner: string
|
|
141
|
+
inLockDownMode: boolean
|
|
142
|
+
inPermitDisabledMode: boolean
|
|
143
|
+
|
|
144
|
+
borrowVault: string
|
|
145
|
+
borrowAmountInUnit: string
|
|
146
|
+
|
|
147
|
+
collaterals: string[] // all collaterals user has enabled on main evc contract (globally - not only collaterals for his borrow market)
|
|
148
|
+
collateralAmountsInUnit: string[] // only amounts used as collateral for his debt (empty array if no debt)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface EulerV2AggregatedPositionData {
|
|
152
|
+
suppliedUsd: string,
|
|
153
|
+
suppliedCollateralUsd: string,
|
|
154
|
+
borrowedUsd: string,
|
|
155
|
+
borrowLimitUsd: string,
|
|
156
|
+
liquidationLimitUsd: string,
|
|
157
|
+
leftToBorrowUsd: string,
|
|
158
|
+
ratio: string,
|
|
159
|
+
collRatio: string,
|
|
160
|
+
netApy: string,
|
|
161
|
+
incentiveUsd: string,
|
|
162
|
+
totalInterestUsd: string,
|
|
163
|
+
liqRatio: string,
|
|
164
|
+
liqPercent: string,
|
|
165
|
+
leveragedType: string,
|
|
166
|
+
leveragedAsset?: string,
|
|
167
|
+
leveragedLsdAssetRatio?: string,
|
|
168
|
+
liquidationPrice?: string,
|
|
169
|
+
minRatio: string,
|
|
170
|
+
minDebt: string,
|
|
171
|
+
}
|
package/src/types/index.ts
CHANGED
package/src/types/morphoBlue.ts
CHANGED
|
@@ -11,7 +11,6 @@ export enum MorphoBlueVersions {
|
|
|
11
11
|
MorphoBlueWstEthUSDA_Exchange_Rate = 'morphobluewstethusda_exchange_rate', // wstETH/USDA
|
|
12
12
|
MorphoBlueWstEthPYUSD = 'morphobluwstethpyusd', // wstETH/PYUSD
|
|
13
13
|
MorphoBlueWeEthEth = 'morphoblueweetheth', // weETH/ETH
|
|
14
|
-
MorphoBlueREthEth_945 = 'morphoblueretheth_945', // rETH/ETH
|
|
15
14
|
MorphoBlueWBTCPYUSD = 'morphobluewbtcpyusd', // WBTC/PYUSD
|
|
16
15
|
MorphoBlueWBTCEth = 'morphobluewbtceth', // WBTC/ETH
|
|
17
16
|
MorphoBlueUSDeUSDT = 'morphoblueusdeusdt', // USDe/USDT
|
|
@@ -49,7 +48,6 @@ export enum MorphoBlueVersions {
|
|
|
49
48
|
MorphoBlueREthEth_945_Base = 'morphoblueretheth_945_base',
|
|
50
49
|
MorphoBlueCbBTCEth_915_Base = 'morphobluecbbtceth_915_base',
|
|
51
50
|
MorphoBlueCbBTCUSDC_860_Base = 'morphobluecbbtcusdc_860_base',
|
|
52
|
-
MorphoBlueWsuperOETHbWETH_915_Base = 'morphobluewsuperoethbweth_915_base',
|
|
53
51
|
}
|
|
54
52
|
|
|
55
53
|
export enum MorphoBlueOracleType {
|