Skip to content

Commit d573883

Browse files
authored
feat: add hardcoded apr for plasma usde (#2699)
1 parent c9cb33b commit d573883

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 { AaveV3Plasma } 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';
@@ -98,6 +99,27 @@ type WhitelistApiResponse = {
9899
whitelistedRewardTokens: string[];
99100
additionalIncentiveInfo: Record<string, ReserveIncentiveAdditionalData>;
100101
};
102+
const hardcodedIncentives: Record<string, ExtendedReserveIncentiveResponse> = {
103+
[AaveV3Plasma.ASSETS.USDe.A_TOKEN]: {
104+
incentiveAPR: '0.12',
105+
rewardTokenAddress: AaveV3Plasma.ASSETS.USDe.A_TOKEN,
106+
rewardTokenSymbol: 'aPlaUSDe',
107+
customMessage:
108+
'You must supply USDe and hold an equal or greater amount of sUSDe (by USD value) to receive the incentives. To be eligible, your assets supplied must be at least 2x your account equity, and you must not be borrowing any USDe. The rate provided to eligible users will change week by week, but will be roughly in line with the sUSDe rate for the forseeable future.',
109+
breakdown: {
110+
protocolAPY: 0,
111+
protocolIncentivesAPR: 0,
112+
merklIncentivesAPR: 0,
113+
totalAPY: 0,
114+
isBorrow: false,
115+
breakdown: {
116+
protocol: 0,
117+
protocolIncentives: 0,
118+
merklIncentives: 0,
119+
},
120+
},
121+
},
122+
};
101123

102124
const MERKL_ENDPOINT = 'https://api.merkl.xyz/v4/opportunities?mainProtocolId=aave'; // Merkl API
103125
const WHITELIST_ENDPOINT = 'https://apps.aavechan.com/api/aave/merkl/whitelist-token-list'; // Endpoint to fetch whitelisted tokens
@@ -153,6 +175,24 @@ export const useMerklIncentives = ({
153175
queryKey: ['merklIncentives', market],
154176
staleTime: 1000 * 60 * 5,
155177
select: (merklOpportunities) => {
178+
const hardcodedIncentive = rewardedAsset ? hardcodedIncentives[rewardedAsset] : undefined;
179+
180+
if (hardcodedIncentive) {
181+
const protocolIncentivesAPR = protocolIncentives.reduce((sum, inc) => {
182+
return sum + (inc.incentiveAPR === 'Infinity' ? 0 : +inc.incentiveAPR);
183+
}, 0);
184+
const merklIncentivesAPY = convertAprToApy(0.045);
185+
return {
186+
...hardcodedIncentive,
187+
breakdown: {
188+
protocolAPY,
189+
protocolIncentivesAPR,
190+
merklIncentivesAPR: merklIncentivesAPY,
191+
totalAPY: protocolAPY + protocolIncentivesAPR + merklIncentivesAPY,
192+
} as MerklIncentivesBreakdown,
193+
} as ExtendedReserveIncentiveResponse;
194+
}
195+
156196
const opportunities = merklOpportunities.filter(
157197
(opportunitiy) =>
158198
rewardedAsset &&

0 commit comments

Comments
 (0)