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