Skip to content

Commit 700658a

Browse files
authored
feat: added hardcoded incentives for PYUSD (#2706)
1 parent 0eb43a5 commit 700658a

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

src/hooks/useMerklIncentives.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ProtocolAction } from '@aave/contract-helpers';
22
import { ReserveIncentiveResponse } from '@aave/math-utils/dist/esm/formatters/incentive/calculate-reserve-incentives';
3+
import { AaveV3Ethereum } from '@bgd-labs/aave-address-book';
34
import { useQuery } from '@tanstack/react-query';
45
import { useRootStore } from 'src/store/root';
56
import { convertAprToApy } from 'src/utils/utils';
@@ -99,6 +100,28 @@ type WhitelistApiResponse = {
99100
additionalIncentiveInfo: Record<string, ReserveIncentiveAdditionalData>;
100101
};
101102

103+
const hardcodedIncentives: Record<string, ExtendedReserveIncentiveResponse> = {
104+
[AaveV3Ethereum.ASSETS.PYUSD.A_TOKEN]: {
105+
incentiveAPR: '0.43',
106+
rewardTokenAddress: AaveV3Ethereum.ASSETS.PYUSD.A_TOKEN,
107+
rewardTokenSymbol: 'aEthPYUSD',
108+
customMessage:
109+
'You need to supply PYUSD without holding any PYUSD debt. This is a program initiated and implemented by ACI in collaboration with Merkl.',
110+
breakdown: {
111+
protocolAPY: 0,
112+
protocolIncentivesAPR: 0,
113+
merklIncentivesAPR: 0,
114+
totalAPY: 0,
115+
isBorrow: false,
116+
breakdown: {
117+
protocol: 0,
118+
protocolIncentives: 0,
119+
merklIncentives: 0,
120+
},
121+
},
122+
},
123+
};
124+
102125
const MERKL_ENDPOINT = 'https://api.merkl.xyz/v4/opportunities?mainProtocolId=aave'; // Merkl API
103126
const WHITELIST_ENDPOINT = 'https://apps.aavechan.com/api/aave/merkl/whitelist-token-list'; // Endpoint to fetch whitelisted tokens
104127
const checkOpportunityAction = (
@@ -153,6 +176,23 @@ export const useMerklIncentives = ({
153176
queryKey: ['merklIncentives', market],
154177
staleTime: 1000 * 60 * 5,
155178
select: (merklOpportunities) => {
179+
const hardcodedIncentive = rewardedAsset ? hardcodedIncentives[rewardedAsset] : undefined;
180+
181+
if (hardcodedIncentive) {
182+
const protocolIncentivesAPR = protocolIncentives.reduce((sum, inc) => {
183+
return sum + (inc.incentiveAPR === 'Infinity' ? 0 : +inc.incentiveAPR);
184+
}, 0);
185+
const merklIncentivesAPY = convertAprToApy(0.1);
186+
return {
187+
...hardcodedIncentive,
188+
breakdown: {
189+
protocolAPY,
190+
protocolIncentivesAPR,
191+
merklIncentivesAPR: merklIncentivesAPY,
192+
totalAPY: protocolAPY + protocolIncentivesAPR + merklIncentivesAPY,
193+
} as MerklIncentivesBreakdown,
194+
} as ExtendedReserveIncentiveResponse;
195+
}
156196
const opportunities = merklOpportunities.filter(
157197
(opportunitiy) =>
158198
rewardedAsset &&

0 commit comments

Comments
 (0)