@defisaver/positions-sdk 2.1.41 → 2.1.43-aave-v4-dev-1
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/aaveV4/index.d.ts +7 -0
- package/cjs/aaveV4/index.js +99 -0
- package/cjs/config/contracts.d.ts +1069 -0
- package/cjs/config/contracts.js +9 -0
- package/cjs/contracts.d.ts +18265 -0
- package/cjs/contracts.js +2 -1
- package/cjs/helpers/morphoBlueHelpers/index.js +66 -66
- package/cjs/index.d.ts +2 -1
- package/cjs/index.js +3 -1
- package/cjs/markets/aaveV4/index.d.ts +6 -0
- package/cjs/markets/aaveV4/index.js +20 -0
- package/cjs/markets/index.d.ts +1 -0
- package/cjs/markets/index.js +3 -1
- package/cjs/savings/morphoVaults/index.js +17 -17
- package/cjs/savings/morphoVaults/options.js +2 -2
- package/cjs/types/aaveV4.d.ts +73 -0
- package/cjs/types/aaveV4.js +11 -0
- package/cjs/types/index.d.ts +1 -0
- package/cjs/types/index.js +1 -0
- package/esm/aaveV4/index.d.ts +7 -0
- package/esm/aaveV4/index.js +90 -0
- package/esm/config/contracts.d.ts +1069 -0
- package/esm/config/contracts.js +8 -0
- package/esm/contracts.d.ts +18265 -0
- package/esm/contracts.js +1 -0
- package/esm/helpers/morphoBlueHelpers/index.js +66 -66
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -1
- package/esm/markets/aaveV4/index.d.ts +6 -0
- package/esm/markets/aaveV4/index.js +15 -0
- package/esm/markets/index.d.ts +1 -0
- package/esm/markets/index.js +1 -0
- package/esm/savings/morphoVaults/index.js +17 -17
- package/esm/savings/morphoVaults/options.js +2 -2
- package/esm/types/aaveV4.d.ts +73 -0
- package/esm/types/aaveV4.js +8 -0
- package/esm/types/index.d.ts +1 -0
- package/esm/types/index.js +1 -0
- package/package.json +48 -48
- package/src/aaveV2/index.ts +240 -240
- package/src/aaveV3/index.ts +625 -625
- package/src/aaveV3/merit.ts +97 -97
- package/src/aaveV3/merkl.ts +74 -74
- package/src/aaveV4/index.ts +90 -0
- 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 +244 -244
- package/src/compoundV3/index.ts +274 -274
- package/src/config/contracts.ts +1303 -1295
- package/src/constants/index.ts +10 -10
- package/src/contracts.ts +174 -172
- package/src/curveUsd/index.ts +254 -254
- package/src/eulerV2/index.ts +324 -324
- package/src/exchange/index.ts +25 -25
- package/src/fluid/index.ts +1800 -1800
- package/src/helpers/aaveHelpers/index.ts +187 -187
- package/src/helpers/compoundHelpers/index.ts +283 -283
- package/src/helpers/curveUsdHelpers/index.ts +40 -40
- package/src/helpers/eulerHelpers/index.ts +222 -222
- package/src/helpers/fluidHelpers/index.ts +326 -326
- package/src/helpers/index.ts +10 -10
- package/src/helpers/liquityV2Helpers/index.ts +82 -82
- package/src/helpers/llamaLendHelpers/index.ts +53 -53
- package/src/helpers/makerHelpers/index.ts +52 -52
- package/src/helpers/morphoBlueHelpers/index.ts +396 -396
- package/src/helpers/sparkHelpers/index.ts +158 -158
- package/src/index.ts +51 -49
- package/src/liquity/index.ts +159 -159
- package/src/liquityV2/index.ts +703 -703
- package/src/llamaLend/index.ts +305 -305
- package/src/maker/index.ts +223 -223
- package/src/markets/aave/index.ts +118 -118
- package/src/markets/aave/marketAssets.ts +54 -54
- package/src/markets/aaveV4/index.ts +17 -0
- 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 +26 -25
- 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 +971 -971
- package/src/markets/spark/index.ts +29 -29
- package/src/markets/spark/marketAssets.ts +12 -12
- package/src/moneymarket/moneymarketCommonService.ts +85 -85
- package/src/morphoBlue/index.ts +274 -274
- package/src/portfolio/index.ts +598 -598
- package/src/savings/index.ts +95 -95
- 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/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 +115 -115
- package/src/services/viem.ts +34 -34
- package/src/setup.ts +8 -8
- package/src/spark/index.ts +458 -458
- package/src/staking/eligibility.ts +53 -53
- package/src/staking/index.ts +1 -1
- package/src/staking/staking.ts +186 -186
- package/src/types/aave.ts +196 -196
- package/src/types/aaveV4.ts +81 -0
- package/src/types/claiming.ts +114 -114
- package/src/types/common.ts +107 -107
- package/src/types/compound.ts +144 -144
- package/src/types/curveUsd.ts +123 -123
- package/src/types/euler.ts +175 -175
- package/src/types/fluid.ts +483 -483
- package/src/types/index.ts +16 -15
- package/src/types/liquity.ts +30 -30
- package/src/types/liquityV2.ts +126 -126
- package/src/types/llamaLend.ts +159 -159
- package/src/types/maker.ts +63 -63
- package/src/types/merit.ts +1 -1
- package/src/types/merkl.ts +70 -70
- package/src/types/morphoBlue.ts +200 -200
- package/src/types/portfolio.ts +60 -60
- package/src/types/savings/index.ts +23 -23
- 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/yearnV3Vaults.ts +17 -17
- package/src/types/savings/yearnVaults.ts +14 -14
- package/src/types/spark.ts +134 -134
- package/src/umbrella/index.ts +69 -69
- package/src/umbrella/umbrellaUtils.ts +29 -29
package/cjs/contracts.js
CHANGED
|
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.AaveRewardsControllerViem = exports.SparkRewardsControllerViem = exports.UUPSViem = exports.LiquityStabilityPoolViem = exports.LiquityLQTYStakingViem = exports.AaveUmbrellaViewViem = exports.AaveIncentivesControllerViem = exports.FluidViewContractViem = exports.LiquityV2LegacyViewContractViem = exports.LiquityV2ViewContractViem = exports.LiquityActivePoolContractViem = exports.LiquityPriceFeedContractViem = exports.LiquityTroveManagerContractViem = exports.LiquityCollSurplusPoolContractViem = exports.LiquityViewContractViem = exports.BTCPriceFeedContractViem = exports.WeETHPriceFeedContractViem = exports.ComptrollerContractViem = exports.CompoundLoanInfoContractViem = exports.McdJugContractViem = exports.McdDogContractViem = exports.McdSpotterContractViem = exports.McdVatContractViem = exports.McdViewContractViem = exports.McdGetCdpsContractViem = exports.LlamaLendViewContractViem = exports.CrvUSDFactoryContractViem = exports.CrvUSDViewContractViem = exports.EulerV2ViewContractViem = exports.SparkIncentiveDataProviderContractViem = exports.SparkViewContractViem = exports.CompV3ViewContractViem = exports.WstETHPriceFeedContractViem = exports.USDCPriceFeedContractViem = exports.ETHPriceFeedContractViem = exports.COMPPriceFeedContractViem = exports.DFSFeedRegistryContractViem = exports.FeedRegistryContractViem = exports.AaveIncentiveDataProviderV3ContractViem = exports.AaveV3ViewContractViem = exports.AaveLoanInfoV2ContractViem = exports.MorphoBlueViewContractViem = exports.getYearnV3VaultContractViem = exports.getErc20ContractViem = exports.getSparkSavingsVaultContractViem = exports.getYearnVaultContractViem = exports.getMorphoVaultContractViem = exports.createViemContractFromConfigFunc = exports.getConfigContractAbi = exports.getConfigContractAddress = void 0;
|
|
37
|
-
exports.SkySavingsContractView = exports.MakerDsrContractViem = exports.YearnViewContractViem = exports.StkAAVEViem = exports.LiquityV2sBoldVaultViem = void 0;
|
|
37
|
+
exports.AaveV4ViewContractViem = exports.SkySavingsContractView = exports.MakerDsrContractViem = exports.YearnViewContractViem = exports.StkAAVEViem = exports.LiquityV2sBoldVaultViem = void 0;
|
|
38
38
|
const viem_1 = require("viem");
|
|
39
39
|
const configRaw = __importStar(require("./config/contracts"));
|
|
40
40
|
// @ts-ignore
|
|
@@ -177,3 +177,4 @@ exports.StkAAVEViem = (0, exports.createViemContractFromConfigFunc)('StkAAVE');
|
|
|
177
177
|
exports.YearnViewContractViem = (0, exports.createViemContractFromConfigFunc)('YearnView');
|
|
178
178
|
exports.MakerDsrContractViem = (0, exports.createViemContractFromConfigFunc)('MakerDsr');
|
|
179
179
|
exports.SkySavingsContractView = (0, exports.createViemContractFromConfigFunc)('SkySavings');
|
|
180
|
+
exports.AaveV4ViewContractViem = (0, exports.createViemContractFromConfigFunc)('AaveV4View');
|
|
@@ -128,73 +128,73 @@ const getApyAfterValuesEstimation = (selectedMarket, actions, provider, network)
|
|
|
128
128
|
});
|
|
129
129
|
exports.getApyAfterValuesEstimation = getApyAfterValuesEstimation;
|
|
130
130
|
const API_URL = 'https://blue-api.morpho.org/graphql';
|
|
131
|
-
const MARKET_QUERY = `
|
|
132
|
-
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
133
|
-
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
134
|
-
reallocatableLiquidityAssets
|
|
135
|
-
targetBorrowUtilization
|
|
136
|
-
loanAsset {
|
|
137
|
-
address
|
|
138
|
-
decimals
|
|
139
|
-
priceUsd
|
|
140
|
-
}
|
|
141
|
-
state {
|
|
142
|
-
liquidityAssets
|
|
143
|
-
borrowAssets
|
|
144
|
-
supplyAssets
|
|
145
|
-
}
|
|
146
|
-
publicAllocatorSharedLiquidity {
|
|
147
|
-
assets
|
|
148
|
-
vault {
|
|
149
|
-
address
|
|
150
|
-
name
|
|
151
|
-
}
|
|
152
|
-
allocationMarket {
|
|
153
|
-
uniqueKey
|
|
154
|
-
loanAsset {
|
|
155
|
-
address
|
|
156
|
-
}
|
|
157
|
-
collateralAsset {
|
|
158
|
-
address
|
|
159
|
-
}
|
|
160
|
-
irmAddress
|
|
161
|
-
oracle {
|
|
162
|
-
address
|
|
163
|
-
}
|
|
164
|
-
lltv
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
loanAsset {
|
|
168
|
-
address
|
|
169
|
-
}
|
|
170
|
-
collateralAsset {
|
|
171
|
-
address
|
|
172
|
-
}
|
|
173
|
-
oracle {
|
|
174
|
-
address
|
|
175
|
-
}
|
|
176
|
-
irmAddress
|
|
177
|
-
lltv
|
|
178
|
-
}
|
|
179
|
-
}
|
|
131
|
+
const MARKET_QUERY = `
|
|
132
|
+
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
133
|
+
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
134
|
+
reallocatableLiquidityAssets
|
|
135
|
+
targetBorrowUtilization
|
|
136
|
+
loanAsset {
|
|
137
|
+
address
|
|
138
|
+
decimals
|
|
139
|
+
priceUsd
|
|
140
|
+
}
|
|
141
|
+
state {
|
|
142
|
+
liquidityAssets
|
|
143
|
+
borrowAssets
|
|
144
|
+
supplyAssets
|
|
145
|
+
}
|
|
146
|
+
publicAllocatorSharedLiquidity {
|
|
147
|
+
assets
|
|
148
|
+
vault {
|
|
149
|
+
address
|
|
150
|
+
name
|
|
151
|
+
}
|
|
152
|
+
allocationMarket {
|
|
153
|
+
uniqueKey
|
|
154
|
+
loanAsset {
|
|
155
|
+
address
|
|
156
|
+
}
|
|
157
|
+
collateralAsset {
|
|
158
|
+
address
|
|
159
|
+
}
|
|
160
|
+
irmAddress
|
|
161
|
+
oracle {
|
|
162
|
+
address
|
|
163
|
+
}
|
|
164
|
+
lltv
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
loanAsset {
|
|
168
|
+
address
|
|
169
|
+
}
|
|
170
|
+
collateralAsset {
|
|
171
|
+
address
|
|
172
|
+
}
|
|
173
|
+
oracle {
|
|
174
|
+
address
|
|
175
|
+
}
|
|
176
|
+
irmAddress
|
|
177
|
+
lltv
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
180
|
`;
|
|
181
|
-
const REWARDS_QUERY = `
|
|
182
|
-
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
183
|
-
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
184
|
-
uniqueKey
|
|
185
|
-
state {
|
|
186
|
-
rewards {
|
|
187
|
-
amountPerSuppliedToken
|
|
188
|
-
supplyApr
|
|
189
|
-
amountPerBorrowedToken
|
|
190
|
-
borrowApr
|
|
191
|
-
asset {
|
|
192
|
-
address
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
181
|
+
const REWARDS_QUERY = `
|
|
182
|
+
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
183
|
+
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
184
|
+
uniqueKey
|
|
185
|
+
state {
|
|
186
|
+
rewards {
|
|
187
|
+
amountPerSuppliedToken
|
|
188
|
+
supplyApr
|
|
189
|
+
amountPerBorrowedToken
|
|
190
|
+
borrowApr
|
|
191
|
+
asset {
|
|
192
|
+
address
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
198
|
`;
|
|
199
199
|
/**
|
|
200
200
|
* Get reallocatable liquidity to a given market and target borrow utilization
|
package/cjs/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import './setup';
|
|
2
2
|
import * as fluid from './fluid';
|
|
3
|
+
import * as aaveV4 from './aaveV4';
|
|
3
4
|
import * as aaveV3 from './aaveV3';
|
|
4
5
|
import * as aaveV2 from './aaveV2';
|
|
5
6
|
import * as compoundV3 from './compoundV3';
|
|
@@ -21,4 +22,4 @@ import * as portfolio from './portfolio';
|
|
|
21
22
|
import * as claiming from './claiming';
|
|
22
23
|
import * as savings from './savings';
|
|
23
24
|
export * from './types';
|
|
24
|
-
export { aaveV2, aaveV3, compoundV2, compoundV3, spark, curveUsd, liquity, liquityV2, maker, exchange, staking, moneymarket, markets, helpers, morphoBlue, llamaLend, eulerV2, fluid, portfolio, claiming, savings, };
|
|
25
|
+
export { aaveV2, aaveV3, aaveV4, compoundV2, compoundV3, spark, curveUsd, liquity, liquityV2, maker, exchange, staking, moneymarket, markets, helpers, morphoBlue, llamaLend, eulerV2, fluid, portfolio, claiming, savings, };
|
package/cjs/index.js
CHANGED
|
@@ -36,10 +36,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
36
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.savings = exports.claiming = exports.portfolio = exports.fluid = exports.eulerV2 = exports.llamaLend = exports.morphoBlue = exports.helpers = exports.markets = exports.moneymarket = exports.staking = exports.exchange = exports.maker = exports.liquityV2 = exports.liquity = exports.curveUsd = exports.spark = exports.compoundV3 = exports.compoundV2 = exports.aaveV3 = exports.aaveV2 = void 0;
|
|
39
|
+
exports.savings = exports.claiming = exports.portfolio = exports.fluid = exports.eulerV2 = exports.llamaLend = exports.morphoBlue = exports.helpers = exports.markets = exports.moneymarket = exports.staking = exports.exchange = exports.maker = exports.liquityV2 = exports.liquity = exports.curveUsd = exports.spark = exports.compoundV3 = exports.compoundV2 = exports.aaveV4 = exports.aaveV3 = exports.aaveV2 = void 0;
|
|
40
40
|
require("./setup");
|
|
41
41
|
const fluid = __importStar(require("./fluid"));
|
|
42
42
|
exports.fluid = fluid;
|
|
43
|
+
const aaveV4 = __importStar(require("./aaveV4"));
|
|
44
|
+
exports.aaveV4 = aaveV4;
|
|
43
45
|
const aaveV3 = __importStar(require("./aaveV3"));
|
|
44
46
|
exports.aaveV3 = aaveV3;
|
|
45
47
|
const aaveV2 = __importStar(require("./aaveV2"));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AaveV4SpokeInfo } from '../../types';
|
|
2
|
+
import { NetworkNumber } from '../../types/common';
|
|
3
|
+
export declare const AAVE_V4_CORE_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
4
|
+
export declare const AaveV4Spokes: (networkId: NetworkNumber) => {
|
|
5
|
+
readonly aave_v4_core_spoke: AaveV4SpokeInfo;
|
|
6
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AaveV4Spokes = exports.AAVE_V4_CORE_SPOKE = void 0;
|
|
4
|
+
const types_1 = require("../../types");
|
|
5
|
+
const common_1 = require("../../types/common");
|
|
6
|
+
const AAVE_V4_CORE_SPOKE = (networkId) => ({
|
|
7
|
+
chainIds: [common_1.NetworkNumber.Eth],
|
|
8
|
+
label: 'Core Spoke',
|
|
9
|
+
value: types_1.AaveV4SpokesType.AaveV4CoreSpoke,
|
|
10
|
+
url: 'core',
|
|
11
|
+
address: '0xBa97c5E52cd5BC3D7950Ae70779F8FfE92d40CdC',
|
|
12
|
+
hubs: [
|
|
13
|
+
'0xaD905aD5EA5B98cD50AE40Cfe368344686a21366',
|
|
14
|
+
],
|
|
15
|
+
});
|
|
16
|
+
exports.AAVE_V4_CORE_SPOKE = AAVE_V4_CORE_SPOKE;
|
|
17
|
+
const AaveV4Spokes = (networkId) => ({
|
|
18
|
+
[types_1.AaveV4SpokesType.AaveV4CoreSpoke]: (0, exports.AAVE_V4_CORE_SPOKE)(networkId),
|
|
19
|
+
});
|
|
20
|
+
exports.AaveV4Spokes = AaveV4Spokes;
|
package/cjs/markets/index.d.ts
CHANGED
|
@@ -7,3 +7,4 @@ export { LlamaLendMarkets } from './llamaLend';
|
|
|
7
7
|
export { LiquityV2Markets, findLiquityV2MarketByAddress } from './liquityV2';
|
|
8
8
|
export { EulerV2Markets } from './euler';
|
|
9
9
|
export { FluidMarkets, getFluidVersionsDataForNetwork, getFluidMarketInfoById, getFTokenAddress, getFluidMarketInfoByAddress, } from './fluid';
|
|
10
|
+
export { AaveV4Spokes } from './aaveV4';
|
package/cjs/markets/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFluidMarketInfoByAddress = exports.getFTokenAddress = exports.getFluidMarketInfoById = exports.getFluidVersionsDataForNetwork = exports.FluidMarkets = exports.EulerV2Markets = exports.findLiquityV2MarketByAddress = exports.LiquityV2Markets = exports.LlamaLendMarkets = exports.findMorphoBlueMarket = exports.MorphoBlueMarkets = exports.CrvUsdMarkets = exports.SparkMarkets = exports.v3USDTCollAssets = exports.v3USDCeCollAssets = exports.v3USDCCollAssets = exports.v3USDbCCollAssets = exports.v3ETHCollAssets = exports.compoundV2CollateralAssets = exports.CompoundMarkets = exports.getAaveV3MarketByMarketAddress = exports.aaveV3AssetsDefaultMarket = exports.aaveV2AssetsDefaultMarket = exports.aaveV1AssetsDefaultMarket = exports.AaveMarkets = void 0;
|
|
3
|
+
exports.AaveV4Spokes = exports.getFluidMarketInfoByAddress = exports.getFTokenAddress = exports.getFluidMarketInfoById = exports.getFluidVersionsDataForNetwork = exports.FluidMarkets = exports.EulerV2Markets = exports.findLiquityV2MarketByAddress = exports.LiquityV2Markets = exports.LlamaLendMarkets = exports.findMorphoBlueMarket = exports.MorphoBlueMarkets = exports.CrvUsdMarkets = exports.SparkMarkets = exports.v3USDTCollAssets = exports.v3USDCeCollAssets = exports.v3USDCCollAssets = exports.v3USDbCCollAssets = exports.v3ETHCollAssets = exports.compoundV2CollateralAssets = exports.CompoundMarkets = exports.getAaveV3MarketByMarketAddress = exports.aaveV3AssetsDefaultMarket = exports.aaveV2AssetsDefaultMarket = exports.aaveV1AssetsDefaultMarket = exports.AaveMarkets = void 0;
|
|
4
4
|
var aave_1 = require("./aave");
|
|
5
5
|
Object.defineProperty(exports, "AaveMarkets", { enumerable: true, get: function () { return aave_1.AaveMarkets; } });
|
|
6
6
|
Object.defineProperty(exports, "aaveV1AssetsDefaultMarket", { enumerable: true, get: function () { return aave_1.aaveV1AssetsDefaultMarket; } });
|
|
@@ -35,3 +35,5 @@ Object.defineProperty(exports, "getFluidVersionsDataForNetwork", { enumerable: t
|
|
|
35
35
|
Object.defineProperty(exports, "getFluidMarketInfoById", { enumerable: true, get: function () { return fluid_1.getFluidMarketInfoById; } });
|
|
36
36
|
Object.defineProperty(exports, "getFTokenAddress", { enumerable: true, get: function () { return fluid_1.getFTokenAddress; } });
|
|
37
37
|
Object.defineProperty(exports, "getFluidMarketInfoByAddress", { enumerable: true, get: function () { return fluid_1.getFluidMarketInfoByAddress; } });
|
|
38
|
+
var aaveV4_1 = require("./aaveV4");
|
|
39
|
+
Object.defineProperty(exports, "AaveV4Spokes", { enumerable: true, get: function () { return aaveV4_1.AaveV4Spokes; } });
|
|
@@ -54,23 +54,23 @@ const morphoVaultsOptions = __importStar(require("./options"));
|
|
|
54
54
|
exports.morphoVaultsOptions = morphoVaultsOptions;
|
|
55
55
|
const viem_1 = require("../../services/viem");
|
|
56
56
|
const contracts_1 = require("../../contracts");
|
|
57
|
-
const vaultDataQuery = (vaultAddress) => `query vaultByAddress {
|
|
58
|
-
vaultByAddress(chainId: 1, address: "${vaultAddress}") {
|
|
59
|
-
id,
|
|
60
|
-
dailyApy,
|
|
61
|
-
dailyApys {
|
|
62
|
-
apy, netApy
|
|
63
|
-
},
|
|
64
|
-
monthlyApys {
|
|
65
|
-
apy, netApy
|
|
66
|
-
},
|
|
67
|
-
liquidity {
|
|
68
|
-
underlying, usd,
|
|
69
|
-
},
|
|
70
|
-
asset {
|
|
71
|
-
priceUsd
|
|
72
|
-
}
|
|
73
|
-
}
|
|
57
|
+
const vaultDataQuery = (vaultAddress) => `query vaultByAddress {
|
|
58
|
+
vaultByAddress(chainId: 1, address: "${vaultAddress}") {
|
|
59
|
+
id,
|
|
60
|
+
dailyApy,
|
|
61
|
+
dailyApys {
|
|
62
|
+
apy, netApy
|
|
63
|
+
},
|
|
64
|
+
monthlyApys {
|
|
65
|
+
apy, netApy
|
|
66
|
+
},
|
|
67
|
+
liquidity {
|
|
68
|
+
underlying, usd,
|
|
69
|
+
},
|
|
70
|
+
asset {
|
|
71
|
+
priceUsd
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
74
|
}`;
|
|
75
75
|
const MORPHO_BLUE_API = 'https://blue-api.morpho.org/graphql';
|
|
76
76
|
const _getMorphoVaultData = (provider, network, morphoVault, accounts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -102,7 +102,7 @@ exports.MORPHO_VAULT_STEAKHOUSE_USDT = {
|
|
|
102
102
|
exports.MORPHO_VAULT_STEAKHOUSE_USDC = {
|
|
103
103
|
type: types_1.MorphoVaultType.MorphoVaultSteakhouseUSDC,
|
|
104
104
|
name: 'Steakhouse USDC',
|
|
105
|
-
address: '
|
|
105
|
+
address: '0xBEEF01735c132Ada46AA9aA4c54623cAA92A64CB',
|
|
106
106
|
asset: 'USDC',
|
|
107
107
|
deploymentBlock: 18928285,
|
|
108
108
|
isLegacy: false,
|
|
@@ -118,7 +118,7 @@ exports.MORPHO_VAULT_STEAKHOUSE_ETH = {
|
|
|
118
118
|
exports.MORPHO_VAULT_STEAKHOUSE_PYUSD = {
|
|
119
119
|
type: types_1.MorphoVaultType.MorphoVaultSteakhousePYUSD,
|
|
120
120
|
name: 'Steakhouse PYUSD',
|
|
121
|
-
address: '
|
|
121
|
+
address: '0xbEEF02e5E13584ab96848af90261f0C8Ee04722a',
|
|
122
122
|
asset: 'PYUSD',
|
|
123
123
|
deploymentBlock: 19043398,
|
|
124
124
|
isLegacy: false,
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { EthAddress, NetworkNumber } from './common';
|
|
2
|
+
export declare enum AaveV4SpokesType {
|
|
3
|
+
AaveV4CoreSpoke = "aave_v4_core_spoke"
|
|
4
|
+
}
|
|
5
|
+
export declare enum AaveV4HubsType {
|
|
6
|
+
AaveV4CoreHub = "aave_v4_core_hub"
|
|
7
|
+
}
|
|
8
|
+
export interface AaveV4SpokeInfo {
|
|
9
|
+
chainIds: NetworkNumber[];
|
|
10
|
+
label: string;
|
|
11
|
+
value: AaveV4SpokesType;
|
|
12
|
+
url: string;
|
|
13
|
+
address: EthAddress;
|
|
14
|
+
hubs: EthAddress[];
|
|
15
|
+
}
|
|
16
|
+
export interface AaveV4HubAssetOnChainData {
|
|
17
|
+
assetId: number;
|
|
18
|
+
drawnRate: bigint;
|
|
19
|
+
}
|
|
20
|
+
export interface AaveV4HubOnChainData {
|
|
21
|
+
assets: Record<number, AaveV4HubAssetOnChainData>;
|
|
22
|
+
}
|
|
23
|
+
export interface AaveV4ReserveAssetOnChain {
|
|
24
|
+
underlying: EthAddress;
|
|
25
|
+
hub: EthAddress;
|
|
26
|
+
assetId: number;
|
|
27
|
+
decimals: number;
|
|
28
|
+
paused: boolean;
|
|
29
|
+
frozen: boolean;
|
|
30
|
+
borrowable: boolean;
|
|
31
|
+
collateralRisk: number;
|
|
32
|
+
collateralFactor: number;
|
|
33
|
+
maxLiquidationBonus: number;
|
|
34
|
+
liquidationFee: number;
|
|
35
|
+
price: bigint;
|
|
36
|
+
totalSupplied: bigint;
|
|
37
|
+
totalDrawn: bigint;
|
|
38
|
+
totalPremium: bigint;
|
|
39
|
+
totalDebt: bigint;
|
|
40
|
+
supplyCap: bigint;
|
|
41
|
+
borrowCap: bigint;
|
|
42
|
+
deficitRay: bigint;
|
|
43
|
+
spokeActive: boolean;
|
|
44
|
+
spokePaused: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface AaveV4ReserveAssetData {
|
|
47
|
+
symbol: string;
|
|
48
|
+
underlying: EthAddress;
|
|
49
|
+
hub: EthAddress;
|
|
50
|
+
assetId: number;
|
|
51
|
+
paused: boolean;
|
|
52
|
+
frozen: boolean;
|
|
53
|
+
borrowable: boolean;
|
|
54
|
+
collateralRisk: number;
|
|
55
|
+
collateralFactor: number;
|
|
56
|
+
liquidationFee: number;
|
|
57
|
+
price: string;
|
|
58
|
+
totalSupplied: string;
|
|
59
|
+
totalDrawn: string;
|
|
60
|
+
totalPremium: string;
|
|
61
|
+
totalDebt: string;
|
|
62
|
+
supplyCap: string;
|
|
63
|
+
borrowCap: string;
|
|
64
|
+
spokeActive: boolean;
|
|
65
|
+
spokePaused: boolean;
|
|
66
|
+
drawnRate: string;
|
|
67
|
+
}
|
|
68
|
+
export interface AaveV4SpokeData {
|
|
69
|
+
assetsData: Record<string, AaveV4ReserveAssetData>;
|
|
70
|
+
oracle: EthAddress;
|
|
71
|
+
oracleDecimals: number;
|
|
72
|
+
address: EthAddress;
|
|
73
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AaveV4HubsType = exports.AaveV4SpokesType = void 0;
|
|
4
|
+
var AaveV4SpokesType;
|
|
5
|
+
(function (AaveV4SpokesType) {
|
|
6
|
+
AaveV4SpokesType["AaveV4CoreSpoke"] = "aave_v4_core_spoke";
|
|
7
|
+
})(AaveV4SpokesType || (exports.AaveV4SpokesType = AaveV4SpokesType = {}));
|
|
8
|
+
var AaveV4HubsType;
|
|
9
|
+
(function (AaveV4HubsType) {
|
|
10
|
+
AaveV4HubsType["AaveV4CoreHub"] = "aave_v4_core_hub";
|
|
11
|
+
})(AaveV4HubsType || (exports.AaveV4HubsType = AaveV4HubsType = {}));
|
package/cjs/types/index.d.ts
CHANGED
package/cjs/types/index.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Client } from 'viem';
|
|
2
|
+
import { AaveV4SpokeData, AaveV4SpokeInfo } from '../types';
|
|
3
|
+
import { EthAddress, EthereumProvider, NetworkNumber } from '../types/common';
|
|
4
|
+
export declare function _getAaveV4SpokeData(provider: Client, network: NetworkNumber, market: AaveV4SpokeInfo, blockNumber?: 'latest' | number): Promise<AaveV4SpokeData>;
|
|
5
|
+
export declare function getAaveV4SpokeData(provider: EthereumProvider, network: NetworkNumber, spoke: AaveV4SpokeInfo, blockNumber?: 'latest' | number): Promise<AaveV4SpokeData>;
|
|
6
|
+
export declare function _getAaveV4AccountData(provider: Client, network: NetworkNumber, marketData: AaveV4SpokeData, address: EthAddress, blockNumber?: 'latest' | number): Promise<any>;
|
|
7
|
+
export declare function getAaveV4AccountData(provider: EthereumProvider, network: NetworkNumber, marketData: AaveV4SpokeData, address: EthAddress, blockNumber?: 'latest' | number): Promise<any>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import Dec from 'decimal.js';
|
|
11
|
+
import { assetAmountInEth, getAssetInfoByAddress } from '@defisaver/tokens';
|
|
12
|
+
import { getViemProvider } from '../services/viem';
|
|
13
|
+
import { AaveV4ViewContractViem } from '../contracts';
|
|
14
|
+
const fetchHubData = (viewContract, hubAddress) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
const hubData = yield viewContract.read.getHubAllAssetsData([hubAddress]);
|
|
16
|
+
console.log('hubData', hubData);
|
|
17
|
+
return {
|
|
18
|
+
assets: hubData.reduce((acc, assetOnChainData) => {
|
|
19
|
+
acc[assetOnChainData.assetId] = {
|
|
20
|
+
assetId: assetOnChainData.assetId,
|
|
21
|
+
drawnRate: assetOnChainData.drawnRate,
|
|
22
|
+
};
|
|
23
|
+
return acc;
|
|
24
|
+
}, {}),
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
const formatReserveAsset = (reserveAsset, hubAsset, oracleDecimals) => {
|
|
28
|
+
const assetInfo = getAssetInfoByAddress(reserveAsset.underlying);
|
|
29
|
+
return ({
|
|
30
|
+
symbol: assetInfo.symbol,
|
|
31
|
+
underlying: reserveAsset.underlying,
|
|
32
|
+
hub: reserveAsset.hub,
|
|
33
|
+
assetId: reserveAsset.assetId,
|
|
34
|
+
paused: reserveAsset.paused,
|
|
35
|
+
frozen: reserveAsset.frozen,
|
|
36
|
+
borrowable: reserveAsset.borrowable,
|
|
37
|
+
collateralRisk: new Dec(reserveAsset.collateralRisk).div(10000).toNumber(),
|
|
38
|
+
collateralFactor: new Dec(reserveAsset.collateralFactor).div(10000).toNumber(),
|
|
39
|
+
liquidationFee: new Dec(reserveAsset.liquidationFee).div(10000).toNumber(),
|
|
40
|
+
price: new Dec(reserveAsset.price).div(new Dec(10).pow(oracleDecimals)).toString(),
|
|
41
|
+
totalSupplied: assetAmountInEth(reserveAsset.totalSupplied.toString(), assetInfo.symbol),
|
|
42
|
+
totalDrawn: assetAmountInEth(reserveAsset.totalDrawn.toString(), assetInfo.symbol),
|
|
43
|
+
totalPremium: assetAmountInEth(reserveAsset.totalPremium.toString(), assetInfo.symbol),
|
|
44
|
+
totalDebt: assetAmountInEth(reserveAsset.totalDebt.toString(), assetInfo.symbol),
|
|
45
|
+
supplyCap: assetAmountInEth(reserveAsset.supplyCap.toString(), assetInfo.symbol),
|
|
46
|
+
borrowCap: assetAmountInEth(reserveAsset.borrowCap.toString(), assetInfo.symbol),
|
|
47
|
+
spokeActive: reserveAsset.spokeActive,
|
|
48
|
+
spokePaused: reserveAsset.spokePaused,
|
|
49
|
+
drawnRate: new Dec(hubAsset.drawnRate).div(new Dec(10).pow(27)).toString(),
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
export function _getAaveV4SpokeData(provider_1, network_1, market_1) {
|
|
53
|
+
return __awaiter(this, arguments, void 0, function* (provider, network, market, blockNumber = 'latest') {
|
|
54
|
+
const viewContract = AaveV4ViewContractViem(provider, network, blockNumber);
|
|
55
|
+
const hubsData = {};
|
|
56
|
+
const [spokeData] = yield Promise.all([
|
|
57
|
+
viewContract.read.getSpokeDataFull([market.address]),
|
|
58
|
+
...market.hubs.map((hubAddress) => __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
hubsData[hubAddress] = yield fetchHubData(viewContract, hubAddress);
|
|
60
|
+
})),
|
|
61
|
+
]);
|
|
62
|
+
const reserveAssetsArray = spokeData[1].map((reserveAssetOnChain) => formatReserveAsset(reserveAssetOnChain, hubsData[reserveAssetOnChain.hub].assets[reserveAssetOnChain.assetId], +spokeData[0].oracleDecimals.toString()));
|
|
63
|
+
return {
|
|
64
|
+
assetsData: reserveAssetsArray.reduce((acc, reserveAsset) => {
|
|
65
|
+
acc[reserveAsset.symbol] = reserveAsset;
|
|
66
|
+
return acc;
|
|
67
|
+
}, {}),
|
|
68
|
+
oracle: spokeData[0].oracle,
|
|
69
|
+
oracleDecimals: +spokeData[0].oracleDecimals.toString(),
|
|
70
|
+
address: market.address,
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
export function getAaveV4SpokeData(provider_1, network_1, spoke_1) {
|
|
75
|
+
return __awaiter(this, arguments, void 0, function* (provider, network, spoke, blockNumber = 'latest') {
|
|
76
|
+
return _getAaveV4SpokeData(getViemProvider(provider, network), network, spoke, blockNumber);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
export function _getAaveV4AccountData(provider_1, network_1, marketData_1, address_1) {
|
|
80
|
+
return __awaiter(this, arguments, void 0, function* (provider, network, marketData, address, blockNumber = 'latest') {
|
|
81
|
+
const viewContract = AaveV4ViewContractViem(provider, network, blockNumber);
|
|
82
|
+
const loanData = yield viewContract.read.getLoanData([marketData.address, address]);
|
|
83
|
+
console.log('loanData', loanData);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
export function getAaveV4AccountData(provider_1, network_1, marketData_1, address_1) {
|
|
87
|
+
return __awaiter(this, arguments, void 0, function* (provider, network, marketData, address, blockNumber = 'latest') {
|
|
88
|
+
return _getAaveV4AccountData(getViemProvider(provider, network), network, marketData, address, blockNumber);
|
|
89
|
+
});
|
|
90
|
+
}
|