Skip to content

Commit d8637ec

Browse files
committed
feat: delete merit exception claiming
1 parent d032b9b commit d8637ec

22 files changed

Lines changed: 31 additions & 2176 deletions

src/components/incentives/IncentivesButton.tsx

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { Box, Typography } from '@mui/material';
55
import { useState } from 'react';
66
import { useEthenaIncentives } from 'src/hooks/useEthenaIncentives';
77
import { useEtherfiIncentives } from 'src/hooks/useEtherfiIncentives';
8-
import { useMeritIncentives } from 'src/hooks/useMeritIncentives';
98
import { ExtendedReserveIncentiveResponse, useMerklIncentives } from 'src/hooks/useMerklIncentives';
109
import { useMerklPointsIncentives } from 'src/hooks/useMerklPointsIncentives';
1110
import { useSonicIncentives } from 'src/hooks/useSonicIncentives';
@@ -18,7 +17,6 @@ import { FormattedNumber } from '../primitives/FormattedNumber';
1817
import { EthenaAirdropTooltipContent } from './EthenaIncentivesTooltipContent';
1918
import { EtherFiAirdropTooltipContent } from './EtherfiIncentivesTooltipContent';
2019
import { IncentivesTooltipContent } from './IncentivesTooltipContent';
21-
import { MeritIncentivesTooltipContent } from './MeritIncentivesTooltipContent';
2220
import { MerklIncentivesTooltipContent } from './MerklIncentivesTooltipContent';
2321
import { SonicAirdropTooltipContent } from './SonicIncentivesTooltipContent';
2422

@@ -128,45 +126,6 @@ const BlankIncentives = () => {
128126
);
129127
};
130128

131-
export const MeritIncentivesButton = (params: {
132-
symbol: string;
133-
market: string;
134-
protocolAction?: ProtocolAction;
135-
protocolAPY?: number;
136-
protocolIncentives?: ReserveIncentiveResponse[];
137-
hideValue?: boolean;
138-
}) => {
139-
const [open, setOpen] = useState(false);
140-
const { data: meritIncentives } = useMeritIncentives(params);
141-
142-
if (!meritIncentives) {
143-
return null;
144-
}
145-
146-
// Show only merit incentives APR
147-
const displayValue = +meritIncentives.incentiveAPR;
148-
149-
return (
150-
<ContentWithTooltip
151-
tooltipContent={
152-
<MeritIncentivesTooltipContent
153-
meritIncentives={meritIncentives}
154-
onClose={() => setOpen(false)}
155-
/>
156-
}
157-
withoutHover
158-
setOpen={setOpen}
159-
open={open}
160-
>
161-
<Content
162-
incentives={[meritIncentives]}
163-
incentivesNetAPR={displayValue}
164-
hideValue={params.hideValue}
165-
/>
166-
</ContentWithTooltip>
167-
);
168-
};
169-
170129
export const MerklIncentivesButton = (params: {
171130
market: string;
172131
rewardedAsset?: string;

src/components/incentives/IncentivesCard.tsx

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { ReserveIncentiveResponse } from '@aave/math-utils/dist/esm/formatters/i
33
import { Box, Typography } from '@mui/material';
44
import { useRouter } from 'next/router';
55
import { ReactNode } from 'react';
6-
import { ENABLE_SELF_CAMPAIGN, useMeritIncentives } from 'src/hooks/useMeritIncentives';
76
import { useMerklIncentives } from 'src/hooks/useMerklIncentives';
87
import { useMerklPointsIncentives } from 'src/hooks/useMerklPointsIncentives';
98
import { convertAprToApy } from 'src/utils/utils';
@@ -14,7 +13,6 @@ import {
1413
EthenaIncentivesButton,
1514
EtherfiIncentivesButton,
1615
IncentivesButton,
17-
MeritIncentivesButton,
1816
MerklIncentivesButton,
1917
SonicIncentivesButton,
2018
} from './IncentivesButton';
@@ -62,13 +60,6 @@ export const IncentivesCard = ({
6260
const protocolIncentivesAPY = convertAprToApy(
6361
protocolIncentivesAPR === 'Infinity' ? 0 : protocolIncentivesAPR
6462
);
65-
const { data: meritIncentives } = useMeritIncentives({
66-
symbol,
67-
market,
68-
protocolAction,
69-
protocolAPY,
70-
protocolIncentives: incentives || [],
71-
});
7263

7364
const { data: merklIncentives } = useMerklIncentives({
7465
market,
@@ -86,13 +77,6 @@ export const IncentivesCard = ({
8677
protocolIncentives: incentives || [],
8778
});
8879

89-
const meritIncentivesAPR = meritIncentives?.breakdown?.meritIncentivesAPR || 0;
90-
91-
// TODO: This is a one-off for the Self campaign.
92-
// Remove once the Self incentives are finished.
93-
const selfAPY = ENABLE_SELF_CAMPAIGN ? meritIncentives?.variants?.selfAPY ?? 0 : 0;
94-
const totalMeritAPY = meritIncentivesAPR + selfAPY;
95-
9680
const merklIncentivesAPR = merklPointsIncentives?.breakdown?.points
9781
? merklPointsIncentives.breakdown.merklIncentivesAPR || 0
9882
: merklIncentives?.breakdown?.merklIncentivesAPR || 0;
@@ -105,12 +89,9 @@ export const IncentivesCard = ({
10589
const displayAPY = hasInfiniteIncentives
10690
? 'Infinity'
10791
: isBorrow
108-
? protocolAPY - (protocolIncentivesAPY as number) - totalMeritAPY - merklIncentivesAPR
109-
: protocolAPY + (protocolIncentivesAPY as number) + totalMeritAPY + merklIncentivesAPR;
92+
? protocolAPY - (protocolIncentivesAPY as number) - merklIncentivesAPR
93+
: protocolAPY + (protocolIncentivesAPY as number) + merklIncentivesAPR;
11094

111-
const isSghoPage =
112-
typeof router?.asPath === 'string' && router.asPath.toLowerCase().startsWith('/sgho');
113-
const hideMeritValue = symbol === 'GHO' && !isSghoPage;
11495
const isMarketsOrDashboardPage =
11596
typeof router?.pathname === 'string' &&
11697
(router.pathname.startsWith('/dashboard') || router.pathname.startsWith('/markets'));
@@ -130,14 +111,7 @@ export const IncentivesCard = ({
130111
protocolAPY={protocolAPY}
131112
address={address}
132113
/>
133-
<MeritIncentivesButton
134-
symbol={symbol}
135-
market={market}
136-
protocolAction={protocolAction}
137-
protocolAPY={protocolAPY}
138-
protocolIncentives={incentives || []}
139-
hideValue={hideMeritValue}
140-
/>
114+
141115
<MerklIncentivesButton
142116
market={market}
143117
rewardedAsset={address}

src/components/incentives/IncentivesTooltipContent.tsx

Lines changed: 4 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { ProtocolAction } from '@aave/contract-helpers';
22
import { ReserveIncentiveResponse } from '@aave/math-utils/dist/esm/formatters/incentive/calculate-reserve-incentives';
33
import { Trans } from '@lingui/macro';
44
import { Box, Typography } from '@mui/material';
5-
import { useMeritIncentives } from 'src/hooks/useMeritIncentives';
65
import { useMerklIncentives } from 'src/hooks/useMerklIncentives';
76
import { convertAprToApy } from 'src/utils/utils';
87

@@ -298,14 +297,6 @@ export const IncentivesTooltipContent = ({
298297
}: IncentivesTooltipContentProps) => {
299298
const typographyVariant = 'secondary12';
300299

301-
const { data: meritIncentives } = useMeritIncentives({
302-
symbol,
303-
market: market || '',
304-
protocolAction,
305-
protocolAPY,
306-
protocolIncentives: incentives,
307-
});
308-
309300
const { data: merklIncentives } = useMerklIncentives({
310301
market: market || '',
311302
rewardedAsset: address,
@@ -336,20 +327,13 @@ export const IncentivesTooltipContent = ({
336327
);
337328
};
338329

339-
const meritIncentivesAPR = meritIncentives?.breakdown?.meritIncentivesAPR || 0;
340330
const merklIncentivesAPR = merklIncentives?.breakdown?.merklIncentivesAPR || 0;
341331

342332
// For borrow, incentives are subtracted; for supply, they're added
343333
const isBorrow = protocolAction === ProtocolAction.borrow;
344334
const totalAPY = isBorrow
345-
? protocolAPY -
346-
(incentivesNetAPR === 'Infinity' ? 0 : incentivesNetAPR) -
347-
meritIncentivesAPR -
348-
merklIncentivesAPR
349-
: protocolAPY +
350-
(incentivesNetAPR === 'Infinity' ? 0 : incentivesNetAPR) +
351-
meritIncentivesAPR +
352-
merklIncentivesAPR;
335+
? protocolAPY - (incentivesNetAPR === 'Infinity' ? 0 : incentivesNetAPR) - merklIncentivesAPR
336+
: protocolAPY + (incentivesNetAPR === 'Infinity' ? 0 : incentivesNetAPR) + merklIncentivesAPR;
353337

354338
return (
355339
<Box
@@ -419,41 +403,6 @@ export const IncentivesTooltipContent = ({
419403
);
420404
})}
421405

422-
{/* Show Merit Incentives if available */}
423-
{meritIncentives && meritIncentives.breakdown && (
424-
<Row
425-
height={32}
426-
caption={
427-
<Box sx={{ display: 'flex', alignItems: 'center', mb: 2 }}>
428-
<img
429-
src={'/icons/other/aci-black.svg'}
430-
width="20px"
431-
height="20px"
432-
alt="Merit"
433-
style={{ marginRight: '8px' }}
434-
/>
435-
<Box sx={{ display: 'flex', alignItems: 'center' }}>
436-
<Typography variant={typographyVariant}>Merit Incentives</Typography>
437-
<Typography variant={typographyVariant} sx={{ ml: 0.5 }}>
438-
{isBorrow ? '(-)' : '(+)'}
439-
</Typography>
440-
</Box>
441-
</Box>
442-
}
443-
width="100%"
444-
>
445-
<FormattedNumber
446-
value={
447-
isBorrow
448-
? -meritIncentives.breakdown.meritIncentivesAPR
449-
: meritIncentives.breakdown.meritIncentivesAPR
450-
}
451-
percent
452-
variant={typographyVariant}
453-
/>
454-
</Row>
455-
)}
456-
457406
{/* Show Merkl Incentives if available */}
458407
{merklIncentives && merklIncentives.breakdown && (
459408
<Row
@@ -507,8 +456,8 @@ export const IncentivesTooltipContent = ({
507456
</Box>
508457
)}
509458

510-
{/* Show Total APY if we have Merit incentives or protocol APY */}
511-
{(meritIncentives?.breakdown || protocolAPY > 0) && (
459+
{/* Show Total APY if we have Merkl incentives or protocol APY */}
460+
{protocolAPY > 0 && (
512461
<Box sx={() => ({ pt: 1, mt: 1, borderTop: '1px solid rgba(255, 255, 255, 0.1)' })}>
513462
<Row
514463
caption={

0 commit comments

Comments
 (0)