@defisaver/positions-sdk 0.0.166-dev → 0.0.166-dev10-liquity-v2
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/.mocharc.json +4 -4
- package/.nvmrc +1 -1
- package/README.md +69 -69
- package/cjs/config/contracts.d.ts +7 -45
- package/cjs/config/contracts.js +3 -3
- package/cjs/contracts.d.ts +1 -1
- package/cjs/contracts.js +2 -2
- package/cjs/helpers/index.d.ts +1 -1
- package/cjs/helpers/index.js +2 -2
- package/cjs/helpers/liquityV2Helpers/index.d.ts +12 -0
- package/cjs/helpers/liquityV2Helpers/index.js +63 -0
- package/cjs/index.d.ts +2 -2
- package/cjs/index.js +3 -3
- package/cjs/liquityV2/index.d.ts +16 -0
- package/cjs/liquityV2/index.js +139 -0
- package/cjs/markets/compound/marketsAssets.js +3 -3
- package/cjs/markets/index.d.ts +1 -1
- package/cjs/markets/index.js +3 -3
- package/cjs/markets/liquityV2/index.d.ts +8 -0
- package/cjs/markets/liquityV2/index.js +34 -0
- package/cjs/markets/morphoBlue/index.d.ts +4 -0
- package/cjs/markets/morphoBlue/index.js +36 -1
- package/cjs/markets/spark/marketAssets.js +1 -1
- package/cjs/moneymarket/moneymarketCommonService.js +1 -1
- package/cjs/services/utils.d.ts +0 -2
- package/cjs/services/utils.js +1 -4
- package/cjs/staking/staking.d.ts +1 -0
- package/cjs/staking/staking.js +31 -2
- package/cjs/types/contracts/generated/LiquityV2View.d.ts +240 -0
- package/cjs/types/contracts/generated/index.d.ts +1 -1
- package/cjs/types/index.d.ts +1 -1
- package/cjs/types/index.js +1 -1
- package/cjs/types/liquityV2.d.ts +90 -0
- package/cjs/types/liquityV2.js +8 -0
- package/cjs/types/morphoBlue.d.ts +3 -1
- package/cjs/types/morphoBlue.js +2 -0
- package/esm/config/contracts.d.ts +7 -45
- package/esm/config/contracts.js +3 -3
- package/esm/contracts.d.ts +1 -1
- package/esm/contracts.js +1 -1
- package/esm/helpers/index.d.ts +1 -1
- package/esm/helpers/index.js +1 -1
- package/esm/helpers/liquityV2Helpers/index.d.ts +12 -0
- package/esm/helpers/liquityV2Helpers/index.js +55 -0
- package/esm/index.d.ts +2 -2
- package/esm/index.js +2 -2
- package/esm/liquityV2/index.d.ts +16 -0
- package/esm/liquityV2/index.js +129 -0
- package/esm/markets/compound/marketsAssets.js +3 -3
- package/esm/markets/index.d.ts +1 -1
- package/esm/markets/index.js +1 -1
- package/esm/markets/liquityV2/index.d.ts +8 -0
- package/esm/markets/liquityV2/index.js +28 -0
- package/esm/markets/morphoBlue/index.d.ts +4 -0
- package/esm/markets/morphoBlue/index.js +33 -0
- package/esm/markets/spark/marketAssets.js +1 -1
- package/esm/moneymarket/moneymarketCommonService.js +1 -1
- package/esm/services/utils.d.ts +0 -2
- package/esm/services/utils.js +0 -2
- package/esm/staking/staking.d.ts +1 -0
- package/esm/staking/staking.js +29 -1
- package/esm/types/contracts/generated/LiquityV2View.d.ts +240 -0
- package/esm/types/contracts/generated/index.d.ts +1 -1
- package/esm/types/index.d.ts +1 -1
- package/esm/types/index.js +1 -1
- package/esm/types/liquityV2.d.ts +90 -0
- package/esm/types/liquityV2.js +5 -0
- package/esm/types/morphoBlue.d.ts +3 -1
- package/esm/types/morphoBlue.js +2 -0
- package/package.json +49 -44
- package/src/aaveV2/index.ts +227 -227
- package/src/aaveV3/index.ts +590 -590
- package/src/assets/index.ts +60 -60
- package/src/chickenBonds/index.ts +123 -123
- package/src/compoundV2/index.ts +219 -219
- package/src/compoundV3/index.ts +281 -281
- package/src/config/contracts.js +1040 -1040
- package/src/constants/index.ts +6 -6
- package/src/contracts.ts +130 -130
- package/src/curveUsd/index.ts +229 -229
- package/src/exchange/index.ts +17 -17
- package/src/helpers/aaveHelpers/index.ts +194 -194
- package/src/helpers/chickenBondsHelpers/index.ts +23 -23
- package/src/helpers/compoundHelpers/index.ts +246 -246
- package/src/helpers/curveUsdHelpers/index.ts +40 -40
- package/src/helpers/index.ts +9 -9
- package/src/helpers/liquityV2Helpers/index.ts +80 -0
- package/src/helpers/llamaLendHelpers/index.ts +53 -53
- package/src/helpers/makerHelpers/index.ts +94 -94
- package/src/helpers/morphoBlueHelpers/index.ts +115 -115
- package/src/helpers/sparkHelpers/index.ts +150 -150
- package/src/index.ts +48 -48
- package/src/liquity/index.ts +116 -116
- package/src/liquityV2/index.ts +159 -0
- package/src/llamaLend/index.ts +275 -275
- package/src/maker/index.ts +117 -117
- package/src/markets/aave/index.ts +152 -152
- package/src/markets/aave/marketAssets.ts +46 -46
- package/src/markets/compound/index.ts +173 -173
- package/src/markets/compound/marketsAssets.ts +64 -64
- package/src/markets/curveUsd/index.ts +69 -69
- package/src/markets/index.ts +23 -24
- package/src/markets/liquityV2/index.ts +31 -0
- package/src/markets/llamaLend/contractAddresses.ts +141 -141
- package/src/markets/llamaLend/index.ts +235 -235
- package/src/markets/morphoBlue/index.ts +728 -691
- package/src/markets/spark/index.ts +29 -29
- package/src/markets/spark/marketAssets.ts +10 -10
- package/src/moneymarket/moneymarketCommonService.ts +80 -80
- package/src/morphoAaveV2/index.ts +256 -256
- package/src/morphoAaveV3/index.ts +630 -630
- package/src/morphoBlue/index.ts +171 -171
- package/src/multicall/index.ts +22 -22
- package/src/services/dsrService.ts +15 -15
- package/src/services/priceService.ts +21 -21
- package/src/services/utils.ts +54 -57
- package/src/setup.ts +8 -8
- package/src/spark/index.ts +424 -424
- package/src/staking/staking.ts +218 -189
- package/src/types/aave.ts +262 -262
- package/src/types/chickenBonds.ts +45 -45
- package/src/types/common.ts +84 -84
- package/src/types/compound.ts +129 -129
- package/src/types/contracts/generated/LiquityV2View.ts +311 -0
- package/src/types/contracts/generated/index.ts +1 -1
- package/src/types/curveUsd.ts +118 -118
- package/src/types/index.ts +10 -10
- package/src/types/liquity.ts +30 -30
- package/src/types/liquityV2.ts +96 -0
- package/src/types/llamaLend.ts +155 -155
- package/src/types/maker.ts +50 -50
- package/src/types/morphoBlue.ts +146 -144
- package/src/types/spark.ts +127 -127
- package/cjs/eulerV2/index.d.ts +0 -40
- package/cjs/eulerV2/index.js +0 -207
- package/cjs/helpers/eulerHelpers/index.d.ts +0 -27
- package/cjs/helpers/eulerHelpers/index.js +0 -232
- package/cjs/markets/euler/index.d.ts +0 -10
- package/cjs/markets/euler/index.js +0 -41
- package/cjs/types/contracts/generated/EulerV2View.d.ts +0 -333
- package/cjs/types/euler.d.ts +0 -148
- package/cjs/types/euler.js +0 -15
- package/esm/eulerV2/index.d.ts +0 -40
- package/esm/eulerV2/index.js +0 -199
- package/esm/helpers/eulerHelpers/index.d.ts +0 -27
- package/esm/helpers/eulerHelpers/index.js +0 -219
- package/esm/markets/euler/index.d.ts +0 -10
- package/esm/markets/euler/index.js +0 -34
- package/esm/types/contracts/generated/EulerV2View.d.ts +0 -333
- package/esm/types/euler.d.ts +0 -148
- package/esm/types/euler.js +0 -12
- package/src/eulerV2/index.ts +0 -286
- package/src/helpers/eulerHelpers/index.ts +0 -231
- package/src/markets/euler/index.ts +0 -38
- package/src/types/contracts/generated/EulerV2View.ts +0 -434
- package/src/types/euler.ts +0 -171
- /package/cjs/types/contracts/generated/{EulerV2View.js → LiquityV2View.js} +0 -0
- /package/esm/types/contracts/generated/{EulerV2View.js → LiquityV2View.js} +0 -0
package/cjs/eulerV2/index.js
DELETED
|
@@ -1,207 +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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.getEulerV2AccountData = exports.EMPTY_EULER_V2_DATA = exports.getEulerV2MarketsData = exports.EMPTY_USED_ASSET = void 0;
|
|
16
|
-
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
17
|
-
const tokens_1 = require("@defisaver/tokens");
|
|
18
|
-
const staking_1 = require("../staking");
|
|
19
|
-
const utils_1 = require("../services/utils");
|
|
20
|
-
const types_1 = require("../types");
|
|
21
|
-
const eulerHelpers_1 = require("../helpers/eulerHelpers");
|
|
22
|
-
const constants_1 = require("../constants");
|
|
23
|
-
const contracts_1 = require("../contracts");
|
|
24
|
-
exports.EMPTY_USED_ASSET = {
|
|
25
|
-
isSupplied: false,
|
|
26
|
-
isBorrowed: false,
|
|
27
|
-
supplied: '0',
|
|
28
|
-
suppliedUsd: '0',
|
|
29
|
-
borrowed: '0',
|
|
30
|
-
borrowedUsd: '0',
|
|
31
|
-
symbol: '',
|
|
32
|
-
collateral: false,
|
|
33
|
-
vaultAddress: '',
|
|
34
|
-
};
|
|
35
|
-
const UnitOfAccountUSD = '0x0000000000000000000000000000000000000348';
|
|
36
|
-
const getEulerV2MarketsData = (web3, network, selectedMarket, defaultWeb3) => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
-
const contract = (0, contracts_1.EulerV2ViewContract)(web3, network);
|
|
38
|
-
const data = yield contract.methods.getVaultInfoFull(selectedMarket.marketAddress).call();
|
|
39
|
-
const isInUSD = (0, utils_1.compareAddresses)(UnitOfAccountUSD, data.unitOfAccount);
|
|
40
|
-
const usdPrice = (0, utils_1.getEthAmountForDecimals)(data.unitOfAccountInUsd, 8);
|
|
41
|
-
// parse collateral tokens
|
|
42
|
-
// imma use address as key for assetsData because there can be more collateral vaults with the same name
|
|
43
|
-
const colls = data.collaterals.map((collateral) => {
|
|
44
|
-
const decimals = collateral.decimals;
|
|
45
|
-
const assetInfo = (0, tokens_1.getAssetInfoByAddress)(collateral.assetAddr);
|
|
46
|
-
const borrowRate = (0, eulerHelpers_1.getEulerV2BorrowRate)(collateral.interestRate);
|
|
47
|
-
const utilizationRate = (0, eulerHelpers_1.getUtilizationRate)(collateral.totalBorrows, new decimal_js_1.default(collateral.totalBorrows).plus(collateral.cash).toString());
|
|
48
|
-
const supplyRate = (0, eulerHelpers_1.getEulerV2SupplyRate)(borrowRate, utilizationRate, collateral.interestFee);
|
|
49
|
-
return ({
|
|
50
|
-
vaultAddress: collateral.vaultAddr,
|
|
51
|
-
assetAddress: collateral.assetAddr,
|
|
52
|
-
symbol: assetInfo.symbol,
|
|
53
|
-
vaultSymbol: collateral.vaultSymbol,
|
|
54
|
-
decimals,
|
|
55
|
-
liquidationRatio: new decimal_js_1.default(collateral.liquidationLTV).div(10000).toString(),
|
|
56
|
-
collateralFactor: new decimal_js_1.default(collateral.borrowLTV).div(10000).toString(),
|
|
57
|
-
totalBorrow: (0, utils_1.getEthAmountForDecimals)(collateral.totalBorrows, decimals),
|
|
58
|
-
cash: (0, utils_1.getEthAmountForDecimals)(collateral.cash, decimals),
|
|
59
|
-
supplyCap: (0, utils_1.isMaxuint)(collateral.supplyCap) ? collateral.supplyCap : (0, utils_1.getEthAmountForDecimals)(collateral.supplyCap, decimals),
|
|
60
|
-
borrowCap: '0',
|
|
61
|
-
price: isInUSD ? (0, tokens_1.assetAmountInEth)(collateral.assetPriceInUnit) : new decimal_js_1.default((0, tokens_1.assetAmountInEth)(collateral.assetPriceInUnit)).mul(usdPrice).toString(),
|
|
62
|
-
canBeBorrowed: false,
|
|
63
|
-
canBeSupplied: true,
|
|
64
|
-
borrowRate,
|
|
65
|
-
supplyRate,
|
|
66
|
-
utilization: new decimal_js_1.default(utilizationRate).mul(100).toString(),
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
for (const coll of colls) {
|
|
70
|
-
if (staking_1.STAKING_ASSETS.includes(coll.symbol)) {
|
|
71
|
-
coll.incentiveSupplyApy = yield (0, staking_1.getStakingApy)(coll.symbol, defaultWeb3);
|
|
72
|
-
coll.incentiveSupplyToken = coll.symbol;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
const isEscrow = data.collaterals.length === 0;
|
|
76
|
-
const isGoverned = !(0, utils_1.compareAddresses)(data.governorAdmin, constants_1.ZERO_ADDRESS);
|
|
77
|
-
const vaultType = isEscrow ? types_1.EulerV2VaultType.Escrow : (isGoverned ? types_1.EulerV2VaultType.Governed : types_1.EulerV2VaultType.Ungoverned);
|
|
78
|
-
const decimals = data.decimals;
|
|
79
|
-
// (1 + SPY/10**27) ** secondsPerYear - 1
|
|
80
|
-
const interestRate = data.interestRate;
|
|
81
|
-
const borrowRate = (0, eulerHelpers_1.getEulerV2BorrowRate)(interestRate);
|
|
82
|
-
const utilizationRate = (0, eulerHelpers_1.getUtilizationRate)(data.totalBorrows, data.totalAssets);
|
|
83
|
-
const supplyRate = (0, eulerHelpers_1.getEulerV2SupplyRate)(borrowRate, utilizationRate, data.interestFee);
|
|
84
|
-
const marketAsset = {
|
|
85
|
-
assetAddress: data.assetAddr,
|
|
86
|
-
vaultAddress: data.vaultAddr,
|
|
87
|
-
symbol: selectedMarket.asset,
|
|
88
|
-
vaultSymbol: selectedMarket.shortLabel,
|
|
89
|
-
decimals,
|
|
90
|
-
totalBorrow: (0, utils_1.getEthAmountForDecimals)(data.totalBorrows, decimals),
|
|
91
|
-
cash: (0, utils_1.getEthAmountForDecimals)(data.cash, decimals),
|
|
92
|
-
supplyCap: (0, utils_1.isMaxuint)(data.supplyCap) ? data.supplyCap : (0, utils_1.getEthAmountForDecimals)(data.supplyCap, decimals),
|
|
93
|
-
borrowCap: (0, utils_1.isMaxuint)(data.supplyCap) ? data.borrowCap : (0, utils_1.getEthAmountForDecimals)(data.borrowCap, decimals),
|
|
94
|
-
price: isInUSD ? (0, tokens_1.assetAmountInEth)(data.assetPriceInUnit) : new decimal_js_1.default((0, tokens_1.assetAmountInEth)(data.assetPriceInUnit)).mul(usdPrice).toString(),
|
|
95
|
-
sortIndex: 0,
|
|
96
|
-
canBeBorrowed: true,
|
|
97
|
-
canBeSupplied: false,
|
|
98
|
-
borrowRate,
|
|
99
|
-
supplyRate,
|
|
100
|
-
collateralFactor: '0',
|
|
101
|
-
liquidationRatio: '0',
|
|
102
|
-
utilization: new decimal_js_1.default(utilizationRate).mul(100).toString(),
|
|
103
|
-
};
|
|
104
|
-
const assetsData = {
|
|
105
|
-
[data.vaultAddr.toLowerCase()]: marketAsset,
|
|
106
|
-
};
|
|
107
|
-
colls
|
|
108
|
-
.sort((coll1, coll2) => {
|
|
109
|
-
const aMarket = new decimal_js_1.default(coll1.price).times(coll1.totalBorrow).toString();
|
|
110
|
-
const bMarket = new decimal_js_1.default(coll2.price).times(coll2.totalBorrow).toString();
|
|
111
|
-
return new decimal_js_1.default(bMarket).minus(aMarket).toNumber();
|
|
112
|
-
})
|
|
113
|
-
.forEach((market, i) => {
|
|
114
|
-
assetsData[market.vaultAddress.toLowerCase()] = Object.assign(Object.assign({}, market), { sortIndex: i + 1 });
|
|
115
|
-
});
|
|
116
|
-
const marketData = {
|
|
117
|
-
name: data.name,
|
|
118
|
-
symbol: data.symbol,
|
|
119
|
-
decimals: data.decimals,
|
|
120
|
-
irm: data.irm,
|
|
121
|
-
creator: data.creator,
|
|
122
|
-
governorAdmin: data.governorAdmin,
|
|
123
|
-
unitOfAccount: data.unitOfAccount,
|
|
124
|
-
unitOfAccountUsdPrice: usdPrice,
|
|
125
|
-
isInUSD,
|
|
126
|
-
oracle: data.oracle,
|
|
127
|
-
collaterals: data.collaterals.map((collateral) => collateral.vaultAddr),
|
|
128
|
-
isEscrow,
|
|
129
|
-
isGoverned,
|
|
130
|
-
vaultType,
|
|
131
|
-
vaultAddress: data.vaultAddr,
|
|
132
|
-
};
|
|
133
|
-
return {
|
|
134
|
-
marketData,
|
|
135
|
-
assetsData,
|
|
136
|
-
};
|
|
137
|
-
});
|
|
138
|
-
exports.getEulerV2MarketsData = getEulerV2MarketsData;
|
|
139
|
-
// export const getEulerV2AccountBalances = async (
|
|
140
|
-
// web3: Web3,
|
|
141
|
-
// network: NetworkNumber,
|
|
142
|
-
// selectedMarket: EulerV2MarketData
|
|
143
|
-
// ): Promise<> => {
|
|
144
|
-
//
|
|
145
|
-
// }
|
|
146
|
-
exports.EMPTY_EULER_V2_DATA = {
|
|
147
|
-
usedAssets: {},
|
|
148
|
-
suppliedUsd: '0',
|
|
149
|
-
borrowedUsd: '0',
|
|
150
|
-
borrowLimitUsd: '0',
|
|
151
|
-
leftToBorrowUsd: '0',
|
|
152
|
-
ratio: '0',
|
|
153
|
-
minRatio: '0',
|
|
154
|
-
netApy: '0',
|
|
155
|
-
incentiveUsd: '0',
|
|
156
|
-
totalInterestUsd: '0',
|
|
157
|
-
isSubscribedToAutomation: false,
|
|
158
|
-
automationResubscribeRequired: false,
|
|
159
|
-
borrowVault: '',
|
|
160
|
-
borrowAmountInUnit: '0',
|
|
161
|
-
inLockDownMode: false,
|
|
162
|
-
inPermitDisabledMode: false,
|
|
163
|
-
lastUpdated: Date.now(),
|
|
164
|
-
hasBorrowInDifferentVault: false,
|
|
165
|
-
};
|
|
166
|
-
const getEulerV2AccountData = (web3, network, address, extractedState) => __awaiter(void 0, void 0, void 0, function* () {
|
|
167
|
-
if (!address)
|
|
168
|
-
throw new Error('No address provided');
|
|
169
|
-
const { selectedMarket, assetsData, marketData, } = extractedState;
|
|
170
|
-
let payload = Object.assign(Object.assign({}, exports.EMPTY_EULER_V2_DATA), { lastUpdated: Date.now() });
|
|
171
|
-
const isInUSD = marketData.isInUSD;
|
|
172
|
-
// TODO: maybe not the best practice to get decimals from tokens package
|
|
173
|
-
const parsingDecimals = isInUSD ? 18 : (0, tokens_1.getAssetInfoByAddress)(marketData.unitOfAccount).decimals;
|
|
174
|
-
const contract = (0, contracts_1.EulerV2ViewContract)(web3, network);
|
|
175
|
-
const loanData = yield contract.methods.getUserData(address).call();
|
|
176
|
-
const usedAssets = {};
|
|
177
|
-
// there is no user position check for a specific market, only global check
|
|
178
|
-
// but we need to make sure it works for the UI and show position only for the selected market
|
|
179
|
-
if (!(0, utils_1.compareAddresses)(loanData.borrowVault, selectedMarket.marketAddress)) {
|
|
180
|
-
payload = Object.assign(Object.assign({}, payload), { borrowVault: constants_1.ZERO_ADDRESS, borrowAmountInUnit: '0', inLockDownMode: false, inPermitDisabledMode: false, hasBorrowInDifferentVault: !(0, utils_1.compareAddresses)(loanData.borrowVault, constants_1.ZERO_ADDRESS) });
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
payload = Object.assign(Object.assign({}, payload), { borrowVault: loanData.borrowVault, borrowAmountInUnit: loanData.borrowAmountInUnit, inLockDownMode: loanData.inLockDownMode, inPermitDisabledMode: loanData.inPermitDisabledMode, hasBorrowInDifferentVault: false });
|
|
184
|
-
const borrowedInUnit = (0, utils_1.getEthAmountForDecimals)(loanData.borrowAmountInUnit, parsingDecimals);
|
|
185
|
-
const borrowedInAsset = (0, utils_1.getEthAmountForDecimals)(loanData.borrowAmountInAsset, marketData.decimals);
|
|
186
|
-
const borrowVault = loanData.borrowVault;
|
|
187
|
-
if (borrowVault && !(0, utils_1.compareAddresses)(constants_1.ZERO_ADDRESS, borrowVault) && borrowedInUnit) {
|
|
188
|
-
const borrowInfo = assetsData[borrowVault.toLowerCase()];
|
|
189
|
-
usedAssets[borrowVault.toLowerCase()] = Object.assign(Object.assign({}, exports.EMPTY_USED_ASSET), { isBorrowed: true, borrowed: borrowedInAsset, borrowedUsd: isInUSD ? borrowedInUnit : new decimal_js_1.default(borrowedInUnit).mul(marketData.unitOfAccountUsdPrice).toString(), vaultAddress: loanData.borrowVault, symbol: borrowInfo.symbol });
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
loanData.collaterals.forEach((collateral, i) => {
|
|
193
|
-
const key = collateral.collateralVault.toLowerCase();
|
|
194
|
-
const collInfo = assetsData[key];
|
|
195
|
-
if (!collInfo || !marketData.collaterals.map(a => a.toLowerCase()).includes(key))
|
|
196
|
-
return; // this is a token supplied but not being used as a collateral for the market
|
|
197
|
-
const suppliedInUnit = (0, utils_1.getEthAmountForDecimals)(collateral.collateralAmountInUnit, parsingDecimals);
|
|
198
|
-
const suppliedInAsset = (0, utils_1.getEthAmountForDecimals)(collateral.collateralAmountInAsset, collInfo.decimals);
|
|
199
|
-
const collateralAmountInUSD = (0, utils_1.getEthAmountForDecimals)(collateral.collateralAmountInUSD, 18);
|
|
200
|
-
usedAssets[key] = Object.assign(Object.assign({}, exports.EMPTY_USED_ASSET), { collateral: true, isSupplied: true, supplied: suppliedInAsset, suppliedUsd: collateralAmountInUSD, vaultAddress: collateral.collateralVault, symbol: collInfo.symbol });
|
|
201
|
-
});
|
|
202
|
-
payload = Object.assign(Object.assign(Object.assign({}, payload), { usedAssets }), (0, eulerHelpers_1.getEulerV2AggregatedData)({
|
|
203
|
-
usedAssets, assetsData, network,
|
|
204
|
-
}));
|
|
205
|
-
return payload;
|
|
206
|
-
});
|
|
207
|
-
exports.getEulerV2AccountData = getEulerV2AccountData;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import Web3 from 'web3';
|
|
2
|
-
import { EthAddress, NetworkNumber } from '../../types/common';
|
|
3
|
-
import { EulerV2AggregatedPositionData, EulerV2AssetsData, EulerV2UsedAssets } from '../../types';
|
|
4
|
-
export declare const isLeveragedPos: (usedAssets: EulerV2UsedAssets, dustLimit?: number) => {
|
|
5
|
-
leveragedType: string;
|
|
6
|
-
leveragedAsset: string;
|
|
7
|
-
leveragedVault: string;
|
|
8
|
-
};
|
|
9
|
-
export declare const calculateNetApy: (usedAssets: EulerV2UsedAssets, assetsData: EulerV2AssetsData) => {
|
|
10
|
-
netApy: string;
|
|
11
|
-
totalInterestUsd: string;
|
|
12
|
-
incentiveUsd: string;
|
|
13
|
-
};
|
|
14
|
-
export declare const getEulerV2AggregatedData: ({ usedAssets, assetsData, network, ...rest }: {
|
|
15
|
-
usedAssets: EulerV2UsedAssets;
|
|
16
|
-
assetsData: EulerV2AssetsData;
|
|
17
|
-
network: NetworkNumber;
|
|
18
|
-
}) => EulerV2AggregatedPositionData;
|
|
19
|
-
export declare const getEulerV2BorrowRate: (interestRate: string) => string;
|
|
20
|
-
export declare const getUtilizationRate: (totalBorrows: string, totalAssets: string) => string;
|
|
21
|
-
export declare const getEulerV2SupplyRate: (borrowRate: string, utilizationRate: string, _interestFee: string) => string;
|
|
22
|
-
export declare const getApyAfterValuesEstimationEulerV2: (actions: {
|
|
23
|
-
action: string;
|
|
24
|
-
amount: string;
|
|
25
|
-
asset: string;
|
|
26
|
-
vaultAddress: EthAddress;
|
|
27
|
-
}[], web3: Web3, network: NetworkNumber) => Promise<any>;
|
|
@@ -1,232 +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.getApyAfterValuesEstimationEulerV2 = exports.getEulerV2SupplyRate = exports.getUtilizationRate = exports.getEulerV2BorrowRate = exports.getEulerV2AggregatedData = exports.calculateNetApy = exports.isLeveragedPos = void 0;
|
|
27
|
-
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
28
|
-
const tokens_1 = require("@defisaver/tokens");
|
|
29
|
-
const moneymarket_1 = require("../../moneymarket");
|
|
30
|
-
const staking_1 = require("../../staking");
|
|
31
|
-
const contracts_1 = require("../../contracts");
|
|
32
|
-
const constants_1 = require("../../constants");
|
|
33
|
-
const multicall_1 = require("../../multicall");
|
|
34
|
-
const isLeveragedPos = (usedAssets, dustLimit = 5) => {
|
|
35
|
-
let borrowUnstable = 0;
|
|
36
|
-
let supplyStable = 0;
|
|
37
|
-
let borrowStable = 0;
|
|
38
|
-
let supplyUnstable = 0;
|
|
39
|
-
let longAsset = '';
|
|
40
|
-
let shortAsset = '';
|
|
41
|
-
let leverageAssetVault = '';
|
|
42
|
-
Object.values(usedAssets).forEach(({ symbol, suppliedUsd, borrowedUsd, collateral, vaultAddress, }) => {
|
|
43
|
-
const isSupplied = (+suppliedUsd) > dustLimit; // ignore dust like <limit leftover supply
|
|
44
|
-
const isBorrowed = (+borrowedUsd) > dustLimit; // ignore dust like <limit leftover supply
|
|
45
|
-
if (isSupplied && moneymarket_1.STABLE_ASSETS.includes(symbol) && collateral)
|
|
46
|
-
supplyStable += 1;
|
|
47
|
-
if (isBorrowed && moneymarket_1.STABLE_ASSETS.includes(symbol))
|
|
48
|
-
borrowStable += 1;
|
|
49
|
-
if (isBorrowed && !moneymarket_1.STABLE_ASSETS.includes(symbol)) {
|
|
50
|
-
borrowUnstable += 1;
|
|
51
|
-
shortAsset = symbol;
|
|
52
|
-
leverageAssetVault = vaultAddress;
|
|
53
|
-
}
|
|
54
|
-
if (isSupplied && !moneymarket_1.STABLE_ASSETS.includes(symbol) && collateral) {
|
|
55
|
-
supplyUnstable += 1;
|
|
56
|
-
longAsset = symbol;
|
|
57
|
-
leverageAssetVault = vaultAddress;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
const isLong = borrowStable > 0 && borrowUnstable === 0 && supplyUnstable === 1 && supplyStable === 0;
|
|
61
|
-
const isShort = supplyStable > 0 && supplyUnstable === 0 && borrowUnstable === 1 && borrowStable === 0;
|
|
62
|
-
// lsd -> liquid staking derivative
|
|
63
|
-
const isLsdLeveraged = supplyUnstable === 1 && borrowUnstable === 1 && shortAsset === 'ETH' && ['stETH', 'wstETH', 'cbETH', 'rETH'].includes(longAsset);
|
|
64
|
-
if (isLong) {
|
|
65
|
-
return {
|
|
66
|
-
leveragedType: 'long',
|
|
67
|
-
leveragedAsset: longAsset,
|
|
68
|
-
leveragedVault: leverageAssetVault,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
if (isShort) {
|
|
72
|
-
return {
|
|
73
|
-
leveragedType: 'short',
|
|
74
|
-
leveragedAsset: shortAsset,
|
|
75
|
-
leveragedVault: leverageAssetVault,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
if (isLsdLeveraged) {
|
|
79
|
-
return {
|
|
80
|
-
leveragedType: 'lsd-leverage',
|
|
81
|
-
leveragedAsset: longAsset,
|
|
82
|
-
leveragedVault: leverageAssetVault,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
return {
|
|
86
|
-
leveragedType: '',
|
|
87
|
-
leveragedAsset: '',
|
|
88
|
-
leveragedVault: '',
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
exports.isLeveragedPos = isLeveragedPos;
|
|
92
|
-
const calculateNetApy = (usedAssets, assetsData) => {
|
|
93
|
-
const sumValues = Object.values(usedAssets).reduce((_acc, usedAsset) => {
|
|
94
|
-
const acc = Object.assign({}, _acc);
|
|
95
|
-
const assetData = assetsData[usedAsset.vaultAddress.toLowerCase()];
|
|
96
|
-
if (usedAsset.isSupplied) {
|
|
97
|
-
const amount = usedAsset.suppliedUsd;
|
|
98
|
-
acc.suppliedUsd = new decimal_js_1.default(acc.suppliedUsd).add(amount).toString();
|
|
99
|
-
const rate = assetData.supplyRate;
|
|
100
|
-
const supplyInterest = (0, staking_1.calculateInterestEarned)(amount, rate, 'year', true);
|
|
101
|
-
acc.supplyInterest = new decimal_js_1.default(acc.supplyInterest).add(supplyInterest.toString()).toString();
|
|
102
|
-
}
|
|
103
|
-
if (usedAsset.isBorrowed) {
|
|
104
|
-
const amount = usedAsset.borrowedUsd;
|
|
105
|
-
acc.borrowedUsd = new decimal_js_1.default(acc.borrowedUsd).add(amount).toString();
|
|
106
|
-
const rate = assetData.borrowRate;
|
|
107
|
-
const borrowInterest = (0, staking_1.calculateInterestEarned)(amount, rate, 'year', true);
|
|
108
|
-
acc.borrowInterest = new decimal_js_1.default(acc.borrowInterest).sub(borrowInterest.toString()).toString();
|
|
109
|
-
}
|
|
110
|
-
return acc;
|
|
111
|
-
}, {
|
|
112
|
-
borrowInterest: '0', supplyInterest: '0', incentiveUsd: '0', borrowedUsd: '0', suppliedUsd: '0',
|
|
113
|
-
});
|
|
114
|
-
const { borrowedUsd, suppliedUsd, borrowInterest, supplyInterest, incentiveUsd, } = sumValues;
|
|
115
|
-
const totalInterestUsd = new decimal_js_1.default(borrowInterest).add(supplyInterest).add(incentiveUsd).toString();
|
|
116
|
-
const balance = new decimal_js_1.default(suppliedUsd).sub(borrowedUsd);
|
|
117
|
-
const netApy = new decimal_js_1.default(totalInterestUsd).div(balance).times(100).toString();
|
|
118
|
-
return { netApy, totalInterestUsd, incentiveUsd };
|
|
119
|
-
};
|
|
120
|
-
exports.calculateNetApy = calculateNetApy;
|
|
121
|
-
const getEulerV2AggregatedData = (_a) => {
|
|
122
|
-
var { usedAssets, assetsData, network } = _a, rest = __rest(_a, ["usedAssets", "assetsData", "network"]);
|
|
123
|
-
const payload = {};
|
|
124
|
-
payload.suppliedUsd = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isSupplied }) => isSupplied, ({ suppliedUsd }) => suppliedUsd);
|
|
125
|
-
payload.suppliedCollateralUsd = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isSupplied, collateral }) => isSupplied && collateral, ({ suppliedUsd }) => suppliedUsd);
|
|
126
|
-
payload.borrowedUsd = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isBorrowed }) => isBorrowed, ({ borrowedUsd }) => borrowedUsd);
|
|
127
|
-
payload.borrowLimitUsd = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isSupplied, collateral }) => isSupplied && collateral, ({ vaultAddress, suppliedUsd }) => new decimal_js_1.default(suppliedUsd).mul(assetsData[vaultAddress.toLowerCase()].collateralFactor));
|
|
128
|
-
payload.liquidationLimitUsd = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isSupplied, collateral }) => isSupplied && collateral, ({ vaultAddress, suppliedUsd }) => new decimal_js_1.default(suppliedUsd).mul(assetsData[vaultAddress.toLowerCase()].liquidationRatio));
|
|
129
|
-
const leftToBorrowUsd = new decimal_js_1.default(payload.borrowLimitUsd).sub(payload.borrowedUsd);
|
|
130
|
-
payload.leftToBorrowUsd = leftToBorrowUsd.lte('0') ? '0' : leftToBorrowUsd.toString();
|
|
131
|
-
payload.ratio = +payload.suppliedUsd ? new decimal_js_1.default(payload.borrowLimitUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
|
|
132
|
-
payload.collRatio = +payload.suppliedUsd ? new decimal_js_1.default(payload.suppliedCollateralUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
|
|
133
|
-
const { netApy, incentiveUsd, totalInterestUsd } = (0, exports.calculateNetApy)(usedAssets, assetsData);
|
|
134
|
-
payload.netApy = netApy;
|
|
135
|
-
payload.incentiveUsd = incentiveUsd;
|
|
136
|
-
payload.totalInterestUsd = totalInterestUsd;
|
|
137
|
-
payload.minRatio = '100';
|
|
138
|
-
payload.liqRatio = new decimal_js_1.default(payload.borrowLimitUsd).div(payload.liquidationLimitUsd).toString();
|
|
139
|
-
payload.liqPercent = new decimal_js_1.default(payload.borrowLimitUsd).div(payload.liquidationLimitUsd).mul(100).toString();
|
|
140
|
-
const { leveragedType, leveragedAsset, leveragedVault } = (0, exports.isLeveragedPos)(usedAssets);
|
|
141
|
-
payload.leveragedType = leveragedType;
|
|
142
|
-
if (leveragedType !== '') {
|
|
143
|
-
payload.leveragedAsset = leveragedAsset;
|
|
144
|
-
let assetPrice = assetsData[leveragedVault.toLowerCase()].price;
|
|
145
|
-
if (leveragedType === 'lsd-leverage') {
|
|
146
|
-
const ethAsset = Object.values(assetsData).find((asset) => ['WETH', 'ETH'].includes(asset.symbol));
|
|
147
|
-
if (ethAsset) {
|
|
148
|
-
payload.leveragedLsdAssetRatio = new decimal_js_1.default(assetsData[leveragedVault.toLowerCase()].price).div(ethAsset.price).toString();
|
|
149
|
-
assetPrice = new decimal_js_1.default(assetPrice).div(ethAsset.price).toString();
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
payload.liquidationPrice = (0, moneymarket_1.calcLeverageLiqPrice)(leveragedType, assetPrice, payload.borrowedUsd, payload.liquidationLimitUsd);
|
|
153
|
-
}
|
|
154
|
-
return payload;
|
|
155
|
-
};
|
|
156
|
-
exports.getEulerV2AggregatedData = getEulerV2AggregatedData;
|
|
157
|
-
const getEulerV2BorrowRate = (interestRate) => {
|
|
158
|
-
const _interestRate = new decimal_js_1.default(interestRate).div(1e27).toString();
|
|
159
|
-
const secondsPerYear = 31556953;
|
|
160
|
-
const a = new decimal_js_1.default(1).plus(_interestRate).pow(secondsPerYear - 1).toString();
|
|
161
|
-
return new decimal_js_1.default(new decimal_js_1.default(a).minus(1)).mul(100).toString();
|
|
162
|
-
};
|
|
163
|
-
exports.getEulerV2BorrowRate = getEulerV2BorrowRate;
|
|
164
|
-
const getUtilizationRate = (totalBorrows, totalAssets) => new decimal_js_1.default(totalBorrows).div(totalAssets).toString();
|
|
165
|
-
exports.getUtilizationRate = getUtilizationRate;
|
|
166
|
-
const getEulerV2SupplyRate = (borrowRate, utilizationRate, _interestFee) => {
|
|
167
|
-
const interestFee = new decimal_js_1.default(_interestFee).div(10000);
|
|
168
|
-
const fee = new decimal_js_1.default(1).minus(interestFee);
|
|
169
|
-
return new decimal_js_1.default(borrowRate).mul(utilizationRate).mul(fee).toString();
|
|
170
|
-
};
|
|
171
|
-
exports.getEulerV2SupplyRate = getEulerV2SupplyRate;
|
|
172
|
-
const getLiquidityChanges = (action, amount, isBorrowOperation) => {
|
|
173
|
-
let liquidityAdded;
|
|
174
|
-
let liquidityRemoved;
|
|
175
|
-
if (isBorrowOperation) {
|
|
176
|
-
liquidityAdded = action === 'payback' ? amount : '0';
|
|
177
|
-
liquidityRemoved = action === 'borrow' ? amount : '0';
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
liquidityAdded = action === 'collateral' ? amount : '0';
|
|
181
|
-
liquidityRemoved = action === 'withdraw' ? amount : '0';
|
|
182
|
-
}
|
|
183
|
-
return { liquidityAdded, liquidityRemoved };
|
|
184
|
-
};
|
|
185
|
-
const getApyAfterValuesEstimationEulerV2 = (actions, web3, network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
186
|
-
const eulerV2ViewContract = (0, contracts_1.EulerV2ViewContract)(web3, network);
|
|
187
|
-
const multicallData = [];
|
|
188
|
-
const apyAfterValuesEstimationParams = [];
|
|
189
|
-
actions.forEach(({ action, amount, asset, vaultAddress, }) => {
|
|
190
|
-
const amountInWei = (0, tokens_1.assetAmountInWei)(amount, asset);
|
|
191
|
-
const isBorrowOperation = constants_1.borrowOperations.includes(action);
|
|
192
|
-
const { liquidityAdded, liquidityRemoved } = getLiquidityChanges(action, amountInWei, isBorrowOperation);
|
|
193
|
-
apyAfterValuesEstimationParams.push([
|
|
194
|
-
vaultAddress,
|
|
195
|
-
constants_1.borrowOperations.includes(action),
|
|
196
|
-
liquidityAdded,
|
|
197
|
-
liquidityRemoved,
|
|
198
|
-
]);
|
|
199
|
-
multicallData.push({
|
|
200
|
-
target: eulerV2ViewContract.options.address,
|
|
201
|
-
abiItem: eulerV2ViewContract.options.jsonInterface.find(({ name }) => name === 'getVaultInfoFull'),
|
|
202
|
-
params: [vaultAddress],
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
multicallData.push({
|
|
206
|
-
target: eulerV2ViewContract.options.address,
|
|
207
|
-
abiItem: eulerV2ViewContract.options.jsonInterface.find(({ name }) => name === 'getApyAfterValuesEstimation'),
|
|
208
|
-
params: [apyAfterValuesEstimationParams],
|
|
209
|
-
});
|
|
210
|
-
const multicallRes = yield (0, multicall_1.multicall)(multicallData, web3, network);
|
|
211
|
-
const numOfActions = actions.length;
|
|
212
|
-
const data = {};
|
|
213
|
-
for (let i = 0; i < numOfActions; i += 1) {
|
|
214
|
-
const _interestRate = multicallRes[numOfActions].estimatedBorrowRates[i];
|
|
215
|
-
const vaultInfo = multicallRes[i][0];
|
|
216
|
-
const decimals = vaultInfo.decimals;
|
|
217
|
-
const borrowRate = (0, exports.getEulerV2BorrowRate)(_interestRate);
|
|
218
|
-
const amount = new decimal_js_1.default(actions[i].amount).mul(Math.pow(10, decimals)).toString();
|
|
219
|
-
const action = actions[i].action;
|
|
220
|
-
const isBorrowOperation = constants_1.borrowOperations.includes(action);
|
|
221
|
-
const { liquidityAdded, liquidityRemoved } = getLiquidityChanges(action, amount, isBorrowOperation);
|
|
222
|
-
const totalBorrows = new decimal_js_1.default(vaultInfo.totalBorrows).add(isBorrowOperation ? liquidityRemoved : '0').sub(isBorrowOperation ? liquidityAdded : '0').toString();
|
|
223
|
-
const totalAssets = new decimal_js_1.default(vaultInfo.totalAssets).add(isBorrowOperation ? '0' : liquidityAdded).sub(isBorrowOperation ? '0' : liquidityRemoved).toString();
|
|
224
|
-
const utilizationRate = (0, exports.getUtilizationRate)(totalBorrows, totalAssets);
|
|
225
|
-
data[vaultInfo.vaultAddr.toLowerCase()] = {
|
|
226
|
-
borrowRate,
|
|
227
|
-
supplyRate: (0, exports.getEulerV2SupplyRate)(borrowRate, utilizationRate, vaultInfo.interestFee),
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
return data;
|
|
231
|
-
});
|
|
232
|
-
exports.getApyAfterValuesEstimationEulerV2 = getApyAfterValuesEstimationEulerV2;
|
|
@@ -1,10 +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 eUSDC8: (networkId: NetworkNumber) => EulerV2Market;
|
|
5
|
-
export declare const eWETH2: (networkId: NetworkNumber) => EulerV2Market;
|
|
6
|
-
export declare const EulerV2Markets: (networkId: NetworkNumber) => {
|
|
7
|
-
readonly "eUSDC-2": EulerV2Market;
|
|
8
|
-
readonly "eUSDC-8": EulerV2Market;
|
|
9
|
-
readonly "eWETH-2": EulerV2Market;
|
|
10
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EulerV2Markets = exports.eWETH2 = exports.eUSDC8 = 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 eUSDC8 = (networkId) => ({
|
|
17
|
-
chainIds: [common_1.NetworkNumber.Eth],
|
|
18
|
-
label: 'Stablecoin Maxi USDC',
|
|
19
|
-
shortLabel: 'eUSDC-8',
|
|
20
|
-
value: types_1.EulerV2Versions.eUSDC8,
|
|
21
|
-
asset: 'USDC',
|
|
22
|
-
secondLabel: 'Market',
|
|
23
|
-
marketAddress: '0xce45EF0414dE3516cAF1BCf937bF7F2Cf67873De',
|
|
24
|
-
});
|
|
25
|
-
exports.eUSDC8 = eUSDC8;
|
|
26
|
-
const eWETH2 = (networkId) => ({
|
|
27
|
-
chainIds: [common_1.NetworkNumber.Eth],
|
|
28
|
-
label: 'Euler Prime WETH',
|
|
29
|
-
shortLabel: 'eWETH-2',
|
|
30
|
-
value: types_1.EulerV2Versions.eWETH2,
|
|
31
|
-
asset: 'WETH',
|
|
32
|
-
secondLabel: 'Market',
|
|
33
|
-
marketAddress: '0xD8b27CF359b7D15710a5BE299AF6e7Bf904984C2',
|
|
34
|
-
});
|
|
35
|
-
exports.eWETH2 = eWETH2;
|
|
36
|
-
const EulerV2Markets = (networkId) => ({
|
|
37
|
-
[types_1.EulerV2Versions.eUSDC2]: (0, exports.eUSDC2)(networkId),
|
|
38
|
-
[types_1.EulerV2Versions.eUSDC8]: (0, exports.eUSDC8)(networkId),
|
|
39
|
-
[types_1.EulerV2Versions.eWETH2]: (0, exports.eWETH2)(networkId),
|
|
40
|
-
});
|
|
41
|
-
exports.EulerV2Markets = EulerV2Markets;
|