@defisaver/positions-sdk 2.1.96 → 2.1.98-aave-v4-apy-2
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 +64 -64
- package/cjs/aaveV3/index.js +3 -3
- package/cjs/aaveV4/index.js +2 -0
- package/cjs/config/contracts.d.ts +61 -1
- package/cjs/config/contracts.js +2 -2
- package/cjs/contracts.d.ts +2963 -82
- package/cjs/helpers/aaveV4Helpers/index.d.ts +11 -1
- package/cjs/helpers/aaveV4Helpers/index.js +58 -1
- package/cjs/helpers/morphoBlueHelpers/index.js +66 -66
- package/cjs/savings/morphoVaults/index.js +17 -17
- package/cjs/services/utils.d.ts +1 -1
- package/cjs/services/utils.js +2 -1
- package/cjs/types/aaveV4.d.ts +2 -0
- package/esm/aaveV3/index.js +3 -3
- package/esm/aaveV4/index.js +2 -0
- package/esm/config/contracts.d.ts +61 -1
- package/esm/config/contracts.js +2 -2
- package/esm/contracts.d.ts +2963 -82
- package/esm/helpers/aaveV4Helpers/index.d.ts +11 -1
- package/esm/helpers/aaveV4Helpers/index.js +56 -0
- package/esm/helpers/morphoBlueHelpers/index.js +66 -66
- package/esm/savings/morphoVaults/index.js +17 -17
- package/esm/services/utils.d.ts +1 -1
- package/esm/services/utils.js +2 -1
- package/esm/types/aaveV4.d.ts +2 -0
- package/package.json +48 -48
- package/src/aaveV2/index.ts +240 -240
- package/src/aaveV3/index.ts +634 -634
- package/src/aaveV3/merit.ts +97 -97
- package/src/aaveV3/merkl.ts +74 -74
- package/src/aaveV4/index.ts +238 -236
- package/src/aaveV4/lend.ts +185 -185
- package/src/claiming/aaveV3.ts +154 -154
- package/src/claiming/compV3.ts +22 -22
- package/src/claiming/ethena.ts +61 -61
- package/src/claiming/index.ts +12 -12
- package/src/claiming/king.ts +66 -66
- package/src/claiming/morphoBlue.ts +118 -118
- package/src/claiming/spark.ts +225 -225
- package/src/compoundV2/index.ts +245 -245
- package/src/compoundV3/index.ts +280 -280
- package/src/config/contracts.ts +1357 -1357
- package/src/constants/index.ts +10 -10
- package/src/contracts.ts +183 -183
- package/src/curveUsd/index.ts +254 -254
- package/src/eulerV2/index.ts +330 -330
- package/src/exchange/index.ts +25 -25
- package/src/fluid/index.ts +1800 -1800
- package/src/helpers/aaveHelpers/index.ts +203 -203
- package/src/helpers/aaveV4Helpers/index.ts +349 -291
- package/src/helpers/compoundHelpers/index.ts +280 -280
- package/src/helpers/curveUsdHelpers/index.ts +44 -44
- package/src/helpers/eulerHelpers/index.ts +230 -230
- package/src/helpers/fluidHelpers/index.ts +338 -338
- package/src/helpers/index.ts +11 -11
- package/src/helpers/liquityV2Helpers/index.ts +85 -85
- package/src/helpers/llamaLendHelpers/index.ts +56 -56
- package/src/helpers/makerHelpers/index.ts +52 -52
- package/src/helpers/morphoBlueHelpers/index.ts +406 -406
- package/src/helpers/sparkHelpers/index.ts +170 -170
- package/src/index.ts +51 -51
- package/src/liquity/index.ts +161 -161
- package/src/liquityV2/index.ts +703 -703
- package/src/llamaLend/index.ts +305 -305
- package/src/maker/index.ts +225 -225
- package/src/markets/aave/index.ts +118 -118
- package/src/markets/aave/marketAssets.ts +54 -54
- package/src/markets/aaveV4/index.ts +191 -191
- package/src/markets/compound/index.ts +243 -243
- package/src/markets/compound/marketsAssets.ts +97 -97
- package/src/markets/curveUsd/index.ts +69 -69
- package/src/markets/euler/index.ts +26 -26
- package/src/markets/fluid/index.ts +2900 -2900
- package/src/markets/index.ts +29 -29
- package/src/markets/liquityV2/index.ts +102 -102
- package/src/markets/llamaLend/contractAddresses.ts +141 -141
- package/src/markets/llamaLend/index.ts +235 -235
- package/src/markets/morphoBlue/index.ts +1370 -1370
- package/src/markets/spark/index.ts +29 -29
- package/src/markets/spark/marketAssets.ts +12 -12
- package/src/moneymarket/moneymarketCommonService.ts +91 -91
- package/src/morphoBlue/index.ts +274 -274
- package/src/portfolio/index.ts +606 -606
- package/src/savings/index.ts +111 -111
- package/src/savings/makerDsr/index.ts +53 -53
- package/src/savings/makerDsr/options.ts +9 -9
- package/src/savings/morphoVaults/index.ts +80 -80
- package/src/savings/morphoVaults/options.ts +193 -193
- package/src/savings/skyOptions/index.ts +95 -95
- package/src/savings/skyOptions/options.ts +10 -10
- package/src/savings/sparkSavingsVaults/index.ts +60 -60
- package/src/savings/sparkSavingsVaults/options.ts +35 -35
- package/src/savings/summerVaults/index.ts +56 -56
- package/src/savings/summerVaults/options.ts +117 -117
- package/src/savings/yearnV3Vaults/index.ts +61 -61
- package/src/savings/yearnV3Vaults/options.ts +55 -55
- package/src/savings/yearnVaults/index.ts +73 -73
- package/src/savings/yearnVaults/options.ts +32 -32
- package/src/services/priceService.ts +278 -278
- package/src/services/utils.ts +122 -117
- package/src/services/viem.ts +57 -57
- package/src/setup.ts +8 -8
- package/src/spark/index.ts +460 -460
- package/src/staking/eligibility.ts +105 -105
- package/src/staking/index.ts +1 -1
- package/src/staking/staking.ts +201 -201
- package/src/types/aave.ts +200 -200
- package/src/types/aaveV4.ts +179 -177
- package/src/types/claiming.ts +114 -114
- package/src/types/common.ts +117 -117
- package/src/types/compound.ts +147 -147
- package/src/types/curveUsd.ts +125 -125
- package/src/types/euler.ts +177 -177
- package/src/types/fluid.ts +486 -486
- package/src/types/index.ts +16 -16
- package/src/types/liquity.ts +31 -31
- package/src/types/liquityV2.ts +130 -130
- package/src/types/llamaLend.ts +163 -163
- package/src/types/maker.ts +64 -64
- package/src/types/merit.ts +1 -1
- package/src/types/merkl.ts +70 -70
- package/src/types/morphoBlue.ts +228 -228
- package/src/types/portfolio.ts +64 -64
- package/src/types/savings/index.ts +25 -25
- package/src/types/savings/makerDsr.ts +13 -13
- package/src/types/savings/morphoVaults.ts +32 -32
- package/src/types/savings/sky.ts +14 -14
- package/src/types/savings/sparkSavingsVaults.ts +15 -15
- package/src/types/savings/summerVaults.ts +24 -24
- package/src/types/savings/yearnV3Vaults.ts +17 -17
- package/src/types/savings/yearnVaults.ts +14 -14
- package/src/types/spark.ts +136 -136
- package/src/umbrella/index.ts +69 -69
- package/src/umbrella/umbrellaUtils.ts +29 -29
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AaveV4AggregatedPositionData, AaveV4AssetsData, AaveV4ReserveAssetData, AaveV4UsedReserveAsset, AaveV4UsedReserveAssets, LeverageType, NetworkNumber } from '../../types';
|
|
1
|
+
import { AaveV4AggregatedPositionData, AaveV4AssetsData, AaveV4ReserveAssetData, AaveV4SpokeInfo, AaveV4UsedReserveAsset, AaveV4UsedReserveAssets, EthereumProvider, LeverageType, NetworkNumber } from '../../types';
|
|
2
2
|
export declare const calcUserRiskPremiumBps: (usedAssets: AaveV4UsedReserveAssets, assetsData: AaveV4AssetsData) => number;
|
|
3
3
|
export declare const getApyAfterValuesEstimation: (usedAssets: AaveV4UsedReserveAssets, assetsData: AaveV4AssetsData) => Record<string, {
|
|
4
4
|
borrowRate: string;
|
|
@@ -23,3 +23,13 @@ export declare const aaveV4GetAggregatedPositionData: ({ usedAssets, assetsData,
|
|
|
23
23
|
network: NetworkNumber;
|
|
24
24
|
useUserCollateralFactor?: boolean;
|
|
25
25
|
}) => AaveV4AggregatedPositionData;
|
|
26
|
+
export declare const getAaveV4ApyAfterValuesEstimation: (selectedSpoke: AaveV4SpokeInfo, assetsData: AaveV4AssetsData, actions: [{
|
|
27
|
+
action: string;
|
|
28
|
+
amount: string;
|
|
29
|
+
asset: string;
|
|
30
|
+
}], provider: EthereumProvider, network: NetworkNumber) => Promise<{
|
|
31
|
+
[key: string]: {
|
|
32
|
+
supplyRate: string;
|
|
33
|
+
borrowRate: string;
|
|
34
|
+
};
|
|
35
|
+
}>;
|
|
@@ -1,7 +1,20 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import Dec from 'decimal.js';
|
|
11
|
+
import { assetAmountInWei } from '@defisaver/tokens';
|
|
2
12
|
import { aprToApy, calcLeverageLiqPrice, getAssetsTotal, STABLE_ASSETS, } from '../../moneymarket';
|
|
3
13
|
import { calculateInterestEarned } from '../../staking';
|
|
4
14
|
import { LeverageType, } from '../../types';
|
|
15
|
+
import { borrowOperations } from '../../constants';
|
|
16
|
+
import { AaveV4ViewContractViem } from '../../contracts';
|
|
17
|
+
import { getViemProvider } from '../../services/viem';
|
|
5
18
|
export const calcUserRiskPremiumBps = (usedAssets, assetsData) => {
|
|
6
19
|
const collaterals = [];
|
|
7
20
|
const debts = [];
|
|
@@ -219,3 +232,46 @@ export const aaveV4GetAggregatedPositionData = ({ usedAssets, assetsData, networ
|
|
|
219
232
|
payload.totalInterestUsd = totalInterestUsd;
|
|
220
233
|
return payload;
|
|
221
234
|
};
|
|
235
|
+
const getAaveV4ApyAfterValuesEstimationInner = (selectedSpoke, assetsData, actions, client, network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
236
|
+
const params = actions.map(({ action, asset, amount }) => {
|
|
237
|
+
const isDebtAsset = borrowOperations.includes(action);
|
|
238
|
+
const assetData = assetsData[asset];
|
|
239
|
+
const amountInWei = assetAmountInWei(amount, assetData.symbol);
|
|
240
|
+
let liquidityAdded;
|
|
241
|
+
let liquidityTaken;
|
|
242
|
+
if (isDebtAsset) {
|
|
243
|
+
liquidityAdded = action === 'payback' ? amountInWei : '0';
|
|
244
|
+
liquidityTaken = action === 'borrow' ? amountInWei : '0';
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
liquidityAdded = action === 'collateral' ? amountInWei : '0';
|
|
248
|
+
liquidityTaken = action === 'withdraw' ? amountInWei : '0';
|
|
249
|
+
}
|
|
250
|
+
return {
|
|
251
|
+
reserveId: BigInt(assetData.reserveId),
|
|
252
|
+
liquidityAdded: BigInt(liquidityAdded),
|
|
253
|
+
liquidityTaken: BigInt(liquidityTaken),
|
|
254
|
+
isDebtAsset,
|
|
255
|
+
};
|
|
256
|
+
});
|
|
257
|
+
const viewContract = AaveV4ViewContractViem(client, network);
|
|
258
|
+
const data = yield viewContract.read.getApyAfterValuesEstimation([selectedSpoke.address, params]);
|
|
259
|
+
const rates = {};
|
|
260
|
+
data.forEach((item) => {
|
|
261
|
+
const { hubDrawnRateEstimation, hubTotalDrawnEstimation, hubTotalLiquidityEstimation, hubSwept, liquidityFee, reserveId, } = item;
|
|
262
|
+
const drawnRate = new Dec(hubDrawnRateEstimation.toString()).div(new Dec(10).pow(27));
|
|
263
|
+
const borrowApr = drawnRate.mul(100);
|
|
264
|
+
const assetData = Object.values(assetsData).find(({ reserveId: rId }) => rId === Number(reserveId));
|
|
265
|
+
const totalDrawn = new Dec(hubTotalDrawnEstimation.toString());
|
|
266
|
+
const swept = new Dec(hubSwept.toString());
|
|
267
|
+
const hubUtilizationDenominator = totalDrawn.add(swept).add(hubTotalLiquidityEstimation.toString());
|
|
268
|
+
const hubUtilization = hubUtilizationDenominator.isZero() ? new Dec(0) : totalDrawn.div(hubUtilizationDenominator);
|
|
269
|
+
const supplyApr = borrowApr.mul(hubUtilization).mul((assetData === null || assetData === void 0 ? void 0 : assetData.premiumMultiplier) || '0').mul(new Dec(1).minus((assetData === null || assetData === void 0 ? void 0 : assetData.liquidityFee) || '0'));
|
|
270
|
+
rates[`${assetData === null || assetData === void 0 ? void 0 : assetData.symbol}-${assetData === null || assetData === void 0 ? void 0 : assetData.reserveId}`] = {
|
|
271
|
+
borrowRate: aprToApy(borrowApr.toString()),
|
|
272
|
+
supplyRate: aprToApy(supplyApr.toString()),
|
|
273
|
+
};
|
|
274
|
+
});
|
|
275
|
+
return rates;
|
|
276
|
+
});
|
|
277
|
+
export const getAaveV4ApyAfterValuesEstimation = (selectedSpoke, assetsData, actions, provider, network) => __awaiter(void 0, void 0, void 0, function* () { return getAaveV4ApyAfterValuesEstimationInner(selectedSpoke, assetsData, actions, getViemProvider(provider, network), network); });
|
|
@@ -129,73 +129,73 @@ export const getApyAfterValuesEstimation = (selectedMarket, actions, provider, n
|
|
|
129
129
|
return { borrowRate, supplyRate };
|
|
130
130
|
});
|
|
131
131
|
const API_URL = 'https://blue-api.morpho.org/graphql';
|
|
132
|
-
const MARKET_QUERY = `
|
|
133
|
-
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
134
|
-
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
135
|
-
reallocatableLiquidityAssets
|
|
136
|
-
targetBorrowUtilization
|
|
137
|
-
loanAsset {
|
|
138
|
-
address
|
|
139
|
-
decimals
|
|
140
|
-
priceUsd
|
|
141
|
-
}
|
|
142
|
-
state {
|
|
143
|
-
liquidityAssets
|
|
144
|
-
borrowAssets
|
|
145
|
-
supplyAssets
|
|
146
|
-
}
|
|
147
|
-
publicAllocatorSharedLiquidity {
|
|
148
|
-
assets
|
|
149
|
-
vault {
|
|
150
|
-
address
|
|
151
|
-
name
|
|
152
|
-
}
|
|
153
|
-
allocationMarket {
|
|
154
|
-
uniqueKey
|
|
155
|
-
loanAsset {
|
|
156
|
-
address
|
|
157
|
-
}
|
|
158
|
-
collateralAsset {
|
|
159
|
-
address
|
|
160
|
-
}
|
|
161
|
-
irmAddress
|
|
162
|
-
oracle {
|
|
163
|
-
address
|
|
164
|
-
}
|
|
165
|
-
lltv
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
loanAsset {
|
|
169
|
-
address
|
|
170
|
-
}
|
|
171
|
-
collateralAsset {
|
|
172
|
-
address
|
|
173
|
-
}
|
|
174
|
-
oracle {
|
|
175
|
-
address
|
|
176
|
-
}
|
|
177
|
-
irmAddress
|
|
178
|
-
lltv
|
|
179
|
-
}
|
|
180
|
-
}
|
|
132
|
+
const MARKET_QUERY = `
|
|
133
|
+
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
134
|
+
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
135
|
+
reallocatableLiquidityAssets
|
|
136
|
+
targetBorrowUtilization
|
|
137
|
+
loanAsset {
|
|
138
|
+
address
|
|
139
|
+
decimals
|
|
140
|
+
priceUsd
|
|
141
|
+
}
|
|
142
|
+
state {
|
|
143
|
+
liquidityAssets
|
|
144
|
+
borrowAssets
|
|
145
|
+
supplyAssets
|
|
146
|
+
}
|
|
147
|
+
publicAllocatorSharedLiquidity {
|
|
148
|
+
assets
|
|
149
|
+
vault {
|
|
150
|
+
address
|
|
151
|
+
name
|
|
152
|
+
}
|
|
153
|
+
allocationMarket {
|
|
154
|
+
uniqueKey
|
|
155
|
+
loanAsset {
|
|
156
|
+
address
|
|
157
|
+
}
|
|
158
|
+
collateralAsset {
|
|
159
|
+
address
|
|
160
|
+
}
|
|
161
|
+
irmAddress
|
|
162
|
+
oracle {
|
|
163
|
+
address
|
|
164
|
+
}
|
|
165
|
+
lltv
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
loanAsset {
|
|
169
|
+
address
|
|
170
|
+
}
|
|
171
|
+
collateralAsset {
|
|
172
|
+
address
|
|
173
|
+
}
|
|
174
|
+
oracle {
|
|
175
|
+
address
|
|
176
|
+
}
|
|
177
|
+
irmAddress
|
|
178
|
+
lltv
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
181
|
`;
|
|
182
|
-
const REWARDS_QUERY = `
|
|
183
|
-
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
184
|
-
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
185
|
-
uniqueKey
|
|
186
|
-
state {
|
|
187
|
-
rewards {
|
|
188
|
-
amountPerSuppliedToken
|
|
189
|
-
supplyApr
|
|
190
|
-
amountPerBorrowedToken
|
|
191
|
-
borrowApr
|
|
192
|
-
asset {
|
|
193
|
-
address
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
182
|
+
const REWARDS_QUERY = `
|
|
183
|
+
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
184
|
+
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
185
|
+
uniqueKey
|
|
186
|
+
state {
|
|
187
|
+
rewards {
|
|
188
|
+
amountPerSuppliedToken
|
|
189
|
+
supplyApr
|
|
190
|
+
amountPerBorrowedToken
|
|
191
|
+
borrowApr
|
|
192
|
+
asset {
|
|
193
|
+
address
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
199
|
`;
|
|
200
200
|
/**
|
|
201
201
|
* Get reallocatable liquidity to a given market and target borrow utilization
|
|
@@ -14,23 +14,23 @@ import * as morphoVaultsOptions from './options';
|
|
|
14
14
|
import { getViemProvider } from '../../services/viem';
|
|
15
15
|
import { getMorphoVaultContractViem } from '../../contracts';
|
|
16
16
|
export { morphoVaultsOptions, };
|
|
17
|
-
const vaultDataQuery = (vaultAddress) => `query vaultByAddress {
|
|
18
|
-
vaultByAddress(chainId: 1, address: "${vaultAddress}") {
|
|
19
|
-
id,
|
|
20
|
-
dailyApy,
|
|
21
|
-
dailyApys {
|
|
22
|
-
apy, netApy
|
|
23
|
-
},
|
|
24
|
-
monthlyApys {
|
|
25
|
-
apy, netApy
|
|
26
|
-
},
|
|
27
|
-
liquidity {
|
|
28
|
-
underlying, usd,
|
|
29
|
-
},
|
|
30
|
-
asset {
|
|
31
|
-
priceUsd
|
|
32
|
-
}
|
|
33
|
-
}
|
|
17
|
+
const vaultDataQuery = (vaultAddress) => `query vaultByAddress {
|
|
18
|
+
vaultByAddress(chainId: 1, address: "${vaultAddress}") {
|
|
19
|
+
id,
|
|
20
|
+
dailyApy,
|
|
21
|
+
dailyApys {
|
|
22
|
+
apy, netApy
|
|
23
|
+
},
|
|
24
|
+
monthlyApys {
|
|
25
|
+
apy, netApy
|
|
26
|
+
},
|
|
27
|
+
liquidity {
|
|
28
|
+
underlying, usd,
|
|
29
|
+
},
|
|
30
|
+
asset {
|
|
31
|
+
priceUsd
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
34
|
}`;
|
|
35
35
|
const MORPHO_BLUE_API = 'https://blue-api.morpho.org/graphql';
|
|
36
36
|
export const _getMorphoVaultData = (provider, network, morphoVault, accounts) => __awaiter(void 0, void 0, void 0, function* () {
|
package/esm/services/utils.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare const bytesToString: (hex: string) => string;
|
|
|
16
16
|
* Map an input value from one range (minInput, maxInput) to a value in another range (minOutput, maxOutput)
|
|
17
17
|
*/
|
|
18
18
|
export declare const mapRange: (input: number | string, minInput: number | string, maxInput: number | string, minOutput: number | string, maxOutput: number | string) => number;
|
|
19
|
-
export declare const isEnabledOnBitmap: (bitmap: number, assetId: number) =>
|
|
19
|
+
export declare const isEnabledOnBitmap: (bitmap: string | bigint | number, assetId: string | bigint | number) => boolean;
|
|
20
20
|
export declare const MAXUINT: string;
|
|
21
21
|
export declare const isMaxUint: (amount: string) => boolean;
|
|
22
22
|
export declare const isMainnetNetwork: (network: NetworkNumber) => network is NetworkNumber.Eth;
|
package/esm/services/utils.js
CHANGED
|
@@ -28,8 +28,9 @@ export const mapRange = (input, minInput, maxInput, minOutput, maxOutput) => {
|
|
|
28
28
|
// output = output_start + slope * (input - input_start)
|
|
29
29
|
return new Dec(minOutput).plus(new Dec(slope).mul(new Dec(input).minus(minInput))).toDP(2).toNumber();
|
|
30
30
|
};
|
|
31
|
+
export const isEnabledOnBitmap = (bitmap, assetId) => (
|
|
31
32
|
// eslint-disable-next-line no-bitwise
|
|
32
|
-
|
|
33
|
+
((BigInt(bitmap) >> BigInt(assetId)) & BigInt(1)) === BigInt(1));
|
|
33
34
|
export const MAXUINT = '115792089237316195423570985008687907853269984665640564039457584007913129639935';
|
|
34
35
|
export const isMaxUint = (amount) => compareAddresses(MAXUINT, amount);
|
|
35
36
|
export const isMainnetNetwork = (network) => network === NetworkNumber.Eth;
|
package/esm/types/aaveV4.d.ts
CHANGED
|
@@ -107,6 +107,8 @@ export interface AaveV4ReserveAssetData {
|
|
|
107
107
|
utilization: string;
|
|
108
108
|
/** Hub `liquidity` for this assetId (underlying amount), used for pool-level borrow/withdraw limits */
|
|
109
109
|
hubLiquidity: string;
|
|
110
|
+
premiumMultiplier: string;
|
|
111
|
+
liquidityFee: string;
|
|
110
112
|
}
|
|
111
113
|
export type AaveV4AssetsData = Record<string, AaveV4ReserveAssetData>;
|
|
112
114
|
export interface AaveV4UsedReserveAsset {
|
package/package.json
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@defisaver/positions-sdk",
|
|
3
|
-
"version": "2.1.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "./cjs/index.js",
|
|
6
|
-
"module": "./esm/index.js",
|
|
7
|
-
"types": "./esm/index.d.ts",
|
|
8
|
-
"scripts": {
|
|
9
|
-
"build:esm": "rm -rf esm && tsc -p tsconfig.esm.json",
|
|
10
|
-
"build:cjs": "rm -rf cjs && tsc -p tsconfig.cjs.json",
|
|
11
|
-
"build": "npm run lint && npm run build:cjs && npm run build:esm",
|
|
12
|
-
"dev": "tsc -p tsconfig.json --watch",
|
|
13
|
-
"lint": "eslint src/ --fix",
|
|
14
|
-
"lint-check": "eslint src/",
|
|
15
|
-
"test": "mocha tests/*",
|
|
16
|
-
"test-single": "mocha ./tests/$npm_config_name.ts",
|
|
17
|
-
"test:debugger": "mocha --inspect-brk tests/*",
|
|
18
|
-
"version-bump": "git commit -am \"Version bump to $(npm version patch | cut -c 2-)\""
|
|
19
|
-
},
|
|
20
|
-
"keywords": [],
|
|
21
|
-
"author": "",
|
|
22
|
-
"license": "ISC",
|
|
23
|
-
"dependencies": {
|
|
24
|
-
"@defisaver/tokens": "^1.7.
|
|
25
|
-
"@types/lodash": "^4.17.15",
|
|
26
|
-
"@types/memoizee": "^0.4.12",
|
|
27
|
-
"decimal.js": "^10.6.0",
|
|
28
|
-
"graphql-request": "^1.8.2",
|
|
29
|
-
"lodash": "^4.17.21",
|
|
30
|
-
"memoizee": "^0.4.17",
|
|
31
|
-
"viem": "^2.37.9"
|
|
32
|
-
},
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"@defisaver/eslint-config": "^1.0.1",
|
|
35
|
-
"@metamask/eth-json-rpc-middleware": "^15.0.1",
|
|
36
|
-
"@metamask/eth-json-rpc-provider": "^4.1.6",
|
|
37
|
-
"@types/chai": "^5.0.0",
|
|
38
|
-
"@types/mocha": "^10.0.9",
|
|
39
|
-
"chai": "^4.3.8",
|
|
40
|
-
"dotenv": "^16.3.1",
|
|
41
|
-
"eslint": "^8.49.0",
|
|
42
|
-
"eslint-plugin-import": "^2.31.0",
|
|
43
|
-
"mocha": "^10.2.0",
|
|
44
|
-
"nock": "^14.0.0",
|
|
45
|
-
"ts-node": "^10.9.2",
|
|
46
|
-
"typescript": "^5.2.2"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@defisaver/positions-sdk",
|
|
3
|
+
"version": "2.1.98-aave-v4-apy-2",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./cjs/index.js",
|
|
6
|
+
"module": "./esm/index.js",
|
|
7
|
+
"types": "./esm/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build:esm": "rm -rf esm && tsc -p tsconfig.esm.json",
|
|
10
|
+
"build:cjs": "rm -rf cjs && tsc -p tsconfig.cjs.json",
|
|
11
|
+
"build": "npm run lint && npm run build:cjs && npm run build:esm",
|
|
12
|
+
"dev": "tsc -p tsconfig.json --watch",
|
|
13
|
+
"lint": "eslint src/ --fix",
|
|
14
|
+
"lint-check": "eslint src/",
|
|
15
|
+
"test": "mocha tests/*",
|
|
16
|
+
"test-single": "mocha ./tests/$npm_config_name.ts",
|
|
17
|
+
"test:debugger": "mocha --inspect-brk tests/*",
|
|
18
|
+
"version-bump": "git commit -am \"Version bump to $(npm version patch | cut -c 2-)\""
|
|
19
|
+
},
|
|
20
|
+
"keywords": [],
|
|
21
|
+
"author": "",
|
|
22
|
+
"license": "ISC",
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@defisaver/tokens": "^1.7.35",
|
|
25
|
+
"@types/lodash": "^4.17.15",
|
|
26
|
+
"@types/memoizee": "^0.4.12",
|
|
27
|
+
"decimal.js": "^10.6.0",
|
|
28
|
+
"graphql-request": "^1.8.2",
|
|
29
|
+
"lodash": "^4.17.21",
|
|
30
|
+
"memoizee": "^0.4.17",
|
|
31
|
+
"viem": "^2.37.9"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@defisaver/eslint-config": "^1.0.1",
|
|
35
|
+
"@metamask/eth-json-rpc-middleware": "^15.0.1",
|
|
36
|
+
"@metamask/eth-json-rpc-provider": "^4.1.6",
|
|
37
|
+
"@types/chai": "^5.0.0",
|
|
38
|
+
"@types/mocha": "^10.0.9",
|
|
39
|
+
"chai": "^4.3.8",
|
|
40
|
+
"dotenv": "^16.3.1",
|
|
41
|
+
"eslint": "^8.49.0",
|
|
42
|
+
"eslint-plugin-import": "^2.31.0",
|
|
43
|
+
"mocha": "^10.2.0",
|
|
44
|
+
"nock": "^14.0.0",
|
|
45
|
+
"ts-node": "^10.9.2",
|
|
46
|
+
"typescript": "^5.2.2"
|
|
47
|
+
}
|
|
48
|
+
}
|