@defisaver/positions-sdk 2.1.127-midnight-7-dev → 2.1.127-midnight-9-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/aaveV4/index.js +26 -10
- package/cjs/aaveV4/merkl.d.ts +2 -1
- package/cjs/aaveV4/merkl.js +42 -35
- package/cjs/config/contracts.d.ts +0 -938
- package/cjs/config/contracts.js +2 -8
- package/cjs/contracts.d.ts +0 -23433
- package/cjs/contracts.js +2 -3
- package/cjs/helpers/aaveV4Helpers/index.d.ts +7 -1
- package/cjs/helpers/aaveV4Helpers/index.js +22 -10
- package/cjs/helpers/index.d.ts +0 -1
- package/cjs/helpers/index.js +1 -2
- package/cjs/index.d.ts +1 -2
- package/cjs/index.js +1 -3
- package/cjs/markets/index.d.ts +0 -1
- package/cjs/markets/index.js +1 -3
- package/cjs/markets/morphoBlue/index.d.ts +6 -0
- package/cjs/markets/morphoBlue/index.js +53 -2
- package/cjs/morphoMidnight/index.js +1 -1
- package/cjs/portfolio/discovery.d.ts +1 -1
- package/cjs/portfolio/discovery.js +1 -1
- package/cjs/portfolio/index.js +0 -32
- package/cjs/services/utils.d.ts +1 -0
- package/cjs/services/utils.js +3 -1
- package/cjs/staking/staking.js +1 -2
- package/cjs/types/aaveV4.d.ts +5 -0
- package/cjs/types/common.d.ts +4 -0
- package/cjs/types/common.js +6 -1
- package/cjs/types/index.d.ts +0 -1
- package/cjs/types/index.js +0 -1
- package/cjs/types/merkl.d.ts +3 -4
- package/cjs/types/morphoBlue.d.ts +3 -0
- package/cjs/types/morphoBlue.js +3 -0
- package/cjs/types/portfolio.d.ts +0 -4
- package/esm/aaveV4/index.js +27 -11
- package/esm/aaveV4/merkl.d.ts +2 -1
- package/esm/aaveV4/merkl.js +41 -35
- package/esm/config/contracts.d.ts +0 -938
- package/esm/config/contracts.js +0 -6
- package/esm/contracts.d.ts +0 -23433
- package/esm/contracts.js +0 -1
- package/esm/helpers/aaveV4Helpers/index.d.ts +7 -1
- package/esm/helpers/aaveV4Helpers/index.js +21 -10
- package/esm/helpers/index.d.ts +0 -1
- package/esm/helpers/index.js +0 -1
- package/esm/index.d.ts +1 -2
- package/esm/index.js +1 -2
- package/esm/markets/index.d.ts +0 -1
- package/esm/markets/index.js +0 -1
- package/esm/markets/morphoBlue/index.d.ts +6 -0
- package/esm/markets/morphoBlue/index.js +48 -0
- package/esm/morphoMidnight/index.js +1 -1
- package/esm/portfolio/discovery.d.ts +1 -1
- package/esm/portfolio/discovery.js +1 -1
- package/esm/portfolio/index.js +1 -33
- package/esm/services/utils.d.ts +1 -0
- package/esm/services/utils.js +1 -0
- package/esm/staking/staking.js +1 -2
- package/esm/types/aaveV4.d.ts +5 -0
- package/esm/types/common.d.ts +4 -0
- package/esm/types/common.js +5 -0
- package/esm/types/index.d.ts +0 -1
- package/esm/types/index.js +0 -1
- package/esm/types/merkl.d.ts +3 -4
- package/esm/types/morphoBlue.d.ts +3 -0
- package/esm/types/morphoBlue.js +3 -0
- package/esm/types/portfolio.d.ts +0 -4
- package/package.json +1 -1
- package/src/aaveV4/index.ts +29 -11
- package/src/aaveV4/merkl.ts +41 -32
- package/src/config/contracts.ts +0 -6
- package/src/contracts.ts +0 -1
- package/src/helpers/aaveV4Helpers/index.ts +22 -9
- package/src/helpers/index.ts +0 -1
- package/src/index.ts +0 -2
- package/src/markets/index.ts +0 -1
- package/src/markets/morphoBlue/index.ts +49 -1
- package/src/morphoMidnight/index.ts +1 -1
- package/src/portfolio/discovery.ts +1 -1
- package/src/portfolio/index.ts +0 -33
- package/src/services/utils.ts +2 -0
- package/src/staking/staking.ts +1 -2
- package/src/types/aaveV4.ts +5 -0
- package/src/types/common.ts +5 -0
- package/src/types/index.ts +0 -1
- package/src/types/merkl.ts +3 -3
- package/src/types/morphoBlue.ts +3 -0
- package/src/types/portfolio.ts +0 -4
- package/cjs/eulerV2/index.d.ts +0 -47
- package/cjs/eulerV2/index.js +0 -225
- package/cjs/helpers/eulerHelpers/index.d.ts +0 -22
- package/cjs/helpers/eulerHelpers/index.js +0 -231
- package/cjs/markets/euler/index.d.ts +0 -8
- package/cjs/markets/euler/index.js +0 -30
- package/cjs/types/euler.d.ts +0 -153
- package/cjs/types/euler.js +0 -14
- package/esm/eulerV2/index.d.ts +0 -47
- package/esm/eulerV2/index.js +0 -215
- package/esm/helpers/eulerHelpers/index.d.ts +0 -22
- package/esm/helpers/eulerHelpers/index.js +0 -218
- package/esm/markets/euler/index.d.ts +0 -8
- package/esm/markets/euler/index.js +0 -24
- package/esm/types/euler.d.ts +0 -153
- package/esm/types/euler.js +0 -11
- package/src/eulerV2/index.ts +0 -331
- package/src/helpers/eulerHelpers/index.ts +0 -232
- package/src/markets/euler/index.ts +0 -27
- package/src/types/euler.ts +0 -178
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
-
var t = {};
|
|
12
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
-
t[p] = s[p];
|
|
14
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
-
t[p[i]] = s[p[i]];
|
|
18
|
-
}
|
|
19
|
-
return t;
|
|
20
|
-
};
|
|
21
|
-
import Dec from 'decimal.js';
|
|
22
|
-
import { assetAmountInWei } from '@defisaver/tokens';
|
|
23
|
-
import { LeverageType, } from '../../types/common';
|
|
24
|
-
import { calcLeverageLiqPrice, getAssetsTotal, getExposure, STABLE_ASSETS, } from '../../moneymarket';
|
|
25
|
-
import { calculateNetApy } from '../../staking';
|
|
26
|
-
import { EulerV2ViewContractViem } from '../../contracts';
|
|
27
|
-
import { borrowOperations } from '../../constants';
|
|
28
|
-
import { getViemProvider } from '../../services/viem';
|
|
29
|
-
export const isLeveragedPos = (usedAssets, dustLimit = 5) => {
|
|
30
|
-
let borrowUnstable = 0;
|
|
31
|
-
let supplyStable = 0;
|
|
32
|
-
let borrowStable = 0;
|
|
33
|
-
let supplyUnstable = 0;
|
|
34
|
-
let longAsset = '';
|
|
35
|
-
let shortAsset = '';
|
|
36
|
-
let leverageAssetVault = '';
|
|
37
|
-
Object.values(usedAssets).forEach(({ symbol, suppliedUsd, borrowedUsd, collateral, vaultAddress, }) => {
|
|
38
|
-
const isSupplied = (+suppliedUsd) > dustLimit; // ignore dust like <limit leftover supply
|
|
39
|
-
const isBorrowed = (+borrowedUsd) > dustLimit; // ignore dust like <limit leftover supply
|
|
40
|
-
if (isSupplied && STABLE_ASSETS.includes(symbol) && collateral)
|
|
41
|
-
supplyStable += 1;
|
|
42
|
-
if (isBorrowed && STABLE_ASSETS.includes(symbol))
|
|
43
|
-
borrowStable += 1;
|
|
44
|
-
if (isBorrowed && !STABLE_ASSETS.includes(symbol)) {
|
|
45
|
-
borrowUnstable += 1;
|
|
46
|
-
shortAsset = symbol;
|
|
47
|
-
leverageAssetVault = vaultAddress;
|
|
48
|
-
}
|
|
49
|
-
if (isSupplied && !STABLE_ASSETS.includes(symbol) && collateral) {
|
|
50
|
-
supplyUnstable += 1;
|
|
51
|
-
longAsset = symbol;
|
|
52
|
-
leverageAssetVault = vaultAddress;
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
const isLong = borrowStable > 0 && borrowUnstable === 0 && supplyUnstable === 1 && supplyStable === 0;
|
|
56
|
-
const isShort = supplyStable > 0 && supplyUnstable === 0 && borrowUnstable === 1 && borrowStable === 0;
|
|
57
|
-
const isVolatilePair = supplyUnstable === 1 && borrowUnstable === 1 && supplyStable === 0 && borrowStable === 0;
|
|
58
|
-
if (isLong) {
|
|
59
|
-
return {
|
|
60
|
-
leveragedType: LeverageType.Long,
|
|
61
|
-
leveragedAsset: longAsset,
|
|
62
|
-
leveragedVault: leverageAssetVault,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
if (isShort) {
|
|
66
|
-
return {
|
|
67
|
-
leveragedType: LeverageType.Short,
|
|
68
|
-
leveragedAsset: shortAsset,
|
|
69
|
-
leveragedVault: leverageAssetVault,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
if (isVolatilePair) {
|
|
73
|
-
return {
|
|
74
|
-
leveragedType: LeverageType.VolatilePair,
|
|
75
|
-
leveragedAsset: longAsset,
|
|
76
|
-
leveragedVault: leverageAssetVault,
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
return {
|
|
80
|
-
leveragedType: LeverageType.None,
|
|
81
|
-
leveragedAsset: '',
|
|
82
|
-
leveragedVault: '',
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
export const getEulerV2AggregatedData = (_a) => {
|
|
86
|
-
var { usedAssets, assetsData, network } = _a, rest = __rest(_a, ["usedAssets", "assetsData", "network"]);
|
|
87
|
-
const payload = {};
|
|
88
|
-
payload.suppliedUsd = getAssetsTotal(usedAssets, ({ isSupplied }) => isSupplied, ({ suppliedUsd }) => suppliedUsd);
|
|
89
|
-
payload.suppliedCollateralUsd = getAssetsTotal(usedAssets, ({ isSupplied, collateral }) => isSupplied && collateral, ({ suppliedUsd }) => suppliedUsd);
|
|
90
|
-
payload.borrowedUsd = getAssetsTotal(usedAssets, ({ isBorrowed }) => isBorrowed, ({ borrowedUsd }) => borrowedUsd);
|
|
91
|
-
payload.borrowLimitUsd = getAssetsTotal(usedAssets, ({ isSupplied, collateral }) => isSupplied && collateral, ({ vaultAddress, suppliedUsd }) => new Dec(suppliedUsd).mul(assetsData[vaultAddress.toLowerCase()].collateralFactor));
|
|
92
|
-
payload.liquidationLimitUsd = getAssetsTotal(usedAssets, ({ isSupplied, collateral }) => isSupplied && collateral, ({ vaultAddress, suppliedUsd }) => new Dec(suppliedUsd).mul(assetsData[vaultAddress.toLowerCase()].liquidationRatio));
|
|
93
|
-
const leftToBorrowUsd = new Dec(payload.borrowLimitUsd).sub(payload.borrowedUsd);
|
|
94
|
-
payload.leftToBorrowUsd = leftToBorrowUsd.lte('0') ? '0' : leftToBorrowUsd.toString();
|
|
95
|
-
payload.ratio = +payload.suppliedUsd ? new Dec(payload.borrowLimitUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
|
|
96
|
-
payload.collRatio = +payload.suppliedUsd ? new Dec(payload.suppliedCollateralUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
|
|
97
|
-
const { netApy, incentiveUsd, totalInterestUsd } = calculateNetApy({ usedAssets, assetsData: assetsData });
|
|
98
|
-
payload.netApy = netApy;
|
|
99
|
-
payload.incentiveUsd = incentiveUsd;
|
|
100
|
-
payload.totalInterestUsd = totalInterestUsd;
|
|
101
|
-
payload.minRatio = '100';
|
|
102
|
-
payload.liqRatio = new Dec(payload.borrowLimitUsd).div(payload.liquidationLimitUsd).toString();
|
|
103
|
-
payload.liqPercent = new Dec(payload.borrowLimitUsd).div(payload.liquidationLimitUsd).mul(100).toString();
|
|
104
|
-
const { leveragedType, leveragedAsset, leveragedVault } = isLeveragedPos(usedAssets);
|
|
105
|
-
payload.leveragedType = leveragedType;
|
|
106
|
-
payload.liquidationPrice = '';
|
|
107
|
-
if (leveragedType !== '') {
|
|
108
|
-
payload.leveragedAsset = leveragedAsset;
|
|
109
|
-
let assetPrice = assetsData[leveragedVault.toLowerCase()].price;
|
|
110
|
-
if (leveragedType === LeverageType.VolatilePair) {
|
|
111
|
-
const borrowedAsset = Object.values(usedAssets).find(({ borrowedUsd }) => +borrowedUsd > 0);
|
|
112
|
-
const borrowedAssetPrice = assetsData[borrowedAsset.vaultAddress.toLowerCase()].price;
|
|
113
|
-
const leveragedAssetPrice = assetsData[leveragedVault.toLowerCase()].price;
|
|
114
|
-
const isReverse = new Dec(leveragedAssetPrice).lt(borrowedAssetPrice);
|
|
115
|
-
if (isReverse) {
|
|
116
|
-
payload.leveragedType = LeverageType.VolatilePairReverse;
|
|
117
|
-
payload.currentVolatilePairRatio = new Dec(borrowedAssetPrice).div(leveragedAssetPrice).toDP(18).toString();
|
|
118
|
-
assetPrice = new Dec(borrowedAssetPrice).div(assetPrice).toString();
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
assetPrice = new Dec(assetPrice).div(borrowedAssetPrice).toString();
|
|
122
|
-
payload.currentVolatilePairRatio = new Dec(leveragedAssetPrice).div(borrowedAssetPrice).toDP(18).toString();
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
payload.liquidationPrice = calcLeverageLiqPrice(payload.leveragedType, assetPrice, payload.borrowedUsd, payload.liquidationLimitUsd);
|
|
126
|
-
}
|
|
127
|
-
payload.minCollRatio = new Dec(payload.suppliedCollateralUsd).div(payload.borrowLimitUsd).mul(100).toString();
|
|
128
|
-
payload.collLiquidationRatio = new Dec(payload.suppliedCollateralUsd).div(payload.liquidationLimitUsd).mul(100).toString();
|
|
129
|
-
payload.exposure = getExposure(payload.borrowedUsd, payload.suppliedUsd);
|
|
130
|
-
return payload;
|
|
131
|
-
};
|
|
132
|
-
export const getEulerV2BorrowRate = (interestRate) => {
|
|
133
|
-
const _interestRate = new Dec(interestRate).div(1e27).toString();
|
|
134
|
-
const secondsPerYear = 31556953;
|
|
135
|
-
const a = new Dec(1).plus(_interestRate).pow(secondsPerYear - 1).toString();
|
|
136
|
-
return new Dec(new Dec(a).minus(1)).mul(100).toString();
|
|
137
|
-
};
|
|
138
|
-
export const getUtilizationRate = (totalBorrows, totalAssets) => new Dec(totalBorrows).div(totalAssets).toString();
|
|
139
|
-
export const getEulerV2SupplyRate = (borrowRate, utilizationRate, _interestFee) => {
|
|
140
|
-
const interestFee = new Dec(_interestFee).div(10000);
|
|
141
|
-
const fee = new Dec(1).minus(interestFee);
|
|
142
|
-
return new Dec(borrowRate).mul(utilizationRate).mul(fee).toString();
|
|
143
|
-
};
|
|
144
|
-
const getLiquidityChanges = (action, amount, isBorrowOperation) => {
|
|
145
|
-
let liquidityAdded;
|
|
146
|
-
let liquidityRemoved;
|
|
147
|
-
if (isBorrowOperation) {
|
|
148
|
-
liquidityAdded = action === 'payback' ? amount : '0';
|
|
149
|
-
liquidityRemoved = action === 'borrow' ? amount : '0';
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
liquidityAdded = action === 'collateral' ? amount : '0';
|
|
153
|
-
liquidityRemoved = action === 'withdraw' ? amount : '0';
|
|
154
|
-
}
|
|
155
|
-
return { liquidityAdded, liquidityRemoved };
|
|
156
|
-
};
|
|
157
|
-
export const getApyAfterValuesEstimationEulerV2 = (actions, provider, network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
158
|
-
const client = getViemProvider(provider, network, { batch: { multicall: true } });
|
|
159
|
-
const eulerV2ViewContract = EulerV2ViewContractViem(client, network);
|
|
160
|
-
const apyAfterValuesEstimationParams = [];
|
|
161
|
-
actions.forEach(({ action, amount, asset, vaultAddress, }) => {
|
|
162
|
-
const amountInWei = assetAmountInWei(amount, asset);
|
|
163
|
-
const isBorrowOperation = borrowOperations.includes(action);
|
|
164
|
-
const { liquidityAdded, liquidityRemoved } = getLiquidityChanges(action, amountInWei, isBorrowOperation);
|
|
165
|
-
apyAfterValuesEstimationParams.push({
|
|
166
|
-
vault: vaultAddress,
|
|
167
|
-
isBorrowOperation: borrowOperations.includes(action),
|
|
168
|
-
liquidityAdded: BigInt(liquidityAdded),
|
|
169
|
-
liquidityRemoved: BigInt(liquidityRemoved),
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
const res = yield Promise.all([
|
|
173
|
-
...actions.map(({ vaultAddress }) => eulerV2ViewContract.read.getVaultInfoFull([vaultAddress])),
|
|
174
|
-
// @ts-ignore
|
|
175
|
-
eulerV2ViewContract.read.getApyAfterValuesEstimation([apyAfterValuesEstimationParams]),
|
|
176
|
-
]);
|
|
177
|
-
const numOfActions = actions.length;
|
|
178
|
-
const data = {};
|
|
179
|
-
for (let i = 0; i < numOfActions; i += 1) {
|
|
180
|
-
// @ts-ignore
|
|
181
|
-
const _interestRate = res[numOfActions][i].toString();
|
|
182
|
-
// @ts-ignore
|
|
183
|
-
const vaultInfo = res[i];
|
|
184
|
-
const decimals = vaultInfo.decimals.toString();
|
|
185
|
-
const borrowRate = getEulerV2BorrowRate(_interestRate);
|
|
186
|
-
const amount = new Dec(actions[i].amount).mul(Math.pow(10, decimals)).toString();
|
|
187
|
-
const action = actions[i].action;
|
|
188
|
-
const isBorrowOperation = borrowOperations.includes(action);
|
|
189
|
-
const { liquidityAdded, liquidityRemoved } = getLiquidityChanges(action, amount, isBorrowOperation);
|
|
190
|
-
const totalBorrows = new Dec(vaultInfo.totalBorrows.toString()).add(isBorrowOperation ? liquidityRemoved : '0').sub(isBorrowOperation ? liquidityAdded : '0').toString();
|
|
191
|
-
const totalAssets = new Dec(vaultInfo.totalAssets.toString()).add(isBorrowOperation ? '0' : liquidityAdded).sub(isBorrowOperation ? '0' : liquidityRemoved).toString();
|
|
192
|
-
const utilizationRate = getUtilizationRate(totalBorrows, totalAssets);
|
|
193
|
-
data[vaultInfo.vaultAddr.toLowerCase()] = {
|
|
194
|
-
borrowRate,
|
|
195
|
-
supplyRate: getEulerV2SupplyRate(borrowRate, utilizationRate, vaultInfo.interestFee.toString()),
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
return data;
|
|
199
|
-
});
|
|
200
|
-
const xorLastByte = (address, xorValue) => {
|
|
201
|
-
// Extract the last byte (2 hex characters)
|
|
202
|
-
const lastByte = address.slice(-2);
|
|
203
|
-
// XOR the last byte with the given xorValue
|
|
204
|
-
// eslint-disable-next-line no-bitwise
|
|
205
|
-
const xorResult = [...lastByte].map((char, i) => (parseInt(char, 16) ^ parseInt(xorValue[i], 16)).toString(16)).join('');
|
|
206
|
-
// Return the full address with the last byte XORed
|
|
207
|
-
return `0x${address.slice(0, -2)}${xorResult.padStart(2, '0')}`;
|
|
208
|
-
};
|
|
209
|
-
export const getEulerV2SubAccounts = (address) => {
|
|
210
|
-
// Clean the address by removing "0x"
|
|
211
|
-
const cleanAddress = address.toLowerCase().replace(/^0x/, '');
|
|
212
|
-
// XOR the last byte with 0x01, 0x02, and 0x03
|
|
213
|
-
const xorWith01 = xorLastByte(cleanAddress, '01');
|
|
214
|
-
const xorWith02 = xorLastByte(cleanAddress, '02');
|
|
215
|
-
const xorWith03 = xorLastByte(cleanAddress, '03');
|
|
216
|
-
// Return an array with all three modified addresses
|
|
217
|
-
return [xorWith01, xorWith02, xorWith03];
|
|
218
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { NetworkNumber } from '../../types/common';
|
|
2
|
-
import { EulerV2Market } from '../../types';
|
|
3
|
-
export declare const eUSDC2: (networkId: NetworkNumber) => EulerV2Market;
|
|
4
|
-
export declare const eWETH2: (networkId: NetworkNumber) => EulerV2Market;
|
|
5
|
-
export declare const EulerV2Markets: (networkId: NetworkNumber) => {
|
|
6
|
-
readonly "eUSDC-2": EulerV2Market;
|
|
7
|
-
readonly "eWETH-2": EulerV2Market;
|
|
8
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { NetworkNumber } from '../../types/common';
|
|
2
|
-
import { EulerV2Versions } from '../../types';
|
|
3
|
-
export const eUSDC2 = (networkId) => ({
|
|
4
|
-
chainIds: [NetworkNumber.Eth],
|
|
5
|
-
label: 'Euler Prime USDC',
|
|
6
|
-
shortLabel: 'eUSDC-2',
|
|
7
|
-
value: EulerV2Versions.eUSDC2,
|
|
8
|
-
asset: 'USDC',
|
|
9
|
-
secondLabel: 'Market',
|
|
10
|
-
marketAddress: '0x797DD80692c3b2dAdabCe8e30C07fDE5307D48a9',
|
|
11
|
-
});
|
|
12
|
-
export const eWETH2 = (networkId) => ({
|
|
13
|
-
chainIds: [NetworkNumber.Eth],
|
|
14
|
-
label: 'Euler Prime WETH',
|
|
15
|
-
shortLabel: 'eWETH-2',
|
|
16
|
-
value: EulerV2Versions.eWETH2,
|
|
17
|
-
asset: 'WETH',
|
|
18
|
-
secondLabel: 'Market',
|
|
19
|
-
marketAddress: '0xD8b27CF359b7D15710a5BE299AF6e7Bf904984C2',
|
|
20
|
-
});
|
|
21
|
-
export const EulerV2Markets = (networkId) => ({
|
|
22
|
-
[EulerV2Versions.eUSDC2]: eUSDC2(networkId),
|
|
23
|
-
[EulerV2Versions.eWETH2]: eWETH2(networkId),
|
|
24
|
-
});
|
package/esm/types/euler.d.ts
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { EthAddress, IncentiveData, LeverageType, MMPositionData, NetworkNumber } from './common';
|
|
2
|
-
export declare enum EulerV2Versions {
|
|
3
|
-
eUSDC2 = "eUSDC-2",
|
|
4
|
-
eWETH2 = "eWETH-2"
|
|
5
|
-
}
|
|
6
|
-
export declare enum EulerV2VaultType {
|
|
7
|
-
Escrow = "Escrow",
|
|
8
|
-
Governed = "Governed",
|
|
9
|
-
Ungoverned = "Ungoverned"
|
|
10
|
-
}
|
|
11
|
-
export interface EulerV2Market {
|
|
12
|
-
chainIds: NetworkNumber[];
|
|
13
|
-
label: string;
|
|
14
|
-
shortLabel: string;
|
|
15
|
-
asset: string;
|
|
16
|
-
value: EulerV2Versions;
|
|
17
|
-
secondLabel: string;
|
|
18
|
-
marketAddress: EthAddress;
|
|
19
|
-
}
|
|
20
|
-
export interface EulerV2PositionData extends MMPositionData {
|
|
21
|
-
ratio: string;
|
|
22
|
-
minRatio: string;
|
|
23
|
-
suppliedUsd: string;
|
|
24
|
-
borrowedUsd: string;
|
|
25
|
-
borrowLimitUsd: string;
|
|
26
|
-
incentiveUsd: string;
|
|
27
|
-
totalInterestUsd: string;
|
|
28
|
-
isSubscribedToAutomation?: boolean;
|
|
29
|
-
automationResubscribeRequired?: boolean;
|
|
30
|
-
}
|
|
31
|
-
export interface EulerV2AssetData {
|
|
32
|
-
vaultAddress: string;
|
|
33
|
-
vaultSymbol: string;
|
|
34
|
-
sortIndex?: number;
|
|
35
|
-
liquidationRatio: string;
|
|
36
|
-
cash: string;
|
|
37
|
-
supplyCap: string;
|
|
38
|
-
assetAddress: string;
|
|
39
|
-
decimals: string;
|
|
40
|
-
symbol: string;
|
|
41
|
-
price: string;
|
|
42
|
-
borrowCap: string;
|
|
43
|
-
canBeBorrowed: boolean;
|
|
44
|
-
canBeSupplied: boolean;
|
|
45
|
-
supplyIncentives: IncentiveData[];
|
|
46
|
-
borrowIncentives: IncentiveData[];
|
|
47
|
-
totalBorrow: string;
|
|
48
|
-
collateralFactor: string;
|
|
49
|
-
borrowRate: string;
|
|
50
|
-
supplyRate: string;
|
|
51
|
-
utilization: string;
|
|
52
|
-
governorAdmin: string;
|
|
53
|
-
vaultType: EulerV2VaultType;
|
|
54
|
-
}
|
|
55
|
-
export interface EulerV2UsedAsset {
|
|
56
|
-
isSupplied: boolean;
|
|
57
|
-
isBorrowed: boolean;
|
|
58
|
-
supplied: string;
|
|
59
|
-
suppliedUsd: string;
|
|
60
|
-
borrowed: string;
|
|
61
|
-
borrowedUsd: string;
|
|
62
|
-
symbol: string;
|
|
63
|
-
collateral: boolean;
|
|
64
|
-
vaultAddress: string;
|
|
65
|
-
}
|
|
66
|
-
export interface EulerV2MarketInfoData {
|
|
67
|
-
name: string;
|
|
68
|
-
symbol: string;
|
|
69
|
-
decimals: string;
|
|
70
|
-
vaultAddress: string;
|
|
71
|
-
irm: string;
|
|
72
|
-
creator: string;
|
|
73
|
-
governorAdmin: string;
|
|
74
|
-
unitOfAccount: string;
|
|
75
|
-
unitOfAccountUsdPrice: string;
|
|
76
|
-
isInUSD: boolean;
|
|
77
|
-
oracle: string;
|
|
78
|
-
collaterals: string[];
|
|
79
|
-
isEscrow: boolean;
|
|
80
|
-
isGoverned: boolean;
|
|
81
|
-
vaultType: EulerV2VaultType;
|
|
82
|
-
}
|
|
83
|
-
export type EulerV2AssetsData = {
|
|
84
|
-
[key: string]: EulerV2AssetData;
|
|
85
|
-
};
|
|
86
|
-
export type EulerV2UsedAssets = {
|
|
87
|
-
[key: string]: EulerV2UsedAsset;
|
|
88
|
-
};
|
|
89
|
-
export interface EulerV2CollateralInfo {
|
|
90
|
-
lltv: string;
|
|
91
|
-
borrowLtv: string;
|
|
92
|
-
totalBorrows: string;
|
|
93
|
-
cash: string;
|
|
94
|
-
supplyCap: string;
|
|
95
|
-
}
|
|
96
|
-
export interface EulerV2MarketData {
|
|
97
|
-
name: string;
|
|
98
|
-
symbol: string;
|
|
99
|
-
decimals: number;
|
|
100
|
-
totalSupplyShares: string;
|
|
101
|
-
cash: string;
|
|
102
|
-
totalBorrows: string;
|
|
103
|
-
totalAssets: string;
|
|
104
|
-
supplyCap: string;
|
|
105
|
-
borrowCap: string;
|
|
106
|
-
collaterals: string[];
|
|
107
|
-
badDebtSocializationEnabled: boolean;
|
|
108
|
-
unitOfAccount: string;
|
|
109
|
-
oracle: string;
|
|
110
|
-
assetPrice: string;
|
|
111
|
-
interestRate: string;
|
|
112
|
-
irm: string;
|
|
113
|
-
creator: string;
|
|
114
|
-
governorAdmin: string;
|
|
115
|
-
interestFee: string;
|
|
116
|
-
}
|
|
117
|
-
export interface EulerV2FullMarketData {
|
|
118
|
-
marketData: EulerV2MarketInfoData;
|
|
119
|
-
assetsData: EulerV2AssetsData;
|
|
120
|
-
}
|
|
121
|
-
export interface EulerV2AccountData {
|
|
122
|
-
owner: string;
|
|
123
|
-
inLockDownMode: boolean;
|
|
124
|
-
inPermitDisabledMode: boolean;
|
|
125
|
-
borrowVault: string;
|
|
126
|
-
borrowAmountInUnit: string;
|
|
127
|
-
collaterals: string[];
|
|
128
|
-
collateralAmountsInUnit: string[];
|
|
129
|
-
}
|
|
130
|
-
export interface EulerV2AggregatedPositionData {
|
|
131
|
-
suppliedUsd: string;
|
|
132
|
-
suppliedCollateralUsd: string;
|
|
133
|
-
borrowedUsd: string;
|
|
134
|
-
borrowLimitUsd: string;
|
|
135
|
-
liquidationLimitUsd: string;
|
|
136
|
-
leftToBorrowUsd: string;
|
|
137
|
-
ratio: string;
|
|
138
|
-
collRatio: string;
|
|
139
|
-
netApy: string;
|
|
140
|
-
incentiveUsd: string;
|
|
141
|
-
totalInterestUsd: string;
|
|
142
|
-
liqRatio: string;
|
|
143
|
-
liqPercent: string;
|
|
144
|
-
leveragedType: LeverageType;
|
|
145
|
-
leveragedAsset?: string;
|
|
146
|
-
currentVolatilePairRatio?: string;
|
|
147
|
-
liquidationPrice?: string;
|
|
148
|
-
minRatio: string;
|
|
149
|
-
minDebt: string;
|
|
150
|
-
minCollRatio: string;
|
|
151
|
-
collLiquidationRatio: string;
|
|
152
|
-
exposure: string;
|
|
153
|
-
}
|
package/esm/types/euler.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export var EulerV2Versions;
|
|
2
|
-
(function (EulerV2Versions) {
|
|
3
|
-
EulerV2Versions["eUSDC2"] = "eUSDC-2";
|
|
4
|
-
EulerV2Versions["eWETH2"] = "eWETH-2";
|
|
5
|
-
})(EulerV2Versions || (EulerV2Versions = {}));
|
|
6
|
-
export var EulerV2VaultType;
|
|
7
|
-
(function (EulerV2VaultType) {
|
|
8
|
-
EulerV2VaultType["Escrow"] = "Escrow";
|
|
9
|
-
EulerV2VaultType["Governed"] = "Governed";
|
|
10
|
-
EulerV2VaultType["Ungoverned"] = "Ungoverned";
|
|
11
|
-
})(EulerV2VaultType || (EulerV2VaultType = {}));
|