Skip to content

Commit 500a69f

Browse files
authored
fix: eligible token + reward token (#2538)
1 parent a86ae69 commit 500a69f

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

src/hooks/useMerklIncentives.ts

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ type MerklOpportunity = {
4444
dailyRewards: number;
4545
tags: [];
4646
id: string;
47+
explorerAddress?: Address;
4748
tokens: {
4849
id: string;
4950
name: string;
@@ -56,6 +57,34 @@ type MerklOpportunity = {
5657
price: number;
5758
symbol: string;
5859
}[];
60+
rewardsRecord: {
61+
id: string;
62+
total: number;
63+
timestamp: string;
64+
breakdowns: {
65+
token: {
66+
id: string;
67+
name: string;
68+
chainId: number;
69+
address: string;
70+
decimals: number;
71+
symbol: string;
72+
displaySymbol: string;
73+
icon: string;
74+
verified: boolean;
75+
isTest: boolean;
76+
type: string;
77+
isNative: boolean;
78+
price: number;
79+
};
80+
amount: string;
81+
value: number;
82+
distributionType: string;
83+
id: string;
84+
campaignId: string;
85+
dailyRewardsRecordId: string;
86+
}[];
87+
};
5988
};
6089

6190
export type ExtendedReserveIncentiveResponse = ReserveIncentiveResponse & {
@@ -140,7 +169,8 @@ export const useMerklIncentives = ({
140169
const opportunities = merklOpportunities.filter(
141170
(opportunitiy) =>
142171
rewardedAsset &&
143-
opportunitiy.identifier.toLowerCase() === rewardedAsset.toLowerCase() &&
172+
opportunitiy.explorerAddress &&
173+
opportunitiy.explorerAddress.toLowerCase() === rewardedAsset.toLowerCase() &&
144174
protocolAction &&
145175
checkOpportunityAction(opportunitiy.action, protocolAction)
146176
);
@@ -161,7 +191,7 @@ export const useMerklIncentives = ({
161191

162192
const apr = opportunity.apr / 100;
163193

164-
const rewardToken = opportunity.tokens[opportunity.tokens.length - 1];
194+
const rewardToken = opportunity.rewardsRecord.breakdowns[0].token;
165195

166196
if (!whitelistedRewardTokens.includes(rewardToken.address.toLowerCase())) {
167197
return null;

0 commit comments

Comments
 (0)