@defisaver/positions-sdk 2.1.42 → 2.1.43-dev-stats-test-1-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/.mocharc.json +4 -4
- package/.nvmrc +1 -1
- package/README.md +64 -64
- package/cjs/aaveV3/index.js +31 -9
- package/cjs/aaveV3/merit.js +5 -1
- package/cjs/aaveV3/merkl.js +1 -0
- package/cjs/helpers/morphoBlueHelpers/index.js +66 -66
- package/cjs/savings/morphoVaults/index.js +17 -17
- package/esm/aaveV3/index.js +31 -9
- package/esm/aaveV3/merit.js +5 -1
- package/esm/aaveV3/merkl.js +1 -0
- package/esm/helpers/morphoBlueHelpers/index.js +66 -66
- package/esm/savings/morphoVaults/index.js +17 -17
- package/package.json +48 -48
- package/src/aaveV2/index.ts +240 -240
- package/src/aaveV3/index.ts +648 -625
- package/src/aaveV3/merit.ts +99 -97
- package/src/aaveV3/merkl.ts +75 -74
- 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 +1295 -1295
- package/src/constants/index.ts +10 -10
- package/src/contracts.ts +171 -171
- 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 +49 -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/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 +25 -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/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 +14 -14
- 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/src/aaveV3/merit.ts
CHANGED
|
@@ -1,97 +1,99 @@
|
|
|
1
|
-
|
|
2
|
-
import { DEFAULT_TIMEOUT } from '../services/utils';
|
|
3
|
-
import { NetworkNumber } from '../types/common';
|
|
4
|
-
import { aprToApy } from '../moneymarket';
|
|
5
|
-
import { AaveVersions, MeritTokenRewardMap } from '../types';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Maps API keys to reward data & actions - hardcoded and needs to be maintained actively.
|
|
9
|
-
* Mapping based on Aave interface implementation: https://github.com/aave/interface/blob/main/src/hooks/useMeritIncentives.ts
|
|
10
|
-
* Active campaigns found here: https://apps.aavechan.com/merit
|
|
11
|
-
*/
|
|
12
|
-
const MERIT_DATA_MAP:
|
|
13
|
-
Record<
|
|
14
|
-
NetworkNumber,
|
|
15
|
-
Partial<Record<
|
|
16
|
-
AaveVersions,
|
|
17
|
-
Record<string, {
|
|
18
|
-
rewardTokenSymbol: string;
|
|
19
|
-
action: 'supply' | 'borrow' | 'stake';
|
|
20
|
-
message?: string;
|
|
21
|
-
supplyTokens?: string[],
|
|
22
|
-
borrowTokens?: string[],
|
|
23
|
-
}>
|
|
24
|
-
>>
|
|
25
|
-
> = {
|
|
26
|
-
[NetworkNumber.Eth]: {
|
|
27
|
-
[AaveVersions.AaveV3]: {
|
|
28
|
-
'ethereum-supply-ethx': { rewardTokenSymbol: 'SD', action: 'supply', supplyTokens: ['ETHx'] },
|
|
29
|
-
'ethereum-supply-rlusd': { rewardTokenSymbol: 'aEthRLUSD', action: 'supply', supplyTokens: ['RLUSD'] },
|
|
30
|
-
// Campaign disabled here as it's present on Merkl API:
|
|
31
|
-
// 'ethereum-borrow-eurc': { rewardTokenSymbol: 'aEthEURC', action: 'borrow', borrowTokens: ['EURC'] },
|
|
32
|
-
},
|
|
33
|
-
[AaveVersions.AaveV3Lido]: {},
|
|
34
|
-
[AaveVersions.AaveV3Etherfi]: {},
|
|
35
|
-
},
|
|
36
|
-
[NetworkNumber.Arb]: {
|
|
37
|
-
[AaveVersions.AaveV3]: {},
|
|
38
|
-
},
|
|
39
|
-
[NetworkNumber.Opt]: {
|
|
40
|
-
[AaveVersions.AaveV3]: {},
|
|
41
|
-
},
|
|
42
|
-
[NetworkNumber.Base]: {
|
|
43
|
-
[AaveVersions.AaveV3]: {
|
|
44
|
-
'base-borrow-usdc': { rewardTokenSymbol: 'USDC', action: 'borrow', borrowTokens: ['USDC'] },
|
|
45
|
-
'base-borrow-gho': { rewardTokenSymbol: 'GHO', action: 'borrow', borrowTokens: ['GHO'] },
|
|
46
|
-
'base-borrow-eurc': { rewardTokenSymbol: 'EURC', action: 'borrow', borrowTokens: ['EURC'] },
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
[NetworkNumber.Linea]: {
|
|
50
|
-
[AaveVersions.AaveV3]: {},
|
|
51
|
-
},
|
|
52
|
-
[NetworkNumber.Plasma]: {
|
|
53
|
-
[AaveVersions.AaveV3]: {},
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Fetches merit rewards data from Aave API
|
|
59
|
-
*/
|
|
60
|
-
export const fetchMeritRewardsData = async (): Promise<Record<string, number | null>> => {
|
|
61
|
-
try {
|
|
62
|
-
const response = await fetch('https://apps.aavechan.com/api/merit/aprs', {
|
|
63
|
-
signal: AbortSignal.timeout(5000),
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
};
|
|
1
|
+
|
|
2
|
+
import { DEFAULT_TIMEOUT } from '../services/utils';
|
|
3
|
+
import { NetworkNumber } from '../types/common';
|
|
4
|
+
import { aprToApy } from '../moneymarket';
|
|
5
|
+
import { AaveVersions, MeritTokenRewardMap } from '../types';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Maps API keys to reward data & actions - hardcoded and needs to be maintained actively.
|
|
9
|
+
* Mapping based on Aave interface implementation: https://github.com/aave/interface/blob/main/src/hooks/useMeritIncentives.ts
|
|
10
|
+
* Active campaigns found here: https://apps.aavechan.com/merit
|
|
11
|
+
*/
|
|
12
|
+
const MERIT_DATA_MAP:
|
|
13
|
+
Record<
|
|
14
|
+
NetworkNumber,
|
|
15
|
+
Partial<Record<
|
|
16
|
+
AaveVersions,
|
|
17
|
+
Record<string, {
|
|
18
|
+
rewardTokenSymbol: string;
|
|
19
|
+
action: 'supply' | 'borrow' | 'stake';
|
|
20
|
+
message?: string;
|
|
21
|
+
supplyTokens?: string[],
|
|
22
|
+
borrowTokens?: string[],
|
|
23
|
+
}>
|
|
24
|
+
>>
|
|
25
|
+
> = {
|
|
26
|
+
[NetworkNumber.Eth]: {
|
|
27
|
+
[AaveVersions.AaveV3]: {
|
|
28
|
+
'ethereum-supply-ethx': { rewardTokenSymbol: 'SD', action: 'supply', supplyTokens: ['ETHx'] },
|
|
29
|
+
'ethereum-supply-rlusd': { rewardTokenSymbol: 'aEthRLUSD', action: 'supply', supplyTokens: ['RLUSD'] },
|
|
30
|
+
// Campaign disabled here as it's present on Merkl API:
|
|
31
|
+
// 'ethereum-borrow-eurc': { rewardTokenSymbol: 'aEthEURC', action: 'borrow', borrowTokens: ['EURC'] },
|
|
32
|
+
},
|
|
33
|
+
[AaveVersions.AaveV3Lido]: {},
|
|
34
|
+
[AaveVersions.AaveV3Etherfi]: {},
|
|
35
|
+
},
|
|
36
|
+
[NetworkNumber.Arb]: {
|
|
37
|
+
[AaveVersions.AaveV3]: {},
|
|
38
|
+
},
|
|
39
|
+
[NetworkNumber.Opt]: {
|
|
40
|
+
[AaveVersions.AaveV3]: {},
|
|
41
|
+
},
|
|
42
|
+
[NetworkNumber.Base]: {
|
|
43
|
+
[AaveVersions.AaveV3]: {
|
|
44
|
+
'base-borrow-usdc': { rewardTokenSymbol: 'USDC', action: 'borrow', borrowTokens: ['USDC'] },
|
|
45
|
+
'base-borrow-gho': { rewardTokenSymbol: 'GHO', action: 'borrow', borrowTokens: ['GHO'] },
|
|
46
|
+
'base-borrow-eurc': { rewardTokenSymbol: 'EURC', action: 'borrow', borrowTokens: ['EURC'] },
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
[NetworkNumber.Linea]: {
|
|
50
|
+
[AaveVersions.AaveV3]: {},
|
|
51
|
+
},
|
|
52
|
+
[NetworkNumber.Plasma]: {
|
|
53
|
+
[AaveVersions.AaveV3]: {},
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Fetches merit rewards data from Aave API
|
|
59
|
+
*/
|
|
60
|
+
export const fetchMeritRewardsData = async (): Promise<Record<string, number | null>> => {
|
|
61
|
+
try {
|
|
62
|
+
const response = await fetch('https://apps.aavechan.com/api/merit/aprs', {
|
|
63
|
+
signal: AbortSignal.timeout(5000),
|
|
64
|
+
});
|
|
65
|
+
if (!response.ok) throw new Error('Failed to fetch Merit rewards data');
|
|
66
|
+
const data = await response.json();
|
|
67
|
+
return (data?.currentAPR?.actionsAPR as Record<string, number | null>) || {};
|
|
68
|
+
} catch (error) {
|
|
69
|
+
console.error('External API Failure: Failed to fetch merit rewards data:', error);
|
|
70
|
+
return {};
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const getMeritCampaigns = async (chainId: NetworkNumber, market: AaveVersions): Promise<MeritTokenRewardMap> => {
|
|
75
|
+
console.log('Fetching Merit campaigns');
|
|
76
|
+
const meritData = await fetchMeritRewardsData();
|
|
77
|
+
const relevantCampaigns = {
|
|
78
|
+
supply: {},
|
|
79
|
+
borrow: {},
|
|
80
|
+
} as MeritTokenRewardMap;
|
|
81
|
+
Object.entries(MERIT_DATA_MAP[chainId]?.[market] || {})
|
|
82
|
+
.filter(([key, rewardData]) => !!meritData[key])
|
|
83
|
+
.forEach(([key, rewardData]) => {
|
|
84
|
+
const apr = meritData[key]!;
|
|
85
|
+
if (!apr) return;
|
|
86
|
+
const reward = {
|
|
87
|
+
rewardTokenSymbol: rewardData.rewardTokenSymbol,
|
|
88
|
+
apy: aprToApy(apr).toString(),
|
|
89
|
+
description: `Eligible for Merit rewards in ${rewardData.rewardTokenSymbol}. ${rewardData.message ? `\n${rewardData.message}` : ''}`,
|
|
90
|
+
};
|
|
91
|
+
rewardData.supplyTokens?.forEach(token => {
|
|
92
|
+
relevantCampaigns.supply[token] = reward;
|
|
93
|
+
});
|
|
94
|
+
rewardData.borrowTokens?.forEach(token => {
|
|
95
|
+
relevantCampaigns.borrow[token] = reward;
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
return relevantCampaigns;
|
|
99
|
+
};
|
package/src/aaveV3/merkl.ts
CHANGED
|
@@ -1,74 +1,75 @@
|
|
|
1
|
-
import { aprToApy } from '../moneymarket';
|
|
2
|
-
import { DEFAULT_TIMEOUT, wethToEth } from '../services/utils';
|
|
3
|
-
import {
|
|
4
|
-
MerkleRewardMap, MerklOpportunity, OpportunityAction, OpportunityStatus,
|
|
5
|
-
} from '../types';
|
|
6
|
-
import { EthAddress, NetworkNumber } from '../types/common';
|
|
7
|
-
|
|
8
|
-
export const getAaveUnderlyingSymbol = (_symbol = '') => {
|
|
9
|
-
let symbol = _symbol
|
|
10
|
-
.replace(/^aEthLido/, '')
|
|
11
|
-
.replace(/^aEthEtherFi/, '')
|
|
12
|
-
.replace(/^aEth/, '')
|
|
13
|
-
.replace(/^aArb/, '')
|
|
14
|
-
.replace(/^aOpt/, '')
|
|
15
|
-
.replace(/^aBas/, '')
|
|
16
|
-
.replace(/^aLin/, '');
|
|
17
|
-
if (symbol.startsWith('a')) symbol = symbol.slice(1);
|
|
18
|
-
return wethToEth(symbol);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* aEthLidoUSDC -> aUSDC
|
|
23
|
-
* USDC -> USDC
|
|
24
|
-
*/
|
|
25
|
-
export const formatAaveAsset = (_symbol: string) => {
|
|
26
|
-
if (_symbol.startsWith('a')) {
|
|
27
|
-
return `a${getAaveUnderlyingSymbol(_symbol)}`;
|
|
28
|
-
}
|
|
29
|
-
return _symbol;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const getMerkleCampaigns = async (chainId: NetworkNumber): Promise<MerkleRewardMap> => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
.filter((o: MerklOpportunity) => o.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
acc[supplyAToken]
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
acc[borrowAToken]
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
1
|
+
import { aprToApy } from '../moneymarket';
|
|
2
|
+
import { DEFAULT_TIMEOUT, wethToEth } from '../services/utils';
|
|
3
|
+
import {
|
|
4
|
+
MerkleRewardMap, MerklOpportunity, OpportunityAction, OpportunityStatus,
|
|
5
|
+
} from '../types';
|
|
6
|
+
import { EthAddress, NetworkNumber } from '../types/common';
|
|
7
|
+
|
|
8
|
+
export const getAaveUnderlyingSymbol = (_symbol = '') => {
|
|
9
|
+
let symbol = _symbol
|
|
10
|
+
.replace(/^aEthLido/, '')
|
|
11
|
+
.replace(/^aEthEtherFi/, '')
|
|
12
|
+
.replace(/^aEth/, '')
|
|
13
|
+
.replace(/^aArb/, '')
|
|
14
|
+
.replace(/^aOpt/, '')
|
|
15
|
+
.replace(/^aBas/, '')
|
|
16
|
+
.replace(/^aLin/, '');
|
|
17
|
+
if (symbol.startsWith('a')) symbol = symbol.slice(1);
|
|
18
|
+
return wethToEth(symbol);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* aEthLidoUSDC -> aUSDC
|
|
23
|
+
* USDC -> USDC
|
|
24
|
+
*/
|
|
25
|
+
export const formatAaveAsset = (_symbol: string) => {
|
|
26
|
+
if (_symbol.startsWith('a')) {
|
|
27
|
+
return `a${getAaveUnderlyingSymbol(_symbol)}`;
|
|
28
|
+
}
|
|
29
|
+
return _symbol;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const getMerkleCampaigns = async (chainId: NetworkNumber): Promise<MerkleRewardMap> => {
|
|
33
|
+
console.log('Fetching Merkle campaigns');
|
|
34
|
+
try {
|
|
35
|
+
const res = await fetch('https://api.merkl.xyz/v4/opportunities?mainProtocolId=aave', {
|
|
36
|
+
signal: AbortSignal.timeout(DEFAULT_TIMEOUT),
|
|
37
|
+
});
|
|
38
|
+
if (!res.ok) throw new Error('Failed to fetch Merkle campaigns');
|
|
39
|
+
const opportunities = await res.json() as MerklOpportunity[];
|
|
40
|
+
const relevantOpportunities = opportunities
|
|
41
|
+
.filter((o: MerklOpportunity) => o.chainId === chainId)
|
|
42
|
+
.filter((o: MerklOpportunity) => o.status === OpportunityStatus.LIVE);
|
|
43
|
+
return relevantOpportunities.reduce((acc, opportunity) => {
|
|
44
|
+
const rewardToken = opportunity.rewardsRecord.breakdowns[0].token;
|
|
45
|
+
const description = `Eligible for ${formatAaveAsset(rewardToken.symbol)} rewards through Merkl. ${opportunity.description ? `\n${opportunity.description}` : ''}`;
|
|
46
|
+
if (opportunity.action === OpportunityAction.LEND && opportunity.explorerAddress) {
|
|
47
|
+
const supplyAToken = opportunity.explorerAddress?.toLowerCase() as EthAddress;
|
|
48
|
+
if (!acc[supplyAToken]) acc[supplyAToken] = {};
|
|
49
|
+
acc[supplyAToken].supply = {
|
|
50
|
+
apy: aprToApy(opportunity.apr),
|
|
51
|
+
// rewardToken: rewardToken.address,
|
|
52
|
+
rewardTokenSymbol: rewardToken.symbol,
|
|
53
|
+
description,
|
|
54
|
+
identifier: opportunity.identifier,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (opportunity.action === OpportunityAction.BORROW && opportunity.explorerAddress) {
|
|
58
|
+
const borrowAToken = opportunity.explorerAddress?.toLowerCase() as EthAddress;
|
|
59
|
+
if (!acc[borrowAToken]) acc[borrowAToken] = {};
|
|
60
|
+
acc[borrowAToken].borrow = {
|
|
61
|
+
apy: aprToApy(opportunity.apr),
|
|
62
|
+
// rewardToken: rewardToken.address,
|
|
63
|
+
rewardTokenSymbol: rewardToken.symbol,
|
|
64
|
+
description,
|
|
65
|
+
identifier: opportunity.identifier,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return acc;
|
|
69
|
+
}, {} as MerkleRewardMap);
|
|
70
|
+
} catch (e) {
|
|
71
|
+
console.error('Failed to fetch Merkle campaigns', e);
|
|
72
|
+
return {};
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|