@defisaver/positions-sdk 2.0.15-dev-5 → 2.0.15-dev-7
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.d.ts +3 -0
- package/cjs/aaveV3/index.js +3 -1
- package/cjs/fluid/index.js +3 -0
- package/cjs/staking/eligibility.d.ts +8 -0
- package/cjs/staking/eligibility.js +25 -1
- package/cjs/types/common.d.ts +3 -1
- package/cjs/types/common.js +2 -0
- package/esm/aaveV3/index.d.ts +3 -0
- package/esm/aaveV3/index.js +1 -0
- package/esm/fluid/index.js +3 -0
- package/esm/staking/eligibility.d.ts +8 -0
- package/esm/staking/eligibility.js +22 -0
- package/esm/types/common.d.ts +3 -1
- package/esm/types/common.js +2 -0
- package/package.json +1 -1
- package/src/aaveV3/index.ts +5 -0
- package/src/fluid/index.ts +2 -0
- package/src/staking/eligibility.ts +24 -0
- package/src/types/common.ts +2 -0
package/cjs/aaveV3/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Client } from 'viem';
|
|
2
2
|
import { AaveMarketInfo, AaveV3MarketData, AaveV3PositionData, AaveV3UsedAssets, EModeCategoryDataMapping } from '../types/aave';
|
|
3
3
|
import { Blockish, EthAddress, EthereumProvider, NetworkNumber, PositionBalances } from '../types/common';
|
|
4
|
+
import { getMeritCampaigns } from './merit';
|
|
5
|
+
import { getMerkleCampaigns } from './merkl';
|
|
4
6
|
export declare const aaveV3EmodeCategoriesMapping: (extractedState: any, usedAssets: AaveV3UsedAssets) => {
|
|
5
7
|
[key: number]: EModeCategoryDataMapping;
|
|
6
8
|
};
|
|
@@ -32,3 +34,4 @@ export declare const getAaveV3AccountBalances: (provider: EthereumProvider, netw
|
|
|
32
34
|
export declare const _getAaveV3AccountData: (provider: Client, network: NetworkNumber, address: EthAddress, extractedState: any, blockNumber?: "latest" | number) => Promise<AaveV3PositionData>;
|
|
33
35
|
export declare const getAaveV3AccountData: (provider: EthereumProvider, network: NetworkNumber, address: EthAddress, extractedState: any, blockNumber?: "latest" | number) => Promise<AaveV3PositionData>;
|
|
34
36
|
export declare const getAaveV3FullPositionData: (provider: EthereumProvider, network: NetworkNumber, address: EthAddress, market: AaveMarketInfo) => Promise<AaveV3PositionData>;
|
|
37
|
+
export { getMeritCampaigns, getMerkleCampaigns, };
|
package/cjs/aaveV3/index.js
CHANGED
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.getAaveV3FullPositionData = exports.getAaveV3AccountData = exports._getAaveV3AccountData = exports.getAaveV3AccountBalances = exports._getAaveV3AccountBalances = exports.EMPTY_AAVE_DATA = exports.aaveV3EmodeCategoriesMapping = void 0;
|
|
15
|
+
exports.getMerkleCampaigns = exports.getMeritCampaigns = exports.getAaveV3FullPositionData = exports.getAaveV3AccountData = exports._getAaveV3AccountData = exports.getAaveV3AccountBalances = exports._getAaveV3AccountBalances = exports.EMPTY_AAVE_DATA = exports.aaveV3EmodeCategoriesMapping = void 0;
|
|
16
16
|
exports._getAaveV3MarketData = _getAaveV3MarketData;
|
|
17
17
|
exports.getAaveV3MarketData = getAaveV3MarketData;
|
|
18
18
|
const tokens_1 = require("@defisaver/tokens");
|
|
@@ -26,7 +26,9 @@ const staking_1 = require("../staking");
|
|
|
26
26
|
const common_1 = require("../types/common");
|
|
27
27
|
const viem_1 = require("../services/viem");
|
|
28
28
|
const merit_1 = require("./merit");
|
|
29
|
+
Object.defineProperty(exports, "getMeritCampaigns", { enumerable: true, get: function () { return merit_1.getMeritCampaigns; } });
|
|
29
30
|
const merkl_1 = require("./merkl");
|
|
31
|
+
Object.defineProperty(exports, "getMerkleCampaigns", { enumerable: true, get: function () { return merkl_1.getMerkleCampaigns; } });
|
|
30
32
|
const aaveV3EmodeCategoriesMapping = (extractedState, usedAssets) => {
|
|
31
33
|
const { eModeCategoriesData } = extractedState;
|
|
32
34
|
const usedAssetsValues = Object.values(usedAssets);
|
package/cjs/fluid/index.js
CHANGED
|
@@ -212,6 +212,7 @@ const getTradingApy = (poolAddress) => __awaiter(void 0, void 0, void 0, functio
|
|
|
212
212
|
return new decimal_js_1.default(data.tradingApy).div(100).toString();
|
|
213
213
|
});
|
|
214
214
|
const parseT1MarketData = (provider_1, data_1, network_1, ...args_1) => __awaiter(void 0, [provider_1, data_1, network_1, ...args_1], void 0, function* (provider, data, network, tokenPrices = null) {
|
|
215
|
+
var _a, _b;
|
|
215
216
|
const collAsset = (0, tokens_1.getAssetInfoByAddress)(data.supplyToken0, network);
|
|
216
217
|
const debtAsset = (0, tokens_1.getAssetInfoByAddress)(data.borrowToken0, network);
|
|
217
218
|
const supplyRate = new decimal_js_1.default(data.supplyRateVault).div(100).toString();
|
|
@@ -312,6 +313,8 @@ const parseT1MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
312
313
|
borrowRate,
|
|
313
314
|
supplyRate,
|
|
314
315
|
oraclePrice,
|
|
316
|
+
incentiveSupplyRate: ((_a = collAssetData.supplyIncentives[0]) === null || _a === void 0 ? void 0 : _a.apy) || '0',
|
|
317
|
+
incentiveBorrowRate: ((_b = debtAssetData.borrowIncentives[0]) === null || _b === void 0 ? void 0 : _b.apy) || '0',
|
|
315
318
|
};
|
|
316
319
|
return {
|
|
317
320
|
assetsData,
|
|
@@ -3,6 +3,14 @@ export declare const isEligibleForEthenaUSDeRewards: (usedAssets: MMUsedAssets)
|
|
|
3
3
|
isEligible: boolean;
|
|
4
4
|
eligibleUSDAmount: string;
|
|
5
5
|
};
|
|
6
|
+
export declare const isEligibleForAaveV3ArbitrumEthSupply: (usedAssets: MMUsedAssets) => {
|
|
7
|
+
isEligible: boolean;
|
|
8
|
+
eligibleUSDAmount: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const isEligibleForAaveV3ArbitrumETHLSBorrow: (usedAssets: MMUsedAssets) => {
|
|
11
|
+
isEligible: boolean;
|
|
12
|
+
eligibleUSDAmount: string;
|
|
13
|
+
};
|
|
6
14
|
export declare const EligibilityMapping: {
|
|
7
15
|
[key in IncentiveEligibilityId]: (usedAssets: MMUsedAssets) => {
|
|
8
16
|
isEligible: boolean;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.EligibilityMapping = exports.isEligibleForEthenaUSDeRewards = void 0;
|
|
6
|
+
exports.EligibilityMapping = exports.isEligibleForAaveV3ArbitrumETHLSBorrow = exports.isEligibleForAaveV3ArbitrumEthSupply = exports.isEligibleForEthenaUSDeRewards = void 0;
|
|
7
7
|
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
8
8
|
const common_1 = require("../types/common");
|
|
9
9
|
const isEligibleForEthenaUSDeRewards = (usedAssets) => {
|
|
@@ -38,6 +38,30 @@ const isEligibleForEthenaUSDeRewards = (usedAssets) => {
|
|
|
38
38
|
return { isEligible: true, eligibleUSDAmount: USDeAmountEligibleForRewards };
|
|
39
39
|
};
|
|
40
40
|
exports.isEligibleForEthenaUSDeRewards = isEligibleForEthenaUSDeRewards;
|
|
41
|
+
const isEligibleForAaveV3ArbitrumEthSupply = (usedAssets) => {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
const ETHAmountSupplied = ((_a = usedAssets.ETH) === null || _a === void 0 ? void 0 : _a.suppliedUsd) || '0';
|
|
44
|
+
const ETHAmountBorrowed = ((_b = usedAssets.ETH) === null || _b === void 0 ? void 0 : _b.borrowedUsd) || '0';
|
|
45
|
+
const delta = new decimal_js_1.default(ETHAmountSupplied).sub(ETHAmountBorrowed).toString();
|
|
46
|
+
return { isEligible: true, eligibleUSDAmount: decimal_js_1.default.max(delta, 0).toString() };
|
|
47
|
+
};
|
|
48
|
+
exports.isEligibleForAaveV3ArbitrumEthSupply = isEligibleForAaveV3ArbitrumEthSupply;
|
|
49
|
+
const isEligibleForAaveV3ArbitrumETHLSBorrow = (usedAssets) => {
|
|
50
|
+
var _a;
|
|
51
|
+
const allowedBorrowAssets = ['ETH'];
|
|
52
|
+
const anythingBorrowedNotAllowed = Object.values(usedAssets).some((asset) => asset.isBorrowed && !allowedBorrowAssets.includes(asset.symbol));
|
|
53
|
+
if (anythingBorrowedNotAllowed)
|
|
54
|
+
return { isEligible: false, eligibleUSDAmount: '0' };
|
|
55
|
+
const allowedSupplyAssets = ['wstETH', 'ezETH', 'weETH', 'rsETH'];
|
|
56
|
+
const anythingSuppliedNotAllowed = Object.values(usedAssets).some((asset) => asset.isSupplied && !allowedSupplyAssets.includes(asset.symbol));
|
|
57
|
+
if (anythingSuppliedNotAllowed)
|
|
58
|
+
return { isEligible: false, eligibleUSDAmount: '0' };
|
|
59
|
+
const ETHAmountBorrowed = ((_a = usedAssets.ETH) === null || _a === void 0 ? void 0 : _a.borrowedUsd) || '0';
|
|
60
|
+
return { isEligible: true, eligibleUSDAmount: ETHAmountBorrowed };
|
|
61
|
+
};
|
|
62
|
+
exports.isEligibleForAaveV3ArbitrumETHLSBorrow = isEligibleForAaveV3ArbitrumETHLSBorrow;
|
|
41
63
|
exports.EligibilityMapping = {
|
|
42
64
|
[common_1.IncentiveEligibilityId.AaveV3EthenaLiquidLeverage]: exports.isEligibleForEthenaUSDeRewards,
|
|
65
|
+
[common_1.IncentiveEligibilityId.AaveV3ArbitrumEthSupply]: exports.isEligibleForAaveV3ArbitrumEthSupply,
|
|
66
|
+
[common_1.IncentiveEligibilityId.AaveV3ArbitrumETHLSBorrow]: exports.isEligibleForAaveV3ArbitrumETHLSBorrow,
|
|
43
67
|
};
|
package/cjs/types/common.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ export declare enum IncentiveKind {
|
|
|
3
3
|
Reward = "reward"
|
|
4
4
|
}
|
|
5
5
|
export declare enum IncentiveEligibilityId {
|
|
6
|
-
AaveV3EthenaLiquidLeverage = "0x8772bb231f3af13ead41d7ecf6abd60f5f716ec8BORROW_BL"
|
|
6
|
+
AaveV3EthenaLiquidLeverage = "0x8772bb231f3af13ead41d7ecf6abd60f5f716ec8BORROW_BL",
|
|
7
|
+
AaveV3ArbitrumEthSupply = "0x5d16261c6715a653248269861bbacf68a9774cde",
|
|
8
|
+
AaveV3ArbitrumETHLSBorrow = "0x0c84331e39d6658Cd6e6b9ba04736cC4c4734351"
|
|
7
9
|
}
|
|
8
10
|
export interface IncentiveData {
|
|
9
11
|
token: string;
|
package/cjs/types/common.js
CHANGED
|
@@ -9,6 +9,8 @@ var IncentiveKind;
|
|
|
9
9
|
var IncentiveEligibilityId;
|
|
10
10
|
(function (IncentiveEligibilityId) {
|
|
11
11
|
IncentiveEligibilityId["AaveV3EthenaLiquidLeverage"] = "0x8772bb231f3af13ead41d7ecf6abd60f5f716ec8BORROW_BL";
|
|
12
|
+
IncentiveEligibilityId["AaveV3ArbitrumEthSupply"] = "0x5d16261c6715a653248269861bbacf68a9774cde";
|
|
13
|
+
IncentiveEligibilityId["AaveV3ArbitrumETHLSBorrow"] = "0x0c84331e39d6658Cd6e6b9ba04736cC4c4734351";
|
|
12
14
|
})(IncentiveEligibilityId || (exports.IncentiveEligibilityId = IncentiveEligibilityId = {}));
|
|
13
15
|
var NetworkNumber;
|
|
14
16
|
(function (NetworkNumber) {
|
package/esm/aaveV3/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Client } from 'viem';
|
|
2
2
|
import { AaveMarketInfo, AaveV3MarketData, AaveV3PositionData, AaveV3UsedAssets, EModeCategoryDataMapping } from '../types/aave';
|
|
3
3
|
import { Blockish, EthAddress, EthereumProvider, NetworkNumber, PositionBalances } from '../types/common';
|
|
4
|
+
import { getMeritCampaigns } from './merit';
|
|
5
|
+
import { getMerkleCampaigns } from './merkl';
|
|
4
6
|
export declare const aaveV3EmodeCategoriesMapping: (extractedState: any, usedAssets: AaveV3UsedAssets) => {
|
|
5
7
|
[key: number]: EModeCategoryDataMapping;
|
|
6
8
|
};
|
|
@@ -32,3 +34,4 @@ export declare const getAaveV3AccountBalances: (provider: EthereumProvider, netw
|
|
|
32
34
|
export declare const _getAaveV3AccountData: (provider: Client, network: NetworkNumber, address: EthAddress, extractedState: any, blockNumber?: "latest" | number) => Promise<AaveV3PositionData>;
|
|
33
35
|
export declare const getAaveV3AccountData: (provider: EthereumProvider, network: NetworkNumber, address: EthAddress, extractedState: any, blockNumber?: "latest" | number) => Promise<AaveV3PositionData>;
|
|
34
36
|
export declare const getAaveV3FullPositionData: (provider: EthereumProvider, network: NetworkNumber, address: EthAddress, market: AaveMarketInfo) => Promise<AaveV3PositionData>;
|
|
37
|
+
export { getMeritCampaigns, getMerkleCampaigns, };
|
package/esm/aaveV3/index.js
CHANGED
|
@@ -420,3 +420,4 @@ export const getAaveV3FullPositionData = (provider, network, address, market) =>
|
|
|
420
420
|
const positionData = yield getAaveV3AccountData(provider, network, address, { assetsData: marketData.assetsData, selectedMarket: market, eModeCategoriesData: marketData.eModeCategoriesData });
|
|
421
421
|
return positionData;
|
|
422
422
|
});
|
|
423
|
+
export { getMeritCampaigns, getMerkleCampaigns, };
|
package/esm/fluid/index.js
CHANGED
|
@@ -206,6 +206,7 @@ const getTradingApy = (poolAddress) => __awaiter(void 0, void 0, void 0, functio
|
|
|
206
206
|
return new Dec(data.tradingApy).div(100).toString();
|
|
207
207
|
});
|
|
208
208
|
const parseT1MarketData = (provider_1, data_1, network_1, ...args_1) => __awaiter(void 0, [provider_1, data_1, network_1, ...args_1], void 0, function* (provider, data, network, tokenPrices = null) {
|
|
209
|
+
var _a, _b;
|
|
209
210
|
const collAsset = getAssetInfoByAddress(data.supplyToken0, network);
|
|
210
211
|
const debtAsset = getAssetInfoByAddress(data.borrowToken0, network);
|
|
211
212
|
const supplyRate = new Dec(data.supplyRateVault).div(100).toString();
|
|
@@ -306,6 +307,8 @@ const parseT1MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
306
307
|
borrowRate,
|
|
307
308
|
supplyRate,
|
|
308
309
|
oraclePrice,
|
|
310
|
+
incentiveSupplyRate: ((_a = collAssetData.supplyIncentives[0]) === null || _a === void 0 ? void 0 : _a.apy) || '0',
|
|
311
|
+
incentiveBorrowRate: ((_b = debtAssetData.borrowIncentives[0]) === null || _b === void 0 ? void 0 : _b.apy) || '0',
|
|
309
312
|
};
|
|
310
313
|
return {
|
|
311
314
|
assetsData,
|
|
@@ -3,6 +3,14 @@ export declare const isEligibleForEthenaUSDeRewards: (usedAssets: MMUsedAssets)
|
|
|
3
3
|
isEligible: boolean;
|
|
4
4
|
eligibleUSDAmount: string;
|
|
5
5
|
};
|
|
6
|
+
export declare const isEligibleForAaveV3ArbitrumEthSupply: (usedAssets: MMUsedAssets) => {
|
|
7
|
+
isEligible: boolean;
|
|
8
|
+
eligibleUSDAmount: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const isEligibleForAaveV3ArbitrumETHLSBorrow: (usedAssets: MMUsedAssets) => {
|
|
11
|
+
isEligible: boolean;
|
|
12
|
+
eligibleUSDAmount: string;
|
|
13
|
+
};
|
|
6
14
|
export declare const EligibilityMapping: {
|
|
7
15
|
[key in IncentiveEligibilityId]: (usedAssets: MMUsedAssets) => {
|
|
8
16
|
isEligible: boolean;
|
|
@@ -31,6 +31,28 @@ export const isEligibleForEthenaUSDeRewards = (usedAssets) => {
|
|
|
31
31
|
const USDeAmountEligibleForRewards = Dec.min(USDeUSDAmountSupplied, halfAmountSupplied).toString(); // rewards are given to amount of USDe supplied up to half of total amount supplied
|
|
32
32
|
return { isEligible: true, eligibleUSDAmount: USDeAmountEligibleForRewards };
|
|
33
33
|
};
|
|
34
|
+
export const isEligibleForAaveV3ArbitrumEthSupply = (usedAssets) => {
|
|
35
|
+
var _a, _b;
|
|
36
|
+
const ETHAmountSupplied = ((_a = usedAssets.ETH) === null || _a === void 0 ? void 0 : _a.suppliedUsd) || '0';
|
|
37
|
+
const ETHAmountBorrowed = ((_b = usedAssets.ETH) === null || _b === void 0 ? void 0 : _b.borrowedUsd) || '0';
|
|
38
|
+
const delta = new Dec(ETHAmountSupplied).sub(ETHAmountBorrowed).toString();
|
|
39
|
+
return { isEligible: true, eligibleUSDAmount: Dec.max(delta, 0).toString() };
|
|
40
|
+
};
|
|
41
|
+
export const isEligibleForAaveV3ArbitrumETHLSBorrow = (usedAssets) => {
|
|
42
|
+
var _a;
|
|
43
|
+
const allowedBorrowAssets = ['ETH'];
|
|
44
|
+
const anythingBorrowedNotAllowed = Object.values(usedAssets).some((asset) => asset.isBorrowed && !allowedBorrowAssets.includes(asset.symbol));
|
|
45
|
+
if (anythingBorrowedNotAllowed)
|
|
46
|
+
return { isEligible: false, eligibleUSDAmount: '0' };
|
|
47
|
+
const allowedSupplyAssets = ['wstETH', 'ezETH', 'weETH', 'rsETH'];
|
|
48
|
+
const anythingSuppliedNotAllowed = Object.values(usedAssets).some((asset) => asset.isSupplied && !allowedSupplyAssets.includes(asset.symbol));
|
|
49
|
+
if (anythingSuppliedNotAllowed)
|
|
50
|
+
return { isEligible: false, eligibleUSDAmount: '0' };
|
|
51
|
+
const ETHAmountBorrowed = ((_a = usedAssets.ETH) === null || _a === void 0 ? void 0 : _a.borrowedUsd) || '0';
|
|
52
|
+
return { isEligible: true, eligibleUSDAmount: ETHAmountBorrowed };
|
|
53
|
+
};
|
|
34
54
|
export const EligibilityMapping = {
|
|
35
55
|
[IncentiveEligibilityId.AaveV3EthenaLiquidLeverage]: isEligibleForEthenaUSDeRewards,
|
|
56
|
+
[IncentiveEligibilityId.AaveV3ArbitrumEthSupply]: isEligibleForAaveV3ArbitrumEthSupply,
|
|
57
|
+
[IncentiveEligibilityId.AaveV3ArbitrumETHLSBorrow]: isEligibleForAaveV3ArbitrumETHLSBorrow,
|
|
36
58
|
};
|
package/esm/types/common.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ export declare enum IncentiveKind {
|
|
|
3
3
|
Reward = "reward"
|
|
4
4
|
}
|
|
5
5
|
export declare enum IncentiveEligibilityId {
|
|
6
|
-
AaveV3EthenaLiquidLeverage = "0x8772bb231f3af13ead41d7ecf6abd60f5f716ec8BORROW_BL"
|
|
6
|
+
AaveV3EthenaLiquidLeverage = "0x8772bb231f3af13ead41d7ecf6abd60f5f716ec8BORROW_BL",
|
|
7
|
+
AaveV3ArbitrumEthSupply = "0x5d16261c6715a653248269861bbacf68a9774cde",
|
|
8
|
+
AaveV3ArbitrumETHLSBorrow = "0x0c84331e39d6658Cd6e6b9ba04736cC4c4734351"
|
|
7
9
|
}
|
|
8
10
|
export interface IncentiveData {
|
|
9
11
|
token: string;
|
package/esm/types/common.js
CHANGED
|
@@ -6,6 +6,8 @@ export var IncentiveKind;
|
|
|
6
6
|
export var IncentiveEligibilityId;
|
|
7
7
|
(function (IncentiveEligibilityId) {
|
|
8
8
|
IncentiveEligibilityId["AaveV3EthenaLiquidLeverage"] = "0x8772bb231f3af13ead41d7ecf6abd60f5f716ec8BORROW_BL";
|
|
9
|
+
IncentiveEligibilityId["AaveV3ArbitrumEthSupply"] = "0x5d16261c6715a653248269861bbacf68a9774cde";
|
|
10
|
+
IncentiveEligibilityId["AaveV3ArbitrumETHLSBorrow"] = "0x0c84331e39d6658Cd6e6b9ba04736cC4c4734351";
|
|
9
11
|
})(IncentiveEligibilityId || (IncentiveEligibilityId = {}));
|
|
10
12
|
export var NetworkNumber;
|
|
11
13
|
(function (NetworkNumber) {
|
package/package.json
CHANGED
package/src/aaveV3/index.ts
CHANGED
|
@@ -509,3 +509,8 @@ export const getAaveV3FullPositionData = async (provider: EthereumProvider, netw
|
|
|
509
509
|
const positionData = await getAaveV3AccountData(provider, network, address, { assetsData: marketData.assetsData, selectedMarket: market, eModeCategoriesData: marketData.eModeCategoriesData });
|
|
510
510
|
return positionData;
|
|
511
511
|
};
|
|
512
|
+
|
|
513
|
+
export {
|
|
514
|
+
getMeritCampaigns,
|
|
515
|
+
getMerkleCampaigns,
|
|
516
|
+
};
|
package/src/fluid/index.ts
CHANGED
|
@@ -381,6 +381,8 @@ const parseT1MarketData = async (provider: PublicClient, data: FluidVaultDataStr
|
|
|
381
381
|
borrowRate,
|
|
382
382
|
supplyRate,
|
|
383
383
|
oraclePrice,
|
|
384
|
+
incentiveSupplyRate: collAssetData.supplyIncentives[0]?.apy || '0',
|
|
385
|
+
incentiveBorrowRate: debtAssetData.borrowIncentives[0]?.apy || '0',
|
|
384
386
|
};
|
|
385
387
|
|
|
386
388
|
return {
|
|
@@ -32,6 +32,30 @@ export const isEligibleForEthenaUSDeRewards = (usedAssets: MMUsedAssets) => {
|
|
|
32
32
|
return { isEligible: true, eligibleUSDAmount: USDeAmountEligibleForRewards };
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
+
export const isEligibleForAaveV3ArbitrumEthSupply = (usedAssets: MMUsedAssets) => {
|
|
36
|
+
const ETHAmountSupplied = usedAssets.ETH?.suppliedUsd || '0';
|
|
37
|
+
const ETHAmountBorrowed = usedAssets.ETH?.borrowedUsd || '0';
|
|
38
|
+
const delta = new Dec(ETHAmountSupplied).sub(ETHAmountBorrowed).toString();
|
|
39
|
+
|
|
40
|
+
return { isEligible: true, eligibleUSDAmount: Dec.max(delta, 0).toString() };
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const isEligibleForAaveV3ArbitrumETHLSBorrow = (usedAssets: MMUsedAssets) => {
|
|
44
|
+
const allowedBorrowAssets = ['ETH'];
|
|
45
|
+
const anythingBorrowedNotAllowed = Object.values(usedAssets).some((asset) => asset.isBorrowed && !allowedBorrowAssets.includes(asset.symbol));
|
|
46
|
+
if (anythingBorrowedNotAllowed) return { isEligible: false, eligibleUSDAmount: '0' };
|
|
47
|
+
|
|
48
|
+
const allowedSupplyAssets = ['wstETH', 'ezETH', 'weETH', 'rsETH'];
|
|
49
|
+
const anythingSuppliedNotAllowed = Object.values(usedAssets).some((asset) => asset.isSupplied && !allowedSupplyAssets.includes(asset.symbol));
|
|
50
|
+
if (anythingSuppliedNotAllowed) return { isEligible: false, eligibleUSDAmount: '0' };
|
|
51
|
+
|
|
52
|
+
const ETHAmountBorrowed = usedAssets.ETH?.borrowedUsd || '0';
|
|
53
|
+
|
|
54
|
+
return { isEligible: true, eligibleUSDAmount: ETHAmountBorrowed };
|
|
55
|
+
};
|
|
56
|
+
|
|
35
57
|
export const EligibilityMapping: { [key in IncentiveEligibilityId]: (usedAssets: MMUsedAssets) => { isEligible: boolean; eligibleUSDAmount: string } } = {
|
|
36
58
|
[IncentiveEligibilityId.AaveV3EthenaLiquidLeverage]: isEligibleForEthenaUSDeRewards,
|
|
59
|
+
[IncentiveEligibilityId.AaveV3ArbitrumEthSupply]: isEligibleForAaveV3ArbitrumEthSupply,
|
|
60
|
+
[IncentiveEligibilityId.AaveV3ArbitrumETHLSBorrow]: isEligibleForAaveV3ArbitrumETHLSBorrow,
|
|
37
61
|
};
|
package/src/types/common.ts
CHANGED
|
@@ -5,6 +5,8 @@ export enum IncentiveKind {
|
|
|
5
5
|
|
|
6
6
|
export enum IncentiveEligibilityId {
|
|
7
7
|
AaveV3EthenaLiquidLeverage = '0x8772bb231f3af13ead41d7ecf6abd60f5f716ec8BORROW_BL',
|
|
8
|
+
AaveV3ArbitrumEthSupply = '0x5d16261c6715a653248269861bbacf68a9774cde',
|
|
9
|
+
AaveV3ArbitrumETHLSBorrow = '0x0c84331e39d6658Cd6e6b9ba04736cC4c4734351',
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
export interface IncentiveData {
|