|
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 { AaveV3Ethereum } 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'; |
@@ -142,7 +143,27 @@ type WhitelistApiResponse = { |
142 | 143 | whitelistedRewardTokens: string[]; |
143 | 144 | additionalIncentiveInfo: Record<string, ReserveIncentiveAdditionalData>; |
144 | 145 | }; |
145 | | - |
| 146 | +const hardcodedIncentives: Record<string, ExtendedReserveIncentiveResponse> = { |
| 147 | + [AaveV3Ethereum.ASSETS.USDT.V_TOKEN]: { |
| 148 | + incentiveAPR: '0.15', |
| 149 | + rewardTokenAddress: AaveV3Ethereum.ASSETS.USDT.A_TOKEN, |
| 150 | + rewardTokenSymbol: 'syrupUSDT', |
| 151 | + customMessage: |
| 152 | + 'You need to supply syrupUSDT and borrow USDT to be eligible to this incentive campaign. This is a program initiated and implemented by ACI in collaboration with Merkl', |
| 153 | + breakdown: { |
| 154 | + protocolAPY: 0, |
| 155 | + protocolIncentivesAPR: 0, |
| 156 | + merklIncentivesAPR: 0, |
| 157 | + totalAPY: 0, |
| 158 | + isBorrow: true, |
| 159 | + breakdown: { |
| 160 | + protocol: 0, |
| 161 | + protocolIncentives: 0, |
| 162 | + merklIncentives: 0, |
| 163 | + }, |
| 164 | + }, |
| 165 | + }, |
| 166 | +}; |
146 | 167 | const MERKL_ENDPOINT = 'https://api.merkl.xyz/v4/opportunities?mainProtocolId=aave'; // Merkl API |
147 | 168 | const WHITELIST_ENDPOINT = 'https://apps.aavechan.com/api/aave/merkl/whitelist-token-list'; // Endpoint to fetch whitelisted tokens |
148 | 169 | const checkOpportunityAction = ( |
@@ -198,6 +219,26 @@ export const useMerklIncentives = ({ |
198 | 219 | queryKey: ['merklIncentives', market], |
199 | 220 | staleTime: 1000 * 60 * 5, |
200 | 221 | select: (merklOpportunities) => { |
| 222 | + // Temporary hardcoded incentive |
| 223 | + const hardcodedIncentive = rewardedAsset ? hardcodedIncentives[rewardedAsset] : undefined; |
| 224 | + if (hardcodedIncentive) { |
| 225 | + const protocolIncentivesAPR = protocolIncentives.reduce((sum, inc) => { |
| 226 | + return sum + (inc.incentiveAPR === 'Infinity' ? 0 : +inc.incentiveAPR); |
| 227 | + }, 0); |
| 228 | + const merklIncentivesAPY = convertAprToApy(0.015); |
| 229 | + return { |
| 230 | + ...hardcodedIncentive, |
| 231 | + breakdown: { |
| 232 | + protocolAPY, |
| 233 | + isBorrow: true, |
| 234 | + protocolIncentivesAPR, |
| 235 | + merklIncentivesAPR: merklIncentivesAPY, |
| 236 | + totalAPY: protocolAPY + protocolIncentivesAPR - merklIncentivesAPY, |
| 237 | + } as MerklIncentivesBreakdown, |
| 238 | + } as ExtendedReserveIncentiveResponse; |
| 239 | + } |
| 240 | + // END |
| 241 | + |
201 | 242 | const opportunities = merklOpportunities.filter( |
202 | 243 | (opportunitiy) => |
203 | 244 | rewardedAsset && |
|
0 commit comments