@defisaver/positions-sdk 2.1.127-midnight-1-dev → 2.1.127-midnight-2-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/aaveV3/index.js +7 -1
- package/cjs/aaveV4/lend.js +3 -3
- package/cjs/claiming/index.d.ts +2 -1
- package/cjs/claiming/index.js +3 -1
- package/cjs/claiming/uniswap.d.ts +5 -0
- package/cjs/claiming/uniswap.js +75 -0
- package/cjs/config/contracts.d.ts +22 -0
- package/cjs/config/contracts.js +9 -1
- package/cjs/contracts.d.ts +35 -0
- package/cjs/contracts.js +2 -1
- package/cjs/curveUsd/index.js +1 -1
- package/cjs/helpers/morphoBlueHelpers/index.js +1 -0
- package/cjs/helpers/morphoMidnightHelpers/index.d.ts +33 -5
- package/cjs/helpers/morphoMidnightHelpers/index.js +66 -13
- package/cjs/llamaLend/index.js +1 -1
- package/cjs/markets/aaveV4/index.d.ts +2 -0
- package/cjs/markets/aaveV4/index.js +14 -1
- package/cjs/morphoBlue/index.d.ts +8 -6
- package/cjs/morphoBlue/index.js +69 -40
- package/cjs/portfolio/index.js +31 -2
- package/cjs/savings/summerVaults/options.js +10 -10
- package/cjs/staking/staking.js +3 -0
- package/cjs/types/aaveV4.d.ts +2 -1
- package/cjs/types/aaveV4.js +1 -0
- package/cjs/types/claiming.d.ts +10 -0
- package/cjs/types/claiming.js +2 -0
- package/cjs/types/morphoBlue.d.ts +9 -0
- package/esm/aaveV3/index.js +7 -1
- package/esm/aaveV4/lend.js +3 -3
- package/esm/claiming/index.d.ts +2 -1
- package/esm/claiming/index.js +2 -1
- package/esm/claiming/uniswap.d.ts +5 -0
- package/esm/claiming/uniswap.js +67 -0
- package/esm/config/contracts.d.ts +22 -0
- package/esm/config/contracts.js +8 -0
- package/esm/contracts.d.ts +35 -0
- package/esm/contracts.js +1 -0
- package/esm/curveUsd/index.js +1 -1
- package/esm/helpers/morphoBlueHelpers/index.js +1 -0
- package/esm/helpers/morphoMidnightHelpers/index.d.ts +33 -5
- package/esm/helpers/morphoMidnightHelpers/index.js +63 -12
- package/esm/llamaLend/index.js +1 -1
- package/esm/markets/aaveV4/index.d.ts +2 -0
- package/esm/markets/aaveV4/index.js +12 -0
- package/esm/morphoBlue/index.d.ts +8 -6
- package/esm/morphoBlue/index.js +62 -39
- package/esm/portfolio/index.js +32 -3
- package/esm/savings/summerVaults/options.js +10 -10
- package/esm/staking/staking.js +3 -0
- package/esm/types/aaveV4.d.ts +2 -1
- package/esm/types/aaveV4.js +1 -0
- package/esm/types/claiming.d.ts +10 -0
- package/esm/types/claiming.js +2 -0
- package/esm/types/morphoBlue.d.ts +9 -0
- package/package.json +2 -2
- package/src/aaveV3/index.ts +13 -1
- package/src/aaveV4/lend.ts +3 -3
- package/src/claiming/index.ts +2 -0
- package/src/claiming/uniswap.ts +70 -0
- package/src/config/contracts.ts +9 -0
- package/src/contracts.ts +2 -0
- package/src/curveUsd/index.ts +1 -1
- package/src/helpers/morphoBlueHelpers/index.ts +1 -0
- package/src/helpers/morphoMidnightHelpers/index.ts +87 -14
- package/src/llamaLend/index.ts +1 -1
- package/src/markets/aaveV4/index.ts +13 -0
- package/src/morphoBlue/index.ts +101 -44
- package/src/portfolio/index.ts +32 -3
- package/src/savings/summerVaults/options.ts +10 -10
- package/src/staking/staking.ts +2 -0
- package/src/types/aaveV4.ts +1 -0
- package/src/types/claiming.ts +11 -0
- package/src/types/morphoBlue.ts +11 -0
|
@@ -34,6 +34,23 @@ export interface MorphoMidnightBorrowQuote {
|
|
|
34
34
|
}
|
|
35
35
|
export declare const midnightTimeToMaturityDays: (maturity: number, atSeconds?: number) => number;
|
|
36
36
|
export declare const midnightApyFromPrice: (price: Dec.Value, ttmDays: Dec.Value) => string;
|
|
37
|
+
/**
|
|
38
|
+
* Inverse of `midnightApyFromPrice`: the loan-per-unit price a borrow APY implies,
|
|
39
|
+
* price = (1 + rate)^(−ttmDays / 365).
|
|
40
|
+
*
|
|
41
|
+
* This is what turns an absolute rate ceiling into an on-chain `maxUnits` cap (units = assets / price),
|
|
42
|
+
* and equally the principal a unit of borrow power is worth — Midnight debt is recorded at its maturity
|
|
43
|
+
* face value, so borrowing the full limit as principal would overshoot it by the interest.
|
|
44
|
+
*/
|
|
45
|
+
export declare const midnightPriceFromApy: (ratePercent: Dec.Value, ttmDays: Dec.Value) => string;
|
|
46
|
+
/**
|
|
47
|
+
* Coerce a slippage into what the quote endpoint accepts: 0.1–100 with at most one decimal place. The
|
|
48
|
+
* validation is lexical, so a computed value (`4.15066671050631467`) is rejected outright — without this
|
|
49
|
+
* the request 400s and the quote looks unavailable.
|
|
50
|
+
*
|
|
51
|
+
* Rounded **down**, since a wider slippage is a looser cap than the caller asked for.
|
|
52
|
+
*/
|
|
53
|
+
export declare const midnightSlippageParam: (slippagePercent: Dec.Value) => string;
|
|
37
54
|
/**
|
|
38
55
|
* Current borrower rate + debt breakdown from the Midnight transactions API. On-chain we can only read the
|
|
39
56
|
* total debt at maturity (`units`); the base-vs-interest split and the effective borrow rate require the
|
|
@@ -42,9 +59,20 @@ export declare const midnightApyFromPrice: (price: Dec.Value, ttmDays: Dec.Value
|
|
|
42
59
|
*/
|
|
43
60
|
export declare const getMorphoMidnightUserBorrowInfo: (account: string, marketId: string, maturity: number, loanTokenSymbol: string) => Promise<MorphoMidnightBorrowInfo>;
|
|
44
61
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
62
|
+
* Quote a prospective borrow against the Midnight order book: the estimated rate, the debt units it adds,
|
|
63
|
+
* and the `maxUnits` cap sent on-chain to protect the user if better offers get filled first. `assetsRaw`
|
|
64
|
+
* (and the returned `newUnits`/`maxUnits`) are raw loan-token base units — callers convert to/from human
|
|
65
|
+
* amounts. Throws if the book can't fill the amount (caller handles).
|
|
66
|
+
*
|
|
67
|
+
* Two ways to set the cap:
|
|
68
|
+
* - `maxBorrowRate` — an absolute APY ceiling, honoured **exactly**: the cap price is derived locally via
|
|
69
|
+
* `midnightPriceFromApy`. Prefer this when a user pins a max rate.
|
|
70
|
+
* - otherwise `slippagePercent`, the API's own knob. Note it is a **price**-level slippage, not APY points:
|
|
71
|
+
* near maturity the annualisation factor (365 / ttmDays) multiplies it heavily, so on a 22-day market a
|
|
72
|
+
* slippage of 0.5 permitted an APY ~9pp above the estimate, not 0.5pp. It also saturates at the book's
|
|
73
|
+
* cheapest bid. `maxRate` therefore reports what the cap actually permits, derived from the cap price.
|
|
74
|
+
*
|
|
75
|
+
* A `maxBorrowRate` below `estBorrowRate` yields `maxUnits < newUnits` — the borrow would revert on-chain.
|
|
76
|
+
* Compare the two before submitting and tell the user their ceiling is under the market rate.
|
|
49
77
|
*/
|
|
50
|
-
export declare const getMorphoMidnightBorrowQuote: (marketId: string, assetsRaw: string, slippagePercent: Dec.Value, maturity: number) => Promise<MorphoMidnightBorrowQuote>;
|
|
78
|
+
export declare const getMorphoMidnightBorrowQuote: (marketId: string, assetsRaw: string, slippagePercent: Dec.Value, maturity: number, maxBorrowRate?: Dec.Value) => Promise<MorphoMidnightBorrowQuote>;
|
|
@@ -79,6 +79,10 @@ export const getMorphoMidnightAggregatedPositionData = ({ usedAssets, assetsData
|
|
|
79
79
|
// loan-per-unit ratios (< 1 for a discounted fixed-term borrow); annualizing them yields the borrow APY.
|
|
80
80
|
const MIDNIGHT_API_BASE = 'https://api.morpho.org/v0/midnight';
|
|
81
81
|
const nowInSeconds = () => Math.floor(Date.now() / 1000);
|
|
82
|
+
// The quote endpoint's `slippage` query param is validated as a string: 0.1–100, at most one decimal
|
|
83
|
+
// place (`0.50` is rejected even though `0.5` passes). See `midnightSlippageParam`.
|
|
84
|
+
const MIDNIGHT_SLIPPAGE_MIN = 0.1;
|
|
85
|
+
const MIDNIGHT_SLIPPAGE_MAX = 100;
|
|
82
86
|
// Days remaining until maturity, optionally measured at a past timestamp (for historical fills).
|
|
83
87
|
export const midnightTimeToMaturityDays = (maturity, atSeconds = nowInSeconds()) => new Dec(maturity).sub(atSeconds).div(SECONDS_PER_DAY).toNumber();
|
|
84
88
|
// Annualize a fixed-term discount price into an APY percent: (1 / price)^(365 / ttmDays) − 1.
|
|
@@ -92,6 +96,29 @@ export const midnightApyFromPrice = (price, ttmDays) => {
|
|
|
92
96
|
.mul(100)
|
|
93
97
|
.toString();
|
|
94
98
|
};
|
|
99
|
+
/**
|
|
100
|
+
* Inverse of `midnightApyFromPrice`: the loan-per-unit price a borrow APY implies,
|
|
101
|
+
* price = (1 + rate)^(−ttmDays / 365).
|
|
102
|
+
*
|
|
103
|
+
* This is what turns an absolute rate ceiling into an on-chain `maxUnits` cap (units = assets / price),
|
|
104
|
+
* and equally the principal a unit of borrow power is worth — Midnight debt is recorded at its maturity
|
|
105
|
+
* face value, so borrowing the full limit as principal would overshoot it by the interest.
|
|
106
|
+
*/
|
|
107
|
+
export const midnightPriceFromApy = (ratePercent, ttmDays) => {
|
|
108
|
+
const rate = new Dec(ratePercent);
|
|
109
|
+
const ttm = new Dec(ttmDays);
|
|
110
|
+
if (rate.lte(0) || ttm.lte(0))
|
|
111
|
+
return '1';
|
|
112
|
+
return new Dec(1).div(new Dec(1).add(rate.div(100)).pow(ttm.div(365))).toString();
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Coerce a slippage into what the quote endpoint accepts: 0.1–100 with at most one decimal place. The
|
|
116
|
+
* validation is lexical, so a computed value (`4.15066671050631467`) is rejected outright — without this
|
|
117
|
+
* the request 400s and the quote looks unavailable.
|
|
118
|
+
*
|
|
119
|
+
* Rounded **down**, since a wider slippage is a looser cap than the caller asked for.
|
|
120
|
+
*/
|
|
121
|
+
export const midnightSlippageParam = (slippagePercent) => Dec.min(Dec.max(new Dec(slippagePercent), MIDNIGHT_SLIPPAGE_MIN), MIDNIGHT_SLIPPAGE_MAX).toDP(1, Dec.ROUND_DOWN).toString();
|
|
95
122
|
/**
|
|
96
123
|
* Current borrower rate + debt breakdown from the Midnight transactions API. On-chain we can only read the
|
|
97
124
|
* total debt at maturity (`units`); the base-vs-interest split and the effective borrow rate require the
|
|
@@ -125,26 +152,50 @@ export const getMorphoMidnightUserBorrowInfo = (account, marketId, maturity, loa
|
|
|
125
152
|
borrowRate, debtBase, debtInterest, debtTotal,
|
|
126
153
|
};
|
|
127
154
|
});
|
|
155
|
+
// The API says why a quote failed — NOT_FOUND (market matured or not open yet), INSUFFICIENT_LIQUIDITY
|
|
156
|
+
// (book can't fill the size), VALIDATION_ERROR (bad param, with the offending field in `details`).
|
|
157
|
+
// Callers surface this to the user, so keep the reason rather than collapsing everything into one string.
|
|
158
|
+
const midnightQuoteError = (error) => {
|
|
159
|
+
const detail = ((error === null || error === void 0 ? void 0 : error.details) || []).map(({ issue }) => issue).filter(Boolean).join('; ');
|
|
160
|
+
const reason = detail || (error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : error.code);
|
|
161
|
+
return reason ? `Morpho Midnight quote unavailable: ${reason}` : 'Morpho Midnight quote unavailable';
|
|
162
|
+
};
|
|
128
163
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
164
|
+
* Quote a prospective borrow against the Midnight order book: the estimated rate, the debt units it adds,
|
|
165
|
+
* and the `maxUnits` cap sent on-chain to protect the user if better offers get filled first. `assetsRaw`
|
|
166
|
+
* (and the returned `newUnits`/`maxUnits`) are raw loan-token base units — callers convert to/from human
|
|
167
|
+
* amounts. Throws if the book can't fill the amount (caller handles).
|
|
168
|
+
*
|
|
169
|
+
* Two ways to set the cap:
|
|
170
|
+
* - `maxBorrowRate` — an absolute APY ceiling, honoured **exactly**: the cap price is derived locally via
|
|
171
|
+
* `midnightPriceFromApy`. Prefer this when a user pins a max rate.
|
|
172
|
+
* - otherwise `slippagePercent`, the API's own knob. Note it is a **price**-level slippage, not APY points:
|
|
173
|
+
* near maturity the annualisation factor (365 / ttmDays) multiplies it heavily, so on a 22-day market a
|
|
174
|
+
* slippage of 0.5 permitted an APY ~9pp above the estimate, not 0.5pp. It also saturates at the book's
|
|
175
|
+
* cheapest bid. `maxRate` therefore reports what the cap actually permits, derived from the cap price.
|
|
176
|
+
*
|
|
177
|
+
* A `maxBorrowRate` below `estBorrowRate` yields `maxUnits < newUnits` — the borrow would revert on-chain.
|
|
178
|
+
* Compare the two before submitting and tell the user their ceiling is under the market rate.
|
|
133
179
|
*/
|
|
134
|
-
export const getMorphoMidnightBorrowQuote = (marketId, assetsRaw, slippagePercent, maturity) => __awaiter(void 0, void 0, void 0, function* () {
|
|
135
|
-
const url = `${MIDNIGHT_API_BASE}/books/${marketId}/bids/quote?assets=${assetsRaw}&slippage=${slippagePercent}`;
|
|
180
|
+
export const getMorphoMidnightBorrowQuote = (marketId, assetsRaw, slippagePercent, maturity, maxBorrowRate) => __awaiter(void 0, void 0, void 0, function* () {
|
|
181
|
+
const url = `${MIDNIGHT_API_BASE}/books/${marketId}/bids/quote?assets=${assetsRaw}&slippage=${midnightSlippageParam(slippagePercent)}`;
|
|
136
182
|
const res = yield fetch(url, { signal: AbortSignal.timeout(LONGER_TIMEOUT) });
|
|
137
183
|
const json = yield res.json();
|
|
138
184
|
const d = json === null || json === void 0 ? void 0 : json.data;
|
|
139
185
|
if (!(d === null || d === void 0 ? void 0 : d.average_best_price))
|
|
140
|
-
throw new Error(
|
|
186
|
+
throw new Error(midnightQuoteError(json === null || json === void 0 ? void 0 : json.error));
|
|
141
187
|
const bestPrice = new Dec(d.average_best_price).div(WAD).toString();
|
|
142
|
-
const worstPrice = new Dec(d.average_worst_price).div(WAD).toString();
|
|
188
|
+
const worstPrice = new Dec(d.average_worst_price || 0).div(WAD).toString();
|
|
143
189
|
const ttmDays = midnightTimeToMaturityDays(maturity);
|
|
144
190
|
const estBorrowRate = midnightApyFromPrice(bestPrice, ttmDays);
|
|
145
|
-
|
|
191
|
+
// Price the cap sits at, and the rate that price represents — one derivation, so `maxRate` and
|
|
192
|
+
// `maxUnits` can never disagree about what the user is protected at.
|
|
193
|
+
const capPrice = maxBorrowRate !== undefined && new Dec(maxBorrowRate).gt(0)
|
|
194
|
+
? midnightPriceFromApy(maxBorrowRate, ttmDays)
|
|
195
|
+
: worstPrice;
|
|
196
|
+
const maxRate = midnightApyFromPrice(capPrice, ttmDays);
|
|
146
197
|
const newUnits = new Dec(bestPrice).lte(0) ? '0' : new Dec(assetsRaw).div(bestPrice).toFixed(0);
|
|
147
|
-
const maxUnits = new Dec(
|
|
198
|
+
const maxUnits = new Dec(capPrice).lte(0) ? '0' : new Dec(assetsRaw).div(capPrice).toFixed(0);
|
|
148
199
|
return {
|
|
149
200
|
bestPrice,
|
|
150
201
|
worstPrice,
|
|
@@ -152,8 +203,8 @@ export const getMorphoMidnightBorrowQuote = (marketId, assetsRaw, slippagePercen
|
|
|
152
203
|
maxRate,
|
|
153
204
|
newUnits,
|
|
154
205
|
maxUnits,
|
|
155
|
-
availableAssets: d.available_assets,
|
|
156
|
-
availableUnits: d.available_units,
|
|
206
|
+
availableAssets: d.available_assets || '0',
|
|
207
|
+
availableUnits: d.available_units || '0',
|
|
157
208
|
takeableOffers: d.takeable_offers || [],
|
|
158
209
|
};
|
|
159
210
|
});
|
package/esm/llamaLend/index.js
CHANGED
|
@@ -25,7 +25,7 @@ const getAndFormatBands = (provider, network, selectedMarket, _minBand, _maxBand
|
|
|
25
25
|
// getBandsData uses a lot of gas to get all of the bands at once, so we use pagination and fetch 200 bands at a time
|
|
26
26
|
let i = minBand;
|
|
27
27
|
while (i < maxBand) {
|
|
28
|
-
i +=
|
|
28
|
+
i += 20;
|
|
29
29
|
if (i > maxBand) {
|
|
30
30
|
pivots.push(maxBand);
|
|
31
31
|
}
|
|
@@ -22,6 +22,7 @@ export declare const AAVE_V4_LIDO_SPOKE: (networkId: NetworkNumber) => AaveV4Spo
|
|
|
22
22
|
export declare const AAVE_V4_LOMBARD_BTC_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
23
23
|
export declare const AAVE_V4_MAIN_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
24
24
|
export declare const AAVE_V4_USDG_PENDLE_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
25
|
+
export declare const AAVE_V4_USDG_MAPLE_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
25
26
|
export declare const AaveV4Spokes: (networkId: NetworkNumber) => {
|
|
26
27
|
readonly aave_v4_bluechip_spoke: AaveV4SpokeInfo;
|
|
27
28
|
readonly aave_v4_ethena_correlated_spoke: AaveV4SpokeInfo;
|
|
@@ -34,6 +35,7 @@ export declare const AaveV4Spokes: (networkId: NetworkNumber) => {
|
|
|
34
35
|
readonly aave_v4_lombard_btc_spoke: AaveV4SpokeInfo;
|
|
35
36
|
readonly aave_v4_main_spoke: AaveV4SpokeInfo;
|
|
36
37
|
readonly aave_v4_usdg_pendle_spoke: AaveV4SpokeInfo;
|
|
38
|
+
readonly aave_v4_usdg_maple_spoke: AaveV4SpokeInfo;
|
|
37
39
|
};
|
|
38
40
|
export declare const getAaveV4SpokeTypeInfo: (type: AaveV4SpokesType, network?: NetworkNumber) => AaveV4SpokeInfo;
|
|
39
41
|
export declare const findAaveV4SpokeByAddress: (networkId: NetworkNumber, address: string) => AaveV4SpokeInfo | undefined;
|
|
@@ -164,6 +164,17 @@ export const AAVE_V4_USDG_PENDLE_SPOKE = (networkId) => ({
|
|
|
164
164
|
AAVE_V4_CORE_HUB(NetworkNumber.Eth).address,
|
|
165
165
|
],
|
|
166
166
|
});
|
|
167
|
+
export const AAVE_V4_USDG_MAPLE_SPOKE = (networkId) => ({
|
|
168
|
+
chainIds: [NetworkNumber.Eth],
|
|
169
|
+
label: 'USDG Maple',
|
|
170
|
+
value: AaveV4SpokesType.AaveV4USDGMapleSpoke,
|
|
171
|
+
url: 'usdg-maple',
|
|
172
|
+
address: '0x774b9655413c34809c1f1b16b654465A89EBE989',
|
|
173
|
+
hubs: [
|
|
174
|
+
AAVE_V4_PAXOS_HUB(NetworkNumber.Eth).address,
|
|
175
|
+
AAVE_V4_CORE_HUB(NetworkNumber.Eth).address,
|
|
176
|
+
],
|
|
177
|
+
});
|
|
167
178
|
export const AaveV4Spokes = (networkId) => ({
|
|
168
179
|
[AaveV4SpokesType.AaveV4BluechipSpoke]: AAVE_V4_BLUECHIP_SPOKE(networkId),
|
|
169
180
|
[AaveV4SpokesType.AaveV4EthenaCorrelatedSpoke]: AAVE_V4_ETHENA_CORRELATED_SPOKE(networkId),
|
|
@@ -176,6 +187,7 @@ export const AaveV4Spokes = (networkId) => ({
|
|
|
176
187
|
[AaveV4SpokesType.AaveV4LombardBtcSpoke]: AAVE_V4_LOMBARD_BTC_SPOKE(networkId),
|
|
177
188
|
[AaveV4SpokesType.AaveV4MainSpoke]: AAVE_V4_MAIN_SPOKE(networkId),
|
|
178
189
|
[AaveV4SpokesType.AaveV4USDGPendleSpoke]: AAVE_V4_USDG_PENDLE_SPOKE(networkId),
|
|
190
|
+
[AaveV4SpokesType.AaveV4USDGMapleSpoke]: AAVE_V4_USDG_MAPLE_SPOKE(networkId),
|
|
179
191
|
});
|
|
180
192
|
export const getAaveV4SpokeTypeInfo = (type, network) => (Object.assign({}, AaveV4Spokes(network !== null && network !== void 0 ? network : NetworkNumber.Eth))[type]);
|
|
181
193
|
export const findAaveV4SpokeByAddress = (networkId, address) => Object.values(AaveV4Spokes(networkId)).find(spoke => spoke.address.toLowerCase() === address.toLowerCase());
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { Client } from 'viem';
|
|
2
2
|
import { Blockish, EthAddress, EthereumProvider, NetworkNumber, PositionBalances } from '../types/common';
|
|
3
|
-
import { MorphoBlueMarketData, MorphoBlueMarketInfo, MorphoBluePositionData } from '../types';
|
|
3
|
+
import { MorphoBlueEarnData, MorphoBlueMarketData, MorphoBlueMarketInfo, MorphoBlueMarketRewards, MorphoBluePositionData } from '../types';
|
|
4
|
+
export declare const addMorphoBlueRewardsToMarketInfo: (marketInfo: MorphoBlueMarketInfo, rewards: MorphoBlueMarketRewards) => MorphoBlueMarketInfo;
|
|
4
5
|
export declare function _getMorphoBlueMarketData(provider: Client, network: NetworkNumber, selectedMarket: MorphoBlueMarketData): Promise<MorphoBlueMarketInfo>;
|
|
6
|
+
export declare function _getMorphoBluePortfolioMarketData(provider: Client, network: NetworkNumber, selectedMarket: MorphoBlueMarketData): Promise<MorphoBlueMarketInfo>;
|
|
5
7
|
export declare function getMorphoBlueMarketData(provider: EthereumProvider, network: NetworkNumber, selectedMarket: MorphoBlueMarketData): Promise<MorphoBlueMarketInfo>;
|
|
8
|
+
export declare function getMorphoBluePortfolioMarketData(provider: EthereumProvider, network: NetworkNumber, selectedMarket: MorphoBlueMarketData): Promise<MorphoBlueMarketInfo>;
|
|
9
|
+
export declare const getMorphoBluePositionDataWithMarketInfo: (data: MorphoBluePositionData, marketInfo: MorphoBlueMarketInfo) => MorphoBluePositionData;
|
|
10
|
+
export declare const getMorphoEarnDataWithMarketInfo: (data: MorphoBlueEarnData, marketInfo: MorphoBlueMarketInfo) => MorphoBlueEarnData;
|
|
11
|
+
export declare function getMorphoBlueMarketRewards(network: NetworkNumber, selectedMarket: MorphoBlueMarketData): Promise<MorphoBlueMarketRewards>;
|
|
6
12
|
export declare const _getMorphoBlueAccountBalances: (provider: Client, network: NetworkNumber, block: Blockish, addressMapping: boolean, address: EthAddress, selectedMarket: MorphoBlueMarketData) => Promise<PositionBalances>;
|
|
7
13
|
export declare const getMorphoBlueAccountBalances: (provider: EthereumProvider, network: NetworkNumber, block: Blockish, addressMapping: boolean, address: EthAddress, selectedMarket: MorphoBlueMarketData) => Promise<PositionBalances>;
|
|
8
14
|
export declare function _getMorphoBlueAccountData(provider: Client, network: NetworkNumber, account: EthAddress, selectedMarket: MorphoBlueMarketData, marketInfo: MorphoBlueMarketInfo): Promise<MorphoBluePositionData>;
|
|
9
15
|
export declare function getMorphoBlueAccountData(provider: EthereumProvider, network: NetworkNumber, account: EthAddress, selectedMarket: MorphoBlueMarketData, marketInfo: MorphoBlueMarketInfo): Promise<MorphoBluePositionData>;
|
|
10
|
-
export declare function getMorphoEarn(provider: Client, network: NetworkNumber, account: EthAddress, selectedMarket: MorphoBlueMarketData, marketInfo: MorphoBlueMarketInfo): Promise<
|
|
11
|
-
apy: string;
|
|
12
|
-
amount: string;
|
|
13
|
-
amountUsd: string;
|
|
14
|
-
}>;
|
|
16
|
+
export declare function getMorphoEarn(provider: Client, network: NetworkNumber, account: EthAddress, selectedMarket: MorphoBlueMarketData, marketInfo: MorphoBlueMarketInfo): Promise<MorphoBlueEarnData>;
|
package/esm/morphoBlue/index.js
CHANGED
|
@@ -18,7 +18,20 @@ import { getBorrowRate, getMorphoBlueAggregatedPositionData, getRewardsForMarket
|
|
|
18
18
|
import { getChainlinkAssetAddress } from '../services/priceService';
|
|
19
19
|
import { getViemProvider, setViemBlockNumber } from '../services/viem';
|
|
20
20
|
const HARDCODED_USD_STABLE_PRICE = '100000000'; // $1 with 8 decimals
|
|
21
|
-
|
|
21
|
+
const getMorphoRewardIncentives = (apy) => [{
|
|
22
|
+
token: 'MORPHO',
|
|
23
|
+
apy,
|
|
24
|
+
incentiveKind: IncentiveKind.Reward,
|
|
25
|
+
description: 'Eligible for protocol-level MORPHO incentives.',
|
|
26
|
+
}];
|
|
27
|
+
export const addMorphoBlueRewardsToMarketInfo = (marketInfo, rewards) => (Object.assign(Object.assign({}, marketInfo), { assetsData: Object.assign(Object.assign({}, marketInfo.assetsData), { [marketInfo.loanToken]: Object.assign(Object.assign({}, marketInfo.assetsData[marketInfo.loanToken]), { supplyIncentives: [
|
|
28
|
+
...marketInfo.assetsData[marketInfo.loanToken].supplyIncentives.filter(({ token }) => token !== 'MORPHO'),
|
|
29
|
+
...getMorphoRewardIncentives(rewards.supplyApy),
|
|
30
|
+
], borrowIncentives: [
|
|
31
|
+
...marketInfo.assetsData[marketInfo.loanToken].borrowIncentives.filter(({ token }) => token !== 'MORPHO'),
|
|
32
|
+
...getMorphoRewardIncentives(rewards.borrowApy),
|
|
33
|
+
] }) }) }));
|
|
34
|
+
function getMorphoBlueMarketDataInternal(provider, network, selectedMarket) {
|
|
22
35
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
36
|
const { loanToken, collateralToken, oracle, irm, lltv, oracleType, } = selectedMarket;
|
|
24
37
|
const lltvInWei = new Dec(lltv).mul(WAD).toString();
|
|
@@ -50,16 +63,6 @@ export function _getMorphoBlueMarketData(provider, network, selectedMarket) {
|
|
|
50
63
|
marketInfo = _marketInfo;
|
|
51
64
|
loanTokenPrice = loanTokenPriceRound[1].toString();
|
|
52
65
|
}
|
|
53
|
-
let morphoSupplyApy = '0';
|
|
54
|
-
let morphoBorrowApy = '0';
|
|
55
|
-
try {
|
|
56
|
-
const { supplyApy: _morphoSupplyApy, borrowApy: _morphoBorrowApy } = yield getRewardsForMarket(selectedMarket.marketId, network);
|
|
57
|
-
morphoSupplyApy = _morphoSupplyApy;
|
|
58
|
-
morphoBorrowApy = _morphoBorrowApy;
|
|
59
|
-
}
|
|
60
|
-
catch (e) {
|
|
61
|
-
console.error(e);
|
|
62
|
-
}
|
|
63
66
|
const supplyRate = getSupplyRate(marketInfo.totalSupplyAssets.toString(), marketInfo.totalBorrowAssets.toString(), marketInfo.borrowRate.toString(), marketInfo.fee.toString());
|
|
64
67
|
const compoundedBorrowRate = getBorrowRate(marketInfo.borrowRate.toString(), marketInfo.totalBorrowShares.toString());
|
|
65
68
|
const utillization = new Dec(marketInfo.totalBorrowAssets.toString()).div(marketInfo.totalSupplyAssets.toString()).mul(100).toString();
|
|
@@ -78,18 +81,8 @@ export function _getMorphoBlueMarketData(provider, network, selectedMarket) {
|
|
|
78
81
|
totalBorrow: new Dec(marketInfo.totalBorrowAssets.toString()).div(scale).toString(),
|
|
79
82
|
canBeSupplied: true,
|
|
80
83
|
canBeBorrowed: true,
|
|
81
|
-
supplyIncentives: [
|
|
82
|
-
|
|
83
|
-
apy: morphoSupplyApy,
|
|
84
|
-
incentiveKind: IncentiveKind.Reward,
|
|
85
|
-
description: 'Eligible for protocol-level MORPHO incentives.',
|
|
86
|
-
}],
|
|
87
|
-
borrowIncentives: [{
|
|
88
|
-
token: 'MORPHO',
|
|
89
|
-
apy: morphoBorrowApy,
|
|
90
|
-
incentiveKind: IncentiveKind.Reward,
|
|
91
|
-
description: 'Eligible for protocol-level MORPHO incentives.',
|
|
92
|
-
}],
|
|
84
|
+
supplyIncentives: [],
|
|
85
|
+
borrowIncentives: [],
|
|
93
86
|
};
|
|
94
87
|
assetsData[wethToEth(collateralTokenInfo.symbol)] = {
|
|
95
88
|
symbol: wethToEth(collateralTokenInfo.symbol),
|
|
@@ -124,11 +117,54 @@ export function _getMorphoBlueMarketData(provider, network, selectedMarket) {
|
|
|
124
117
|
};
|
|
125
118
|
});
|
|
126
119
|
}
|
|
120
|
+
export function _getMorphoBlueMarketData(provider, network, selectedMarket) {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
const marketInfo = yield getMorphoBlueMarketDataInternal(provider, network, selectedMarket);
|
|
123
|
+
try {
|
|
124
|
+
const rewards = yield getRewardsForMarket(selectedMarket.marketId, network);
|
|
125
|
+
return addMorphoBlueRewardsToMarketInfo(marketInfo, rewards);
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
console.error(error);
|
|
129
|
+
return addMorphoBlueRewardsToMarketInfo(marketInfo, { supplyApy: '0', borrowApy: '0' });
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
export function _getMorphoBluePortfolioMarketData(provider, network, selectedMarket) {
|
|
134
|
+
return getMorphoBlueMarketDataInternal(provider, network, selectedMarket);
|
|
135
|
+
}
|
|
127
136
|
export function getMorphoBlueMarketData(provider, network, selectedMarket) {
|
|
128
137
|
return __awaiter(this, void 0, void 0, function* () {
|
|
129
138
|
return _getMorphoBlueMarketData(getViemProvider(provider, network), network, selectedMarket);
|
|
130
139
|
});
|
|
131
140
|
}
|
|
141
|
+
export function getMorphoBluePortfolioMarketData(provider, network, selectedMarket) {
|
|
142
|
+
return _getMorphoBluePortfolioMarketData(getViemProvider(provider, network), network, selectedMarket);
|
|
143
|
+
}
|
|
144
|
+
export const getMorphoBluePositionDataWithMarketInfo = (data, marketInfo) => (Object.assign(Object.assign({}, data), getMorphoBlueAggregatedPositionData({
|
|
145
|
+
usedAssets: data.usedAssets,
|
|
146
|
+
assetsData: marketInfo.assetsData,
|
|
147
|
+
marketInfo,
|
|
148
|
+
})));
|
|
149
|
+
export const getMorphoEarnDataWithMarketInfo = (data, marketInfo) => {
|
|
150
|
+
const loanTokenInfo = marketInfo.assetsData[marketInfo.loanToken];
|
|
151
|
+
const usedAssets = {
|
|
152
|
+
[marketInfo.loanToken]: {
|
|
153
|
+
symbol: loanTokenInfo.symbol,
|
|
154
|
+
supplied: data.amount,
|
|
155
|
+
borrowed: '0',
|
|
156
|
+
isSupplied: new Dec(data.amount).gt(0),
|
|
157
|
+
isBorrowed: false,
|
|
158
|
+
collateral: false,
|
|
159
|
+
suppliedUsd: data.amountUsd,
|
|
160
|
+
borrowedUsd: '0',
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
return Object.assign(Object.assign({}, data), { apy: calculateNetApy({ usedAssets, assetsData: marketInfo.assetsData }).netApy });
|
|
164
|
+
};
|
|
165
|
+
export function getMorphoBlueMarketRewards(network, selectedMarket) {
|
|
166
|
+
return getRewardsForMarket(selectedMarket.marketId, network);
|
|
167
|
+
}
|
|
132
168
|
export const _getMorphoBlueAccountBalances = (provider, network, block, addressMapping, address, selectedMarket) => __awaiter(void 0, void 0, void 0, function* () {
|
|
133
169
|
let balances = {
|
|
134
170
|
collateral: {},
|
|
@@ -216,23 +252,10 @@ export function getMorphoEarn(provider, network, account, selectedMarket, market
|
|
|
216
252
|
const loanTokenInfo = marketInfo.assetsData[marketInfo.loanToken];
|
|
217
253
|
const loanTokenSupplied = assetAmountInEth(loanInfo.suppliedInAssets.toString(), marketInfo.loanToken);
|
|
218
254
|
const loanTokenSuppliedUsd = new Dec(loanTokenSupplied).mul(loanTokenInfo.price).toString();
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
symbol: loanTokenInfo.symbol,
|
|
222
|
-
supplied: loanTokenSupplied,
|
|
223
|
-
borrowed: '0',
|
|
224
|
-
isSupplied: new Dec(loanInfo.suppliedInAssets.toString()).gt(0),
|
|
225
|
-
isBorrowed: false,
|
|
226
|
-
collateral: false,
|
|
227
|
-
suppliedUsd: loanTokenSuppliedUsd,
|
|
228
|
-
borrowedUsd: '0',
|
|
229
|
-
},
|
|
230
|
-
};
|
|
231
|
-
const { netApy } = calculateNetApy({ usedAssets, assetsData: marketInfo.assetsData });
|
|
232
|
-
return {
|
|
233
|
-
apy: netApy,
|
|
255
|
+
return getMorphoEarnDataWithMarketInfo({
|
|
256
|
+
apy: '0',
|
|
234
257
|
amount: loanTokenSupplied,
|
|
235
258
|
amountUsd: loanTokenSuppliedUsd,
|
|
236
|
-
};
|
|
259
|
+
}, marketInfo);
|
|
237
260
|
});
|
|
238
261
|
}
|
package/esm/portfolio/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import Dec from 'decimal.js';
|
|
11
11
|
import { NetworkNumber } from '../types/common';
|
|
12
12
|
import { AaveMarkets, AaveV4Spokes, CompoundMarkets, CrvUsdMarkets, EulerV2Markets, LiquityV2Markets, LlamaLendMarkets, MorphoBlueMarkets, MorphoMidnightMarkets, SparkMarkets, } from '../markets';
|
|
13
|
-
import { _getMorphoBlueAccountData,
|
|
13
|
+
import { _getMorphoBlueAccountData, _getMorphoBluePortfolioMarketData, getMorphoEarn } from '../morphoBlue';
|
|
14
14
|
import { _getMorphoMidnightAccountData, _getMorphoMidnightMarketData, getMorphoMidnightEarn } from '../morphoMidnight';
|
|
15
15
|
import { AaveVersions, CompoundVersions, } from '../types';
|
|
16
16
|
import { _getCompoundV3AccountData, _getCompoundV3MarketsData } from '../compoundV3';
|
|
@@ -35,6 +35,7 @@ import { fetchSparkAirdropRewards, fetchSparkRewards } from '../claiming/spark';
|
|
|
35
35
|
import { getKingRewards } from '../claiming/king';
|
|
36
36
|
import { fetchEthenaAirdropRewards } from '../claiming/ethena';
|
|
37
37
|
import { _getAaveV4AccountData, _getAaveV4SpokeData } from '../aaveV4';
|
|
38
|
+
import { getUniswapRewards } from '../claiming/uniswap';
|
|
38
39
|
export function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1) {
|
|
39
40
|
return __awaiter(this, arguments, void 0, function* (provider, network, defaultProvider, addresses, isSim = false) {
|
|
40
41
|
const isMainnet = network === NetworkNumber.Eth;
|
|
@@ -52,7 +53,7 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
52
53
|
const liquityV2Markets = [NetworkNumber.Eth].includes(network) ? Object.values(LiquityV2Markets(network)) : [];
|
|
53
54
|
const liquityV2MarketsStaking = [NetworkNumber.Eth].includes(network) ? Object.values(LiquityV2Markets(network)).filter(market => !market.isLegacy) : [];
|
|
54
55
|
const aaveV4Spokes = Object.values(AaveV4Spokes(network)).filter((market) => market.chainIds.includes(network));
|
|
55
|
-
const args = [network, { batch: { multicall: { batchSize: isSim ?
|
|
56
|
+
const args = [network, { batch: { multicall: { batchSize: isSim ? 2000 : 2500000 } } }];
|
|
56
57
|
const client = getViemProvider(provider, ...args);
|
|
57
58
|
const defaultClient = getViemProvider(defaultProvider, ...args);
|
|
58
59
|
const morphoMarketsData = {};
|
|
@@ -137,7 +138,7 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
137
138
|
yield Promise.allSettled([
|
|
138
139
|
// === MARKET DATA (needs to be fetched first) ===
|
|
139
140
|
...morphoMarkets.map((market) => __awaiter(this, void 0, void 0, function* () {
|
|
140
|
-
const marketData = yield
|
|
141
|
+
const marketData = yield _getMorphoBluePortfolioMarketData(client, network, market);
|
|
141
142
|
morphoMarketsData[market.value] = marketData;
|
|
142
143
|
})),
|
|
143
144
|
...morphoMidnightMarkets.map((market) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -299,6 +300,34 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
299
300
|
}
|
|
300
301
|
}
|
|
301
302
|
}))(),
|
|
303
|
+
// Batch UNI rewards
|
|
304
|
+
(() => __awaiter(this, void 0, void 0, function* () {
|
|
305
|
+
try {
|
|
306
|
+
if (!isMainnet) {
|
|
307
|
+
for (const address of addresses) {
|
|
308
|
+
rewardsData[address.toLowerCase()].uniswap = { error: '', data: [] };
|
|
309
|
+
}
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
const uniswapRewards = yield getUniswapRewards(client, network, addresses);
|
|
313
|
+
for (const address of addresses) {
|
|
314
|
+
const lowerAddress = address.toLowerCase();
|
|
315
|
+
rewardsData[lowerAddress].uniswap = {
|
|
316
|
+
error: '',
|
|
317
|
+
data: uniswapRewards[lowerAddress] || [],
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
catch (error) {
|
|
322
|
+
console.error('Error fetching Uniswap rewards data in batch:', error);
|
|
323
|
+
for (const address of addresses) {
|
|
324
|
+
rewardsData[address.toLowerCase()].uniswap = {
|
|
325
|
+
error: 'Error fetching Uniswap rewards data in batch',
|
|
326
|
+
data: null,
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}))(),
|
|
302
331
|
...sparkMarkets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
303
332
|
try {
|
|
304
333
|
if (!isMainnet) {
|
|
@@ -7,7 +7,7 @@ export const SUMMER_VAULT_USDC_MAINNET_LR = {
|
|
|
7
7
|
asset: 'USDC',
|
|
8
8
|
network: NetworkNumber.Eth,
|
|
9
9
|
deploymentBlock: 21795049,
|
|
10
|
-
isLegacy:
|
|
10
|
+
isLegacy: true,
|
|
11
11
|
};
|
|
12
12
|
export const SUMMER_VAULT_USDC_MAINNET_HR = {
|
|
13
13
|
type: SummerVaultType.SummerVaultUSDCMainnetHR,
|
|
@@ -16,7 +16,7 @@ export const SUMMER_VAULT_USDC_MAINNET_HR = {
|
|
|
16
16
|
asset: 'USDC',
|
|
17
17
|
network: NetworkNumber.Eth,
|
|
18
18
|
deploymentBlock: 22488041,
|
|
19
|
-
isLegacy:
|
|
19
|
+
isLegacy: true,
|
|
20
20
|
};
|
|
21
21
|
export const SUMMER_VAULT_USDT_MAINNET_LR = {
|
|
22
22
|
type: SummerVaultType.SummerVaultUSDTMainnetLR,
|
|
@@ -25,7 +25,7 @@ export const SUMMER_VAULT_USDT_MAINNET_LR = {
|
|
|
25
25
|
asset: 'USDT',
|
|
26
26
|
network: NetworkNumber.Eth,
|
|
27
27
|
deploymentBlock: 21795276,
|
|
28
|
-
isLegacy:
|
|
28
|
+
isLegacy: true,
|
|
29
29
|
};
|
|
30
30
|
export const SUMMER_VAULT_ETH_MAINNET_LR = {
|
|
31
31
|
type: SummerVaultType.SummerVaultETHMainnetLR,
|
|
@@ -34,7 +34,7 @@ export const SUMMER_VAULT_ETH_MAINNET_LR = {
|
|
|
34
34
|
asset: 'WETH',
|
|
35
35
|
network: NetworkNumber.Eth,
|
|
36
36
|
deploymentBlock: 21795390,
|
|
37
|
-
isLegacy:
|
|
37
|
+
isLegacy: true,
|
|
38
38
|
};
|
|
39
39
|
export const SUMMER_VAULT_ETH_MAINNET_HR = {
|
|
40
40
|
type: SummerVaultType.SummerVaultETHMainnetHR,
|
|
@@ -43,7 +43,7 @@ export const SUMMER_VAULT_ETH_MAINNET_HR = {
|
|
|
43
43
|
asset: 'WETH',
|
|
44
44
|
network: NetworkNumber.Eth,
|
|
45
45
|
deploymentBlock: 22291252,
|
|
46
|
-
isLegacy:
|
|
46
|
+
isLegacy: true,
|
|
47
47
|
};
|
|
48
48
|
export const SUMMER_VAULT_USDC_ARBITRUM_LR = {
|
|
49
49
|
type: SummerVaultType.SummerVaultUSDCArbitrumLR,
|
|
@@ -52,7 +52,7 @@ export const SUMMER_VAULT_USDC_ARBITRUM_LR = {
|
|
|
52
52
|
asset: 'USDC',
|
|
53
53
|
network: NetworkNumber.Arb,
|
|
54
54
|
deploymentBlock: 404339289,
|
|
55
|
-
isLegacy:
|
|
55
|
+
isLegacy: true,
|
|
56
56
|
};
|
|
57
57
|
export const SUMMER_VAULT_USDT_ARBITRUM_LR = {
|
|
58
58
|
type: SummerVaultType.SummerVaultUSDTArbitrumLR,
|
|
@@ -61,7 +61,7 @@ export const SUMMER_VAULT_USDT_ARBITRUM_LR = {
|
|
|
61
61
|
asset: 'USDT',
|
|
62
62
|
network: NetworkNumber.Arb,
|
|
63
63
|
deploymentBlock: 303594065,
|
|
64
|
-
isLegacy:
|
|
64
|
+
isLegacy: true,
|
|
65
65
|
};
|
|
66
66
|
export const SUMMER_VAULT_USDC_BASE_LR = {
|
|
67
67
|
type: SummerVaultType.SummerVaultUSDCBaseLR,
|
|
@@ -70,7 +70,7 @@ export const SUMMER_VAULT_USDC_BASE_LR = {
|
|
|
70
70
|
asset: 'USDC',
|
|
71
71
|
network: NetworkNumber.Base,
|
|
72
72
|
deploymentBlock: 303594065,
|
|
73
|
-
isLegacy:
|
|
73
|
+
isLegacy: true,
|
|
74
74
|
};
|
|
75
75
|
export const SUMMER_VAULT_EURC_BASE_LR = {
|
|
76
76
|
type: SummerVaultType.SummerVaultEURCBaseLR,
|
|
@@ -79,7 +79,7 @@ export const SUMMER_VAULT_EURC_BASE_LR = {
|
|
|
79
79
|
asset: 'EURC',
|
|
80
80
|
network: NetworkNumber.Base,
|
|
81
81
|
deploymentBlock: 27544064,
|
|
82
|
-
isLegacy:
|
|
82
|
+
isLegacy: true,
|
|
83
83
|
};
|
|
84
84
|
export const SUMMER_VAULT_ETH_BASE_LR = {
|
|
85
85
|
type: SummerVaultType.SummerVaultETHBaseLR,
|
|
@@ -88,7 +88,7 @@ export const SUMMER_VAULT_ETH_BASE_LR = {
|
|
|
88
88
|
asset: 'WETH',
|
|
89
89
|
network: NetworkNumber.Base,
|
|
90
90
|
deploymentBlock: 29066887,
|
|
91
|
-
isLegacy:
|
|
91
|
+
isLegacy: true,
|
|
92
92
|
};
|
|
93
93
|
export const SUMMER_VAULTS = {
|
|
94
94
|
[SummerVaultType.SummerVaultUSDCMainnetLR]: SUMMER_VAULT_USDC_MAINNET_LR,
|
package/esm/staking/staking.js
CHANGED
|
@@ -68,6 +68,7 @@ export const STAKING_ASSETS = [
|
|
|
68
68
|
'PT sUSDe Nov', 'PT USDe Nov', 'PT USDe Jan', 'PT sUSDe Jan', 'wrsETH', 'wstETH', 'syrupUSDT', 'syrupUSDC', 'wstUSR',
|
|
69
69
|
'PT sUSDe Feb', 'PT USDe Feb', 'PT sUSDe Apr', 'PT USDe Apr', 'PT sUSDe May', 'PT USDe May', 'PT srUSDe Apr', 'GHO',
|
|
70
70
|
'PT sUSDe June', 'PT USDe June', 'PT srUSDe Jun', 'PT srUSDe Oct', 'PT USDG May', 'PT sUSDS Nov', 'PT sUSDe Oct', 'PT USDG Sep',
|
|
71
|
+
'syrupUSDG',
|
|
71
72
|
];
|
|
72
73
|
export const getStakingApy = memoize((asset_1, ...args_1) => __awaiter(void 0, [asset_1, ...args_1], void 0, function* (asset, network = NetworkNumber.Eth) {
|
|
73
74
|
try {
|
|
@@ -125,6 +126,8 @@ export const getStakingApy = memoize((asset_1, ...args_1) => __awaiter(void 0, [
|
|
|
125
126
|
return yield getApyFromDfsApi('syrupUSDT');
|
|
126
127
|
if (asset === 'syrupUSDC')
|
|
127
128
|
return yield getApyFromDfsApi('syrupUSDC');
|
|
129
|
+
if (asset === 'syrupUSDG')
|
|
130
|
+
return yield getApyFromDfsApi('syrupUSDG');
|
|
128
131
|
if (asset === 'wstUSR')
|
|
129
132
|
return yield getApyFromDfsApi('wstUSR');
|
|
130
133
|
if (asset === 'PT sUSDe Feb')
|
package/esm/types/aaveV4.d.ts
CHANGED
|
@@ -16,7 +16,8 @@ export declare enum AaveV4SpokesType {
|
|
|
16
16
|
AaveV4LidoSpoke = "aave_v4_lido_spoke",
|
|
17
17
|
AaveV4LombardBtcSpoke = "aave_v4_lombard_btc_spoke",
|
|
18
18
|
AaveV4MainSpoke = "aave_v4_main_spoke",
|
|
19
|
-
AaveV4USDGPendleSpoke = "aave_v4_usdg_pendle_spoke"
|
|
19
|
+
AaveV4USDGPendleSpoke = "aave_v4_usdg_pendle_spoke",
|
|
20
|
+
AaveV4USDGMapleSpoke = "aave_v4_usdg_maple_spoke"
|
|
20
21
|
}
|
|
21
22
|
export interface AaveV4HubInfo {
|
|
22
23
|
chainIds: NetworkNumber[];
|
package/esm/types/aaveV4.js
CHANGED
|
@@ -18,4 +18,5 @@ export var AaveV4SpokesType;
|
|
|
18
18
|
AaveV4SpokesType["AaveV4LombardBtcSpoke"] = "aave_v4_lombard_btc_spoke";
|
|
19
19
|
AaveV4SpokesType["AaveV4MainSpoke"] = "aave_v4_main_spoke";
|
|
20
20
|
AaveV4SpokesType["AaveV4USDGPendleSpoke"] = "aave_v4_usdg_pendle_spoke";
|
|
21
|
+
AaveV4SpokesType["AaveV4USDGMapleSpoke"] = "aave_v4_usdg_maple_spoke";
|
|
21
22
|
})(AaveV4SpokesType || (AaveV4SpokesType = {}));
|
package/esm/types/claiming.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export declare enum ClaimType {
|
|
|
14
14
|
SPARK_AIRDROP = "SPARK_AIRDROP",
|
|
15
15
|
/** Spark Airdrop */
|
|
16
16
|
SPARK_WST_ETH_REWARDS = "SPARK_WST_ETH_REWARDS",// TODO: This will be removed once we fully refactor spark rewards
|
|
17
|
+
/** UNI Airdrop */
|
|
18
|
+
UNI_REWARDS = "UNI_REWARDS",
|
|
17
19
|
ETHENA_AIRDROP = "ETHENA_AIRDROP"
|
|
18
20
|
}
|
|
19
21
|
type _ClaimableTokenPartial = {
|
|
@@ -81,5 +83,13 @@ export type SparkWstEthRewardsClaimableToken = _ClaimableTokenPartial & {
|
|
|
81
83
|
export type EthenaAirdropClaimableToken = _ClaimableTokenPartial & {
|
|
82
84
|
claimType: ClaimType.ETHENA_AIRDROP;
|
|
83
85
|
};
|
|
86
|
+
export type UniswapAirdropClaimableToken = _ClaimableTokenPartial & {
|
|
87
|
+
claimType: ClaimType.UNI_REWARDS;
|
|
88
|
+
additionalClaimFields: {
|
|
89
|
+
index: number;
|
|
90
|
+
isClaimed: boolean;
|
|
91
|
+
proof: string[];
|
|
92
|
+
};
|
|
93
|
+
};
|
|
84
94
|
export type ClaimableToken = AaveRewardsClaimableToken | AaveMeritRewardsClaimableToken | CompoundV3CompClaimableToken | SparkRewardsClaimableToken | KingRewardsClaimableToken | SparkAirdropClaimableToken | SparkWstEthRewardsClaimableToken | EthenaAirdropClaimableToken;
|
|
85
95
|
export {};
|
package/esm/types/claiming.js
CHANGED
|
@@ -14,6 +14,8 @@ export var ClaimType;
|
|
|
14
14
|
ClaimType["SPARK_AIRDROP"] = "SPARK_AIRDROP";
|
|
15
15
|
/** Spark Airdrop */
|
|
16
16
|
ClaimType["SPARK_WST_ETH_REWARDS"] = "SPARK_WST_ETH_REWARDS";
|
|
17
|
+
/** UNI Airdrop */
|
|
18
|
+
ClaimType["UNI_REWARDS"] = "UNI_REWARDS";
|
|
17
19
|
ClaimType["ETHENA_AIRDROP"] = "ETHENA_AIRDROP";
|
|
18
20
|
})(ClaimType || (ClaimType = {}));
|
|
19
21
|
export var SparkAirdropType;
|
|
@@ -212,6 +212,15 @@ export interface MorphoBluePositionData {
|
|
|
212
212
|
borrowShares: string;
|
|
213
213
|
exposure: string;
|
|
214
214
|
}
|
|
215
|
+
export interface MorphoBlueEarnData {
|
|
216
|
+
apy: string;
|
|
217
|
+
amount: string;
|
|
218
|
+
amountUsd: string;
|
|
219
|
+
}
|
|
220
|
+
export interface MorphoBlueMarketRewards {
|
|
221
|
+
supplyApy: string;
|
|
222
|
+
borrowApy: string;
|
|
223
|
+
}
|
|
215
224
|
export interface MorphoBlueVault {
|
|
216
225
|
address: string;
|
|
217
226
|
}
|