Skip to content

Commit 09043e9

Browse files
authored
feat: add Ether.fi loyalty program (#2380)
1 parent ff30bce commit 09043e9

File tree

11 files changed

+123
-18
lines changed

11 files changed

+123
-18
lines changed

public/icons/networks/sonic.svg

Lines changed: 1 addition & 9 deletions
Loading

public/icons/other/ether.fi.svg

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

src/components/incentives/IncentivesButton.tsx

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { DotsHorizontalIcon } from '@heroicons/react/solid';
55
import { Box, SvgIcon, Typography } from '@mui/material';
66
import { useState } from 'react';
77
import { useEthenaIncentives } from 'src/hooks/useEthenaIncentives';
8+
import { useEtherfiIncentives } from 'src/hooks/useEtherfiIncentives';
89
import { useMeritIncentives } from 'src/hooks/useMeritIncentives';
910
import { useSonicIncentives } from 'src/hooks/useSonicIncentives';
1011
import { useZkSyncIgniteIncentives } from 'src/hooks/useZkSyncIgniteIncentives';
@@ -15,6 +16,7 @@ import { ContentWithTooltip } from '../ContentWithTooltip';
1516
import { FormattedNumber } from '../primitives/FormattedNumber';
1617
import { TokenIcon } from '../primitives/TokenIcon';
1718
import { EthenaAirdropTooltipContent } from './EthenaIncentivesTooltipContent';
19+
import { EtherFiAirdropTooltipContent } from './EtherfiIncentivesTooltipContent';
1820
import { getSymbolMap, IncentivesTooltipContent } from './IncentivesTooltipContent';
1921
import { MeritIncentivesTooltipContent } from './MeritIncentivesTooltipContent';
2022
import { SonicAirdropTooltipContent } from './SonicIncentivesTooltipContent';
@@ -111,7 +113,32 @@ export const EthenaIncentivesButton = ({ rewardedAsset }: { rewardedAsset?: stri
111113
setOpen={setOpen}
112114
open={open}
113115
>
114-
<ContentPointsButton points={points} icon={'/icons/other/ethena.svg'} />
116+
<ContentEthenaButton points={points} />
117+
</ContentWithTooltip>
118+
);
119+
};
120+
121+
export const EtherfiIncentivesButton = (params: {
122+
symbol: string;
123+
market: string;
124+
protocolAction?: ProtocolAction;
125+
}) => {
126+
const [open, setOpen] = useState(false);
127+
const { market, protocolAction, symbol } = params;
128+
const multiplier = useEtherfiIncentives(market, symbol, protocolAction);
129+
130+
if (!multiplier) {
131+
return null;
132+
}
133+
134+
return (
135+
<ContentWithTooltip
136+
tooltipContent={<EtherFiAirdropTooltipContent multiplier={multiplier} />}
137+
withoutHover
138+
setOpen={setOpen}
139+
open={open}
140+
>
141+
<ContentEtherfiButton multiplier={multiplier} />
115142
</ContentWithTooltip>
116143
);
117144
};
@@ -131,7 +158,7 @@ export const SonicIncentivesButton = ({ rewardedAsset }: { rewardedAsset?: strin
131158
setOpen={setOpen}
132159
open={open}
133160
>
134-
<ContentPointsButton points={points} icon={'/icons/networks/sonic.svg'} />
161+
<ContentSonicButton points={points} />
135162
</ContentWithTooltip>
136163
);
137164
};
@@ -316,7 +343,7 @@ const Content = ({
316343
);
317344
};
318345

319-
const ContentPointsButton = ({ points, icon }: { points: number; icon: string }) => {
346+
const ContentButton = ({ value, iconSrc }: { value: number; iconSrc: string }) => {
320347
const [open, setOpen] = useState(false);
321348
const trackEvent = useRootStore((store) => store.trackEvent);
322349

@@ -344,12 +371,24 @@ const ContentPointsButton = ({ points, icon }: { points: number; icon: string })
344371
>
345372
<Box sx={{ mr: 2 }}>
346373
<Typography component="span" variant="secondary12" color="text.secondary">
347-
{`${points}x`}
374+
{`${value}x`}
348375
</Typography>
349376
</Box>
350377
<Box sx={{ display: 'inline-flex' }}>
351-
<img src={icon} width={12} height={12} alt="ethena-icon" />
378+
<img src={iconSrc} width={12} height={12} alt="icon" />
352379
</Box>
353380
</Box>
354381
);
355382
};
383+
384+
const ContentEthenaButton = ({ points }: { points: number }) => (
385+
<ContentButton value={points} iconSrc="/icons/other/ethena.svg" />
386+
);
387+
388+
const ContentEtherfiButton = ({ multiplier }: { multiplier: number }) => (
389+
<ContentButton value={multiplier} iconSrc="/icons/other/ether.fi.svg" />
390+
);
391+
392+
const ContentSonicButton = ({ points }: { points: number }) => (
393+
<ContentButton value={points} iconSrc="/icons/networks/sonic.svg" />
394+
);

src/components/incentives/IncentivesCard.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { FormattedNumber } from '../primitives/FormattedNumber';
77
import { NoData } from '../primitives/NoData';
88
import {
99
EthenaIncentivesButton,
10+
EtherfiIncentivesButton,
1011
IncentivesButton,
1112
MeritIncentivesButton,
1213
SonicIncentivesButton,
@@ -94,6 +95,7 @@ export const IncentivesCard = ({
9495
protocolAction={protocolAction}
9596
/>
9697
<EthenaIncentivesButton rewardedAsset={address} />
98+
<EtherfiIncentivesButton symbol={symbol} market={market} protocolAction={protocolAction} />
9799
<SonicIncentivesButton rewardedAsset={address} />
98100
</Box>
99101
</Box>

src/hooks/useEtherfiIncentives.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { ProtocolAction } from '@aave/contract-helpers';
2+
3+
import { CustomMarket } from '../ui-config/marketsConfig';
4+
5+
const getetherfiData = (
6+
market: string,
7+
protocolAction: ProtocolAction,
8+
symbol: string
9+
): number | undefined => ETHERFI_DATA_MAP.get(`${market}-${protocolAction}-${symbol}`);
10+
11+
const ETHERFI_DATA_MAP: Map<string, number> = new Map([
12+
[`${CustomMarket.proto_mainnet_v3}-${ProtocolAction.supply}-weETH`, 3],
13+
[`${CustomMarket.proto_etherfi_v3}-${ProtocolAction.supply}-weETH`, 3],
14+
[`${CustomMarket.proto_lido_v3}-${ProtocolAction.supply}-weETH`, 3],
15+
[`${CustomMarket.proto_arbitrum_v3}-${ProtocolAction.supply}-weETH`, 3],
16+
[`${CustomMarket.proto_base_v3}-${ProtocolAction.supply}-weETH`, 3],
17+
[`${CustomMarket.proto_scroll_v3}-${ProtocolAction.supply}-weETH`, 3],
18+
[`${CustomMarket.proto_zksync_v3}-${ProtocolAction.supply}-weETH`, 3],
19+
[`${CustomMarket.proto_linea_v3}-${ProtocolAction.supply}-weETH`, 3],
20+
]);
21+
22+
export const useEtherfiIncentives = (
23+
market: string,
24+
symbol: string,
25+
protocolAction?: ProtocolAction
26+
) => {
27+
if (!market || !protocolAction || !symbol) {
28+
return undefined;
29+
}
30+
31+
return getetherfiData(market, protocolAction, symbol);
32+
};

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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ msgid "Receive (est.)"
2222
msgstr "Receive (est.)"
2323

2424
#: src/components/incentives/EthenaIncentivesTooltipContent.tsx
25+
#: src/components/incentives/EtherfiIncentivesTooltipContent.tsx
2526
#: src/components/incentives/SonicIncentivesTooltipContent.tsx
2627
msgid "Aave Labs does not guarantee the program and accepts no liability."
2728
msgstr "Aave Labs does not guarantee the program and accepts no liability."
@@ -196,6 +197,10 @@ msgstr "Asset cannot be migrated due to supply cap restriction in {marketName} v
196197
msgid "Blocked Address"
197198
msgstr "Blocked Address"
198199

200+
#: src/components/incentives/EtherfiIncentivesTooltipContent.tsx
201+
msgid "This asset is eligible for the Ether.fi Loyalty program with a <0>x{multiplier} multiplier</0>."
202+
msgstr "This asset is eligible for the Ether.fi Loyalty program with a <0>x{multiplier} multiplier</0>."
203+
199204
#: src/modules/governance/GovernanceTopPanel.tsx
200205
msgid "Aave is a fully decentralized, community governed protocol by the AAVE token-holders. AAVE token-holders collectively discuss, propose, and vote on upgrades to the protocol. AAVE token-holders (Ethereum network only) can either vote themselves on new proposals or delagate to an address of choice. To learn more check out the Governance"
201206
msgstr "Aave is a fully decentralized, community governed protocol by the AAVE token-holders. AAVE token-holders collectively discuss, propose, and vote on upgrades to the protocol. AAVE token-holders (Ethereum network only) can either vote themselves on new proposals or delagate to an address of choice. To learn more check out the Governance"
@@ -2738,6 +2743,10 @@ msgstr "Debt"
27382743
msgid "Filter"
27392744
msgstr "Filter"
27402745

2746+
#: src/components/incentives/EtherfiIncentivesTooltipContent.tsx
2747+
msgid "Learn more about the Ether.fi program"
2748+
msgstr "Learn more about the Ether.fi program"
2749+
27412750
#: src/modules/staking/StakingPanel.tsx
27422751
msgid "Cooldown to unstake"
27432752
msgstr "Cooldown to unstake"

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.

0 commit comments

Comments
 (0)