Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/hooks/useEthenaIncentives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ export const useEthenaIncentives = (rewardedAsset?: string): number | undefined
if (!data) return undefined;

const ethena = data.find(
(i) => i.__typename === 'SupplyPointsIncentive' && i.program.name === 'Ethena Rewards'
(i) =>
i.__typename === 'SupplyPointsIncentive' &&
i.kind === 'LOYALTY' &&
i.program.name === 'Ethena Rewards'
);
if (!ethena || ethena.__typename !== 'SupplyPointsIncentive') {
return undefined;
Expand Down
5 changes: 4 additions & 1 deletion src/hooks/useEtherfiIncentives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ export const useEtherfiIncentives = (
if (!isSupplyContext || !data) return undefined;

const etherfi = data.find(
(i) => i.__typename === 'SupplyPointsIncentive' && i.program.name === 'Ether.fi Loyalty'
(i) =>
i.__typename === 'SupplyPointsIncentive' &&
i.kind === 'LOYALTY' &&
i.program.name === 'Ether.fi Loyalty'
);
if (!etherfi || etherfi.__typename !== 'SupplyPointsIncentive') {
return undefined;
Expand Down
9 changes: 7 additions & 2 deletions src/hooks/useMerklPointsIncentives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,14 @@ export const useMerklPointsIncentives = ({
});

const isBorrow = protocolAction === ProtocolAction.borrow;
const targetTypename = isBorrow ? 'BorrowPointsIncentive' : 'SupplyPointsIncentive';

const incentive = query.data?.find((i) => i.__typename === targetTypename);
const incentive = query.data?.find((i) => {
if (isBorrow) {
return i.__typename === 'BorrowPointsIncentive' && i.kind === 'CAMPAIGN';
}

return i.__typename === 'SupplyPointsIncentive' && i.kind === 'CAMPAIGN';
});

if (
!incentive ||
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/useSonicIncentives.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export const useSonicIncentives = (rewardedAsset?: string): number | undefined =
if (!data) return undefined;

const sonic = data.find(
(i) => i.__typename === 'SupplyPointsIncentive' && i.program.name === 'Sonic'
(i) =>
i.__typename === 'SupplyPointsIncentive' && i.kind === 'LOYALTY' && i.program.name === 'Sonic'
);
if (!sonic || sonic.__typename !== 'SupplyPointsIncentive') return undefined;

Expand Down
Loading