@defisaver/positions-sdk 2.1.136 → 2.1.137-audit-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/config/contracts.d.ts +0 -938
- package/cjs/config/contracts.js +1 -8
- package/cjs/contracts.d.ts +3823 -27499
- 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/markets/morphoBlue/index.d.ts +4 -0
- package/cjs/markets/morphoBlue/index.js +36 -2
- package/cjs/portfolio/discovery.d.ts +1 -1
- package/cjs/portfolio/discovery.js +1 -1
- package/cjs/portfolio/index.js +0 -32
- package/cjs/savings/morphoVaults/index.js +19 -2
- package/cjs/services/viem.d.ts +918 -2679
- package/cjs/staking/staking.js +1 -2
- package/cjs/types/index.d.ts +0 -1
- package/cjs/types/index.js +0 -1
- package/cjs/types/morphoBlue.d.ts +2 -0
- package/cjs/types/morphoBlue.js +2 -0
- package/cjs/types/portfolio.d.ts +0 -4
- package/esm/config/contracts.d.ts +0 -938
- package/esm/config/contracts.js +0 -6
- package/esm/contracts.d.ts +3823 -27499
- 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/markets/morphoBlue/index.d.ts +4 -0
- package/esm/markets/morphoBlue/index.js +32 -0
- package/esm/portfolio/discovery.d.ts +1 -1
- package/esm/portfolio/discovery.js +1 -1
- package/esm/portfolio/index.js +1 -33
- package/esm/savings/morphoVaults/index.js +19 -2
- package/esm/services/viem.d.ts +916 -2667
- package/esm/staking/staking.js +1 -2
- package/esm/types/index.d.ts +0 -1
- package/esm/types/index.js +0 -1
- package/esm/types/morphoBlue.d.ts +2 -0
- package/esm/types/morphoBlue.js +2 -0
- package/esm/types/portfolio.d.ts +0 -4
- package/package.json +9 -2
- package/src/config/contracts.ts +0 -6
- package/src/contracts.ts +2 -3
- 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 +32 -0
- package/src/portfolio/discovery.ts +1 -1
- package/src/portfolio/index.ts +0 -33
- package/src/savings/morphoVaults/index.ts +18 -2
- package/src/staking/staking.ts +1 -2
- package/src/types/index.ts +0 -1
- package/src/types/morphoBlue.ts +2 -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
package/cjs/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>;
|
package/cjs/eulerV2/index.js
DELETED
|
@@ -1,225 +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._getEulerV2AccountData = exports.EMPTY_EULER_V2_DATA = exports.getEulerV2MarketsData = 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
|
-
const viem_1 = require("../services/viem");
|
|
25
|
-
exports.EMPTY_USED_ASSET = {
|
|
26
|
-
isSupplied: false,
|
|
27
|
-
isBorrowed: false,
|
|
28
|
-
supplied: '0',
|
|
29
|
-
suppliedUsd: '0',
|
|
30
|
-
borrowed: '0',
|
|
31
|
-
borrowedUsd: '0',
|
|
32
|
-
symbol: '',
|
|
33
|
-
collateral: false,
|
|
34
|
-
vaultAddress: '',
|
|
35
|
-
};
|
|
36
|
-
const UnitOfAccountUSD = '0x0000000000000000000000000000000000000348';
|
|
37
|
-
const _getEulerV2MarketsData = (provider, network, selectedMarket) => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
|
-
const contract = (0, contracts_1.EulerV2ViewContractViem)(provider, network);
|
|
39
|
-
const data = yield contract.read.getVaultInfoFull([selectedMarket.marketAddress]);
|
|
40
|
-
const isInUSD = (0, utils_1.compareAddresses)(UnitOfAccountUSD, data.unitOfAccount);
|
|
41
|
-
const usdPrice = (0, utils_1.getEthAmountForDecimals)(data.unitOfAccountInUsd.toString(), 8);
|
|
42
|
-
// parse collateral tokens
|
|
43
|
-
// imma use address as key for assetsData because there can be more collateral vaults with the same name
|
|
44
|
-
const colls = data.collaterals.map((collateral) => {
|
|
45
|
-
const decimals = collateral.decimals.toString();
|
|
46
|
-
const assetInfo = (0, tokens_1.getAssetInfoByAddress)(collateral.assetAddr);
|
|
47
|
-
const borrowRate = (0, eulerHelpers_1.getEulerV2BorrowRate)(collateral.interestRate.toString());
|
|
48
|
-
const utilizationRate = (0, eulerHelpers_1.getUtilizationRate)(collateral.totalBorrows.toString(), new decimal_js_1.default(collateral.totalBorrows.toString()).plus(collateral.cash.toString()).toString());
|
|
49
|
-
const supplyRate = (0, eulerHelpers_1.getEulerV2SupplyRate)(borrowRate, utilizationRate, collateral.interestFee.toString());
|
|
50
|
-
const isEscrow = collateral.isEscrowed;
|
|
51
|
-
const isGoverned = !(0, utils_1.compareAddresses)(collateral.governorAdmin, constants_1.ZERO_ADDRESS);
|
|
52
|
-
const vaultType = isEscrow
|
|
53
|
-
? types_1.EulerV2VaultType.Escrow
|
|
54
|
-
: (isGoverned ? types_1.EulerV2VaultType.Governed : types_1.EulerV2VaultType.Ungoverned);
|
|
55
|
-
return ({
|
|
56
|
-
vaultAddress: collateral.vaultAddr,
|
|
57
|
-
assetAddress: (0, utils_1.wethToEthByAddress)(collateral.assetAddr),
|
|
58
|
-
symbol: (0, utils_1.wethToEth)(assetInfo.symbol),
|
|
59
|
-
vaultSymbol: collateral.vaultSymbol,
|
|
60
|
-
name: collateral.name,
|
|
61
|
-
vaultType,
|
|
62
|
-
decimals,
|
|
63
|
-
liquidationRatio: new decimal_js_1.default(collateral.liquidationLTV).div(10000).toString(),
|
|
64
|
-
collateralFactor: new decimal_js_1.default(collateral.borrowLTV).div(10000).toString(),
|
|
65
|
-
totalBorrow: (0, utils_1.getEthAmountForDecimals)(collateral.totalBorrows.toString(), decimals), // parse
|
|
66
|
-
cash: (0, utils_1.getEthAmountForDecimals)(collateral.cash.toString(), decimals),
|
|
67
|
-
supplyCap: (0, utils_1.isMaxUint)(collateral.supplyCap.toString()) ? collateral.supplyCap.toString() : (0, utils_1.getEthAmountForDecimals)(collateral.supplyCap.toString(), decimals),
|
|
68
|
-
borrowCap: '0',
|
|
69
|
-
price: isInUSD ? (0, tokens_1.assetAmountInEth)(collateral.assetPriceInUnit.toString()) : new decimal_js_1.default((0, tokens_1.assetAmountInEth)(collateral.assetPriceInUnit.toString())).mul(usdPrice).toString(), // 1e18 -> price in unitOfAccount (so it could be USD or any other token)
|
|
70
|
-
canBeBorrowed: false,
|
|
71
|
-
canBeSupplied: true,
|
|
72
|
-
borrowRate,
|
|
73
|
-
supplyRate,
|
|
74
|
-
utilization: new decimal_js_1.default(utilizationRate).mul(100).toString(),
|
|
75
|
-
governorAdmin: collateral.governorAdmin,
|
|
76
|
-
supplyIncentives: [],
|
|
77
|
-
borrowIncentives: [],
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
for (const coll of colls) {
|
|
81
|
-
if (staking_1.STAKING_ASSETS.includes(coll.symbol)) {
|
|
82
|
-
coll.supplyIncentives.push({
|
|
83
|
-
apy: yield (0, staking_1.getStakingApy)(coll.symbol),
|
|
84
|
-
token: coll.symbol,
|
|
85
|
-
incentiveKind: types_1.IncentiveKind.Staking,
|
|
86
|
-
description: `Native ${coll.symbol} yield.`,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
const isEscrow = data.collaterals.length === 0;
|
|
91
|
-
const isGoverned = !(0, utils_1.compareAddresses)(data.governorAdmin, constants_1.ZERO_ADDRESS);
|
|
92
|
-
const vaultType = isEscrow ? types_1.EulerV2VaultType.Escrow : (isGoverned ? types_1.EulerV2VaultType.Governed : types_1.EulerV2VaultType.Ungoverned);
|
|
93
|
-
const decimals = data.decimals.toString();
|
|
94
|
-
// (1 + SPY/10**27) ** secondsPerYear - 1
|
|
95
|
-
const interestRate = data.interestRate.toString();
|
|
96
|
-
const borrowRate = (0, eulerHelpers_1.getEulerV2BorrowRate)(interestRate);
|
|
97
|
-
const utilizationRate = (0, eulerHelpers_1.getUtilizationRate)(data.totalBorrows.toString(), data.totalAssets.toString());
|
|
98
|
-
const supplyRate = (0, eulerHelpers_1.getEulerV2SupplyRate)(borrowRate, utilizationRate, data.interestFee.toString());
|
|
99
|
-
const marketAsset = {
|
|
100
|
-
assetAddress: data.assetAddr,
|
|
101
|
-
vaultAddress: data.vaultAddr,
|
|
102
|
-
symbol: selectedMarket.asset,
|
|
103
|
-
vaultSymbol: selectedMarket.shortLabel,
|
|
104
|
-
decimals,
|
|
105
|
-
totalBorrow: (0, utils_1.getEthAmountForDecimals)(data.totalBorrows.toString(), decimals), // parse
|
|
106
|
-
cash: (0, utils_1.getEthAmountForDecimals)(data.cash.toString(), decimals),
|
|
107
|
-
supplyCap: (0, utils_1.isMaxUint)(data.supplyCap.toString()) ? data.supplyCap.toString() : (0, utils_1.getEthAmountForDecimals)(data.supplyCap.toString(), decimals),
|
|
108
|
-
borrowCap: (0, utils_1.isMaxUint)(data.supplyCap.toString()) ? data.borrowCap.toString() : (0, utils_1.getEthAmountForDecimals)(data.borrowCap.toString(), decimals),
|
|
109
|
-
price: isInUSD ? (0, tokens_1.assetAmountInEth)(data.assetPriceInUnit.toString()) : new decimal_js_1.default((0, tokens_1.assetAmountInEth)(data.assetPriceInUnit.toString())).mul(usdPrice).toString(), // 1e18 -> price in unitOfAccount (so it could be USD or any other token)
|
|
110
|
-
sortIndex: 0,
|
|
111
|
-
canBeBorrowed: true,
|
|
112
|
-
canBeSupplied: false,
|
|
113
|
-
borrowRate,
|
|
114
|
-
supplyRate,
|
|
115
|
-
collateralFactor: '0',
|
|
116
|
-
liquidationRatio: '0',
|
|
117
|
-
utilization: new decimal_js_1.default(utilizationRate).mul(100).toString(),
|
|
118
|
-
governorAdmin: data.governorAdmin,
|
|
119
|
-
vaultType,
|
|
120
|
-
name: data.name,
|
|
121
|
-
supplyIncentives: [],
|
|
122
|
-
borrowIncentives: [],
|
|
123
|
-
};
|
|
124
|
-
const assetsData = {
|
|
125
|
-
[data.vaultAddr.toLowerCase()]: marketAsset,
|
|
126
|
-
};
|
|
127
|
-
colls
|
|
128
|
-
.sort((coll1, coll2) => {
|
|
129
|
-
const aMarket = new decimal_js_1.default(coll1.price).times(coll1.totalBorrow).toString();
|
|
130
|
-
const bMarket = new decimal_js_1.default(coll2.price).times(coll2.totalBorrow).toString();
|
|
131
|
-
return new decimal_js_1.default(bMarket).minus(aMarket).toNumber();
|
|
132
|
-
})
|
|
133
|
-
.forEach((market, i) => {
|
|
134
|
-
assetsData[market.vaultAddress.toLowerCase()] = Object.assign(Object.assign({}, market), { sortIndex: i + 1 });
|
|
135
|
-
});
|
|
136
|
-
const marketData = {
|
|
137
|
-
name: data.name,
|
|
138
|
-
symbol: data.symbol,
|
|
139
|
-
decimals: data.decimals.toString(),
|
|
140
|
-
irm: data.irm,
|
|
141
|
-
creator: data.creator,
|
|
142
|
-
governorAdmin: data.governorAdmin,
|
|
143
|
-
unitOfAccount: data.unitOfAccount,
|
|
144
|
-
unitOfAccountUsdPrice: usdPrice,
|
|
145
|
-
isInUSD,
|
|
146
|
-
oracle: data.oracle,
|
|
147
|
-
collaterals: data.collaterals.map((collateral) => collateral.vaultAddr),
|
|
148
|
-
isEscrow,
|
|
149
|
-
isGoverned,
|
|
150
|
-
vaultType,
|
|
151
|
-
vaultAddress: data.vaultAddr,
|
|
152
|
-
};
|
|
153
|
-
return {
|
|
154
|
-
marketData,
|
|
155
|
-
assetsData,
|
|
156
|
-
};
|
|
157
|
-
});
|
|
158
|
-
exports._getEulerV2MarketsData = _getEulerV2MarketsData;
|
|
159
|
-
const getEulerV2MarketsData = (provider, network, selectedMarket) => __awaiter(void 0, void 0, void 0, function* () { return (0, exports._getEulerV2MarketsData)((0, viem_1.getViemProvider)(provider, network), network, selectedMarket); });
|
|
160
|
-
exports.getEulerV2MarketsData = getEulerV2MarketsData;
|
|
161
|
-
exports.EMPTY_EULER_V2_DATA = {
|
|
162
|
-
usedAssets: {},
|
|
163
|
-
suppliedUsd: '0',
|
|
164
|
-
borrowedUsd: '0',
|
|
165
|
-
borrowLimitUsd: '0',
|
|
166
|
-
leftToBorrowUsd: '0',
|
|
167
|
-
ratio: '0',
|
|
168
|
-
minRatio: '0',
|
|
169
|
-
netApy: '0',
|
|
170
|
-
incentiveUsd: '0',
|
|
171
|
-
totalInterestUsd: '0',
|
|
172
|
-
isSubscribedToAutomation: false,
|
|
173
|
-
automationResubscribeRequired: false,
|
|
174
|
-
borrowVault: '',
|
|
175
|
-
borrowAmountInUnit: '0',
|
|
176
|
-
inLockDownMode: false,
|
|
177
|
-
inPermitDisabledMode: false,
|
|
178
|
-
lastUpdated: Date.now(),
|
|
179
|
-
hasBorrowInDifferentVault: false,
|
|
180
|
-
addressSpaceTakenByAnotherAccount: false,
|
|
181
|
-
exposure: 'N/A',
|
|
182
|
-
};
|
|
183
|
-
const _getEulerV2AccountData = (provider, network, addressForPosition, ownerAddress, extractedState) => __awaiter(void 0, void 0, void 0, function* () {
|
|
184
|
-
if (!addressForPosition)
|
|
185
|
-
throw new Error('No address provided');
|
|
186
|
-
const { selectedMarket, assetsData, marketData, } = extractedState;
|
|
187
|
-
let payload = Object.assign(Object.assign({}, exports.EMPTY_EULER_V2_DATA), { lastUpdated: Date.now() });
|
|
188
|
-
const isInUSD = marketData.isInUSD;
|
|
189
|
-
const parsingDecimals = isInUSD ? 18 : (0, tokens_1.getAssetInfoByAddress)(marketData.unitOfAccount).decimals;
|
|
190
|
-
const contract = (0, contracts_1.EulerV2ViewContractViem)(provider, network);
|
|
191
|
-
const loanData = yield contract.read.getUserData([addressForPosition]);
|
|
192
|
-
const usedAssets = {};
|
|
193
|
-
// there is no user position check for a specific market, only global check
|
|
194
|
-
// but we need to make sure it works for the UI and show position only for the selected market
|
|
195
|
-
if (!(0, utils_1.compareAddresses)(loanData.borrowVault, selectedMarket.marketAddress)) {
|
|
196
|
-
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), addressSpaceTakenByAnotherAccount: !(0, utils_1.compareAddresses)(loanData.owner, ownerAddress) && !(0, utils_1.compareAddresses)(loanData.owner, constants_1.ZERO_ADDRESS) });
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
payload = Object.assign(Object.assign({}, payload), { borrowVault: loanData.borrowVault, borrowAmountInUnit: loanData.borrowAmountInUnit.toString(), inLockDownMode: loanData.inLockDownMode, inPermitDisabledMode: loanData.inPermitDisabledMode, addressSpaceTakenByAnotherAccount: !(0, utils_1.compareAddresses)(loanData.owner, ownerAddress) && !(0, utils_1.compareAddresses)(loanData.owner, constants_1.ZERO_ADDRESS) });
|
|
200
|
-
const borrowedInUnit = (0, utils_1.getEthAmountForDecimals)(loanData.borrowAmountInUnit.toString(), parsingDecimals);
|
|
201
|
-
const borrowedInAsset = (0, utils_1.getEthAmountForDecimals)(loanData.borrowAmountInAsset.toString(), marketData.decimals);
|
|
202
|
-
const borrowVault = loanData.borrowVault;
|
|
203
|
-
if (borrowVault && !(0, utils_1.compareAddresses)(constants_1.ZERO_ADDRESS, borrowVault) && borrowedInUnit) {
|
|
204
|
-
const borrowInfo = assetsData[borrowVault.toLowerCase()];
|
|
205
|
-
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 });
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
loanData.collaterals.forEach((collateral, i) => {
|
|
209
|
-
const key = collateral.collateralVault.toLowerCase();
|
|
210
|
-
const collInfo = assetsData[key];
|
|
211
|
-
if (!collInfo || !marketData.collaterals.map(a => a.toLowerCase()).includes(key))
|
|
212
|
-
return; // this is a token supplied but not being used as a collateral for the market
|
|
213
|
-
const suppliedInUnit = (0, utils_1.getEthAmountForDecimals)(collateral.collateralAmountInUnit.toString(), parsingDecimals);
|
|
214
|
-
const suppliedInAsset = (0, utils_1.getEthAmountForDecimals)(collateral.collateralAmountInAsset.toString(), collInfo.decimals);
|
|
215
|
-
const collateralAmountInUSD = (0, utils_1.getEthAmountForDecimals)(collateral.collateralAmountInUSD.toString(), 18);
|
|
216
|
-
usedAssets[key] = Object.assign(Object.assign({}, exports.EMPTY_USED_ASSET), { collateral: true, isSupplied: !new decimal_js_1.default(suppliedInAsset).eq(0), supplied: suppliedInAsset, suppliedUsd: collateralAmountInUSD, vaultAddress: collateral.collateralVault, symbol: collInfo.symbol });
|
|
217
|
-
});
|
|
218
|
-
payload = Object.assign(Object.assign(Object.assign({}, payload), { usedAssets }), (0, eulerHelpers_1.getEulerV2AggregatedData)({
|
|
219
|
-
usedAssets, assetsData, network,
|
|
220
|
-
}));
|
|
221
|
-
return payload;
|
|
222
|
-
});
|
|
223
|
-
exports._getEulerV2AccountData = _getEulerV2AccountData;
|
|
224
|
-
const getEulerV2AccountData = (provider, network, addressForPosition, ownerAddress, extractedState) => __awaiter(void 0, void 0, void 0, function* () { return (0, exports._getEulerV2AccountData)((0, viem_1.getViemProvider)(provider, network), network, addressForPosition, ownerAddress, extractedState); });
|
|
225
|
-
exports.getEulerV2AccountData = getEulerV2AccountData;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { EthAddress, EthereumProvider, LeverageType, NetworkNumber } from '../../types/common';
|
|
2
|
-
import { EulerV2AggregatedPositionData, EulerV2AssetsData, EulerV2UsedAssets } from '../../types';
|
|
3
|
-
export declare const isLeveragedPos: (usedAssets: EulerV2UsedAssets, dustLimit?: number) => {
|
|
4
|
-
leveragedType: LeverageType;
|
|
5
|
-
leveragedAsset: string;
|
|
6
|
-
leveragedVault: string;
|
|
7
|
-
};
|
|
8
|
-
export declare const getEulerV2AggregatedData: ({ usedAssets, assetsData, network, ...rest }: {
|
|
9
|
-
usedAssets: EulerV2UsedAssets;
|
|
10
|
-
assetsData: EulerV2AssetsData;
|
|
11
|
-
network: NetworkNumber;
|
|
12
|
-
}) => EulerV2AggregatedPositionData;
|
|
13
|
-
export declare const getEulerV2BorrowRate: (interestRate: string) => string;
|
|
14
|
-
export declare const getUtilizationRate: (totalBorrows: string, totalAssets: string) => string;
|
|
15
|
-
export declare const getEulerV2SupplyRate: (borrowRate: string, utilizationRate: string, _interestFee: string) => string;
|
|
16
|
-
export declare const getApyAfterValuesEstimationEulerV2: (actions: {
|
|
17
|
-
action: string;
|
|
18
|
-
amount: string;
|
|
19
|
-
asset: string;
|
|
20
|
-
vaultAddress: EthAddress;
|
|
21
|
-
}[], provider: EthereumProvider, network: NetworkNumber) => Promise<any>;
|
|
22
|
-
export declare const getEulerV2SubAccounts: (address: EthAddress) => EthAddress[];
|
|
@@ -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;
|