Skip to content

Commit bdeb421

Browse files
authored
feat: added hardcoded campaign for usdt (#2795)
1 parent dd88b41 commit bdeb421

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

src/hooks/useMerklIncentives.ts

Lines changed: 42 additions & 1 deletion
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';
@@ -142,7 +143,27 @@ type WhitelistApiResponse = {
142143
whitelistedRewardTokens: string[];
143144
additionalIncentiveInfo: Record<string, ReserveIncentiveAdditionalData>;
144145
};
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+
};
146167
const MERKL_ENDPOINT = 'https://api.merkl.xyz/v4/opportunities?mainProtocolId=aave'; // Merkl API
147168
const WHITELIST_ENDPOINT = 'https://apps.aavechan.com/api/aave/merkl/whitelist-token-list'; // Endpoint to fetch whitelisted tokens
148169
const checkOpportunityAction = (
@@ -198,6 +219,26 @@ export const useMerklIncentives = ({
198219
queryKey: ['merklIncentives', market],
199220
staleTime: 1000 * 60 * 5,
200221
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+
201242
const opportunities = merklOpportunities.filter(
202243
(opportunitiy) =>
203244
rewardedAsset &&

0 commit comments

Comments
 (0)