Skip to content

Commit 4cd1477

Browse files
authored
✨Add new Ethena Rewards tooltip [skip cypress] (#2365)
1 parent e96e787 commit 4cd1477

File tree

10 files changed

+126
-4
lines changed

10 files changed

+126
-4
lines changed

public/icons/other/ethena.svg

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { Trans } from '@lingui/macro';
2+
import { Box } from '@mui/material';
3+
4+
import { Link } from '../primitives/Link';
5+
6+
export const EthenaAirdropTooltipContent = ({ points }: { points: number }) => {
7+
return (
8+
<Box>
9+
<Trans>{`This asset is eligible for ${(<b>{points}x</b>)} Ethena Rewards.\n`}</Trans>
10+
<br />
11+
<Trans>{'Learn more about Ethena Rewards program'}</Trans>{' '}
12+
<Link
13+
href="https://app.ethena.fi/join"
14+
sx={{ textDecoration: 'underline' }}
15+
variant="caption"
16+
color="text.secondary"
17+
>
18+
{'here'}
19+
</Link>
20+
{'.'}
21+
<br />
22+
<br />
23+
<Trans>
24+
{`Aave Labs does not
25+
guarantee the program and accepts no liability.\n`}
26+
</Trans>
27+
</Box>
28+
);
29+
};

src/components/incentives/IncentivesButton.tsx

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ReserveIncentiveResponse } from '@aave/math-utils/dist/esm/formatters/i
44
import { DotsHorizontalIcon } from '@heroicons/react/solid';
55
import { Box, SvgIcon, Typography } from '@mui/material';
66
import { useState } from 'react';
7+
import { useEthenaIncentives } from 'src/hooks/useEthenaIncentives';
78
import { useMeritIncentives } from 'src/hooks/useMeritIncentives';
89
import { useZkSyncIgniteIncentives } from 'src/hooks/useZkSyncIgniteIncentives';
910
import { useRootStore } from 'src/store/root';
@@ -12,6 +13,7 @@ import { DASHBOARD } from 'src/utils/mixPanelEvents';
1213
import { ContentWithTooltip } from '../ContentWithTooltip';
1314
import { FormattedNumber } from '../primitives/FormattedNumber';
1415
import { TokenIcon } from '../primitives/TokenIcon';
16+
import { EthenaAirdropTooltipContent } from './EthenaIncentivesTooltipContent';
1517
import { getSymbolMap, IncentivesTooltipContent } from './IncentivesTooltipContent';
1618
import { MeritIncentivesTooltipContent } from './MeritIncentivesTooltipContent';
1719
import { ZkSyncIgniteIncentivesTooltipContent } from './ZkSyncIgniteIncentivesTooltipContent';
@@ -92,6 +94,26 @@ export const ZkIgniteIncentivesButton = (params: {
9294
);
9395
};
9496

97+
export const EthenaIncentivesButton = ({ rewardedAsset }: { rewardedAsset?: string }) => {
98+
const [open, setOpen] = useState(false);
99+
const points = useEthenaIncentives(rewardedAsset);
100+
101+
if (!points) {
102+
return null;
103+
}
104+
105+
return (
106+
<ContentWithTooltip
107+
tooltipContent={<EthenaAirdropTooltipContent points={points} />}
108+
withoutHover
109+
setOpen={setOpen}
110+
open={open}
111+
>
112+
<ContentEthenaButton points={points} />
113+
</ContentWithTooltip>
114+
);
115+
};
116+
95117
export const IncentivesButton = ({ incentives, symbol, displayBlank }: IncentivesButtonProps) => {
96118
const [open, setOpen] = useState(false);
97119

@@ -271,3 +293,41 @@ const Content = ({
271293
</Box>
272294
);
273295
};
296+
297+
const ContentEthenaButton = ({ points }: { points: number }) => {
298+
const [open, setOpen] = useState(false);
299+
const trackEvent = useRootStore((store) => store.trackEvent);
300+
301+
return (
302+
<Box
303+
sx={(theme) => ({
304+
p: { xs: '0 4px', xsm: '2px 4px' },
305+
border: `1px solid ${open ? theme.palette.action.disabled : theme.palette.divider}`,
306+
borderRadius: '4px',
307+
cursor: 'pointer',
308+
display: 'flex',
309+
alignItems: 'center',
310+
justifyContent: 'center',
311+
transition: 'opacity 0.2s ease',
312+
bgcolor: open ? 'action.hover' : 'transparent',
313+
'&:hover': {
314+
bgcolor: 'action.hover',
315+
borderColor: 'action.disabled',
316+
},
317+
})}
318+
onClick={() => {
319+
trackEvent(DASHBOARD.VIEW_LM_DETAILS_DASHBOARD, {});
320+
setOpen(!open);
321+
}}
322+
>
323+
<Box sx={{ mr: 2 }}>
324+
<Typography component="span" variant="secondary12" color="text.secondary">
325+
{`${points}x`}
326+
</Typography>
327+
</Box>
328+
<Box sx={{ display: 'inline-flex' }}>
329+
<img src={'/icons/other/ethena.svg'} width={12} height={12} alt="ethena-icon" />
330+
</Box>
331+
</Box>
332+
);
333+
};

src/components/incentives/IncentivesCard.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { ReactNode } from 'react';
66
import { FormattedNumber } from '../primitives/FormattedNumber';
77
import { NoData } from '../primitives/NoData';
88
import {
9+
EthenaIncentivesButton,
910
IncentivesButton,
1011
MeritIncentivesButton,
1112
ZkIgniteIncentivesButton,
@@ -85,6 +86,7 @@ export const IncentivesCard = ({
8586
rewardedAsset={address}
8687
protocolAction={protocolAction}
8788
/>
89+
<EthenaIncentivesButton rewardedAsset={address} />
8890
</Box>
8991
</Box>
9092
);

src/hooks/useEthenaIncentives.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { AaveV3Ethereum, AaveV3EthereumLido } from '@bgd-labs/aave-address-book';
2+
3+
const getEthenaData = (assetAddress: string): number | undefined =>
4+
ETHENA_DATA_MAP.get(assetAddress);
5+
6+
const ETHENA_DATA_MAP: Map<string, number> = new Map([
7+
[AaveV3Ethereum.ASSETS.USDe.A_TOKEN, 25],
8+
[AaveV3Ethereum.ASSETS.sUSDe.A_TOKEN, 5],
9+
[AaveV3EthereumLido.ASSETS.sUSDe.A_TOKEN, 5],
10+
]);
11+
12+
export const useEthenaIncentives = (rewardedAsset?: string) => {
13+
if (!rewardedAsset) {
14+
return undefined;
15+
}
16+
17+
return getEthenaData(rewardedAsset);
18+
};

src/locales/el/messages.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/locales/en/messages.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/locales/en/messages.po

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ msgstr "If you DO NOT unstake within {0} of unstake window, you will need to act
2121
msgid "Receive (est.)"
2222
msgstr "Receive (est.)"
2323

24+
#: src/components/incentives/EthenaIncentivesTooltipContent.tsx
25+
msgid "Aave Labs does not guarantee the program and accepts no liability."
26+
msgstr "Aave Labs does not guarantee the program and accepts no liability."
27+
2428
#: src/components/incentives/IncentivesTooltipContent.tsx
2529
msgid "Participating in this {symbol} reserve gives annualized rewards."
2630
msgstr "Participating in this {symbol} reserve gives annualized rewards."
@@ -124,6 +128,10 @@ msgstr "Collateral change"
124128
msgid "This is the total amount that you are able to supply to in this reserve. You are able to supply your wallet balance up until the supply cap is reached."
125129
msgstr "This is the total amount that you are able to supply to in this reserve. You are able to supply your wallet balance up until the supply cap is reached."
126130

131+
#: src/components/incentives/EthenaIncentivesTooltipContent.tsx
132+
msgid "This asset is eligible for {0} Ethena Rewards."
133+
msgstr "This asset is eligible for {0} Ethena Rewards."
134+
127135
#: src/modules/history/PriceUnavailable.tsx
128136
msgid "Price data is not currently available for this reserve on the protocol subgraph"
129137
msgstr "Price data is not currently available for this reserve on the protocol subgraph"
@@ -1167,6 +1175,10 @@ msgstr "Current LTV"
11671175
msgid "Market"
11681176
msgstr "Market"
11691177

1178+
#: src/components/incentives/EthenaIncentivesTooltipContent.tsx
1179+
msgid "Learn more about Ethena Rewards program"
1180+
msgstr "Learn more about Ethena Rewards program"
1181+
11701182
#: src/layouts/FeedbackDialog.tsx
11711183
msgid "Send Feedback"
11721184
msgstr "Send Feedback"

src/locales/es/messages.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/locales/fr/messages.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)