|
1 | 1 | import { ProtocolAction } from '@aave/contract-helpers'; |
2 | 2 | import { ReserveIncentiveResponse } from '@aave/math-utils/dist/esm/formatters/incentive/calculate-reserve-incentives'; |
| 3 | +import { AaveV3Plasma } from '@bgd-labs/aave-address-book'; |
3 | 4 | import { useQuery } from '@tanstack/react-query'; |
4 | 5 | import { useRootStore } from 'src/store/root'; |
5 | 6 | import { convertAprToApy } from 'src/utils/utils'; |
@@ -98,6 +99,27 @@ type WhitelistApiResponse = { |
98 | 99 | whitelistedRewardTokens: string[]; |
99 | 100 | additionalIncentiveInfo: Record<string, ReserveIncentiveAdditionalData>; |
100 | 101 | }; |
| 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 | +}; |
101 | 123 |
|
102 | 124 | const MERKL_ENDPOINT = 'https://api.merkl.xyz/v4/opportunities?mainProtocolId=aave'; // Merkl API |
103 | 125 | 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 = ({ |
153 | 175 | queryKey: ['merklIncentives', market], |
154 | 176 | staleTime: 1000 * 60 * 5, |
155 | 177 | 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 | + |
156 | 196 | const opportunities = merklOpportunities.filter( |
157 | 197 | (opportunitiy) => |
158 | 198 | rewardedAsset && |
|
0 commit comments