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
99 changes: 96 additions & 3 deletions src/components/incentives/MeritIncentivesTooltipContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Trans } from '@lingui/macro';
import { Box, Typography, useTheme } from '@mui/material';
import {
ExtendedReserveIncentiveResponse,
MeritAction,
MeritIncentivesBreakdown,
} from 'src/hooks/useMeritIncentives';

Expand All @@ -11,17 +12,66 @@ import { Row } from '../primitives/Row';
import { TokenIcon } from '../primitives/TokenIcon';
import { getSymbolMap } from './IncentivesTooltipContent';

export enum CampaignType {
SELF_VERIFICATION = 'self_verification',
CELO_STANDARD = 'celo_standard',
STANDARD = 'standard',
}
interface CampaignConfig {
type: CampaignType;
title: string;
hasSpecialContent: boolean;
}

const isCeloAction = (action: MeritAction): boolean => {
return [
MeritAction.CELO_SUPPLY_CELO,
MeritAction.CELO_SUPPLY_USDT,
MeritAction.CELO_SUPPLY_USDC,
MeritAction.CELO_SUPPLY_WETH,
MeritAction.CELO_SUPPLY_MULTIPLE_BORROW_USDT,
MeritAction.CELO_BORROW_CELO,
MeritAction.CELO_BORROW_USDT,
MeritAction.CELO_BORROW_USDC,
MeritAction.CELO_BORROW_WETH,
].includes(action);
};
const isSelfVerificationCampaign = (action: MeritAction): boolean =>
action === MeritAction.CELO_SUPPLY_USDT;

const getCampaignConfig = (action: MeritAction): CampaignConfig => {
if (isSelfVerificationCampaign(action)) {
return {
type: CampaignType.SELF_VERIFICATION,
title: 'Eligible for Merit program and Boosted Yield via Self.',
hasSpecialContent: true,
};
}
if (isCeloAction(action)) {
return {
type: CampaignType.CELO_STANDARD,
title: 'Eligible for Merit program.',
hasSpecialContent: true,
};
}
return {
type: CampaignType.STANDARD,
title: 'Eligible for the Merit program.',
hasSpecialContent: false,
};
};

export const MeritIncentivesTooltipContent = ({
meritIncentives,
}: {
meritIncentives: ExtendedReserveIncentiveResponse & { breakdown?: MeritIncentivesBreakdown };
}) => {
const theme = useTheme();

const typographyVariant = 'secondary12';

const meritIncentivesFormatted = getSymbolMap(meritIncentives);

const campaignConfig = getCampaignConfig(meritIncentives.action);

return (
<Box
sx={{
Expand All @@ -44,7 +94,7 @@ export const MeritIncentivesTooltipContent = ({
/>

<Typography variant="caption" color="text.primary" fontSize={13}>
<Trans>Eligible for the Merit program.</Trans>
<Trans>{campaignConfig.title}</Trans>
</Typography>

<Typography variant="caption" color="text.secondary">
Expand All @@ -66,6 +116,49 @@ export const MeritIncentivesTooltipContent = ({
</Link>
</Typography>

{campaignConfig.type === CampaignType.SELF_VERIFICATION && (
<>
<Typography variant="caption" color="text.secondary">
<Trans>
Supply USDT and double your yield by{' '}
<span>
<Link
href="https://aave.self.xyz/"
sx={{ textDecoration: 'underline' }}
variant="caption"
color="text.secondary"
>
verifying your humanity through Self
</Link>
</span>{' '}
for the first $1,000 USDT supplied per user.
</Trans>{' '}
</Typography>
<Typography variant="caption" color="text.secondary">
<Trans>
Visit{' '}
<span>
<Link
href="https://aave.self.xyz/"
sx={{ textDecoration: 'underline' }}
variant="caption"
color="text.secondary"
>
https://aave.self.xyz/
</Link>
</span>{' '}
to get started with Self’s ZK-powered proof-of-humanity authentication.
</Trans>{' '}
</Typography>
</>
)}
{/* Show if SpecialContent is needed */}
{/* {campaignConfig.type === CampaignType.SELF_VERIFICATION &&
campaignConfig.hasSpecialContent &&
''} */}
{/* Show if SpecialContent is needed */}
{/* {campaignConfig.type === CampaignType.CELO_STANDARD && campaignConfig.hasSpecialContent && ''} */}

{meritIncentives.customMessage ? (
<Typography variant="caption" color="text.secondary">
<Trans>{meritIncentives.customMessage}</Trans>
Expand Down
2 changes: 1 addition & 1 deletion src/locales/el/messages.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/locales/en/messages.js

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions src/locales/en/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -1178,6 +1178,7 @@ msgstr "I confirm the swap with a potential {0}% value loss"
msgid "deposited"
msgstr "deposited"

#: src/components/incentives/MeritIncentivesTooltipContent.tsx
#: src/components/incentives/MeritIncentivesTooltipContent.tsx
#: src/components/incentives/MerklIncentivesTooltipContent.tsx
#: src/components/incentives/MerklIncentivesTooltipContent.tsx
Expand Down Expand Up @@ -1270,6 +1271,10 @@ msgstr "Wallet balance"
msgid "Borrow balance after repay"
msgstr "Borrow balance after repay"

#: src/components/incentives/MeritIncentivesTooltipContent.tsx
msgid "Supply USDT and double your yield by <0><1>verifying your humanity through Self</1></0> for the first $1,000 USDT supplied per user."
msgstr "Supply USDT and double your yield by <0><1>verifying your humanity through Self</1></0> for the first $1,000 USDT supplied per user."

#: src/modules/migration/MigrationLists.tsx
msgid "Supplied assets"
msgstr "Supplied assets"
Expand Down Expand Up @@ -1695,6 +1700,10 @@ msgstr "There are no stake assets configured for this market"
msgid "Proposal details"
msgstr "Proposal details"

#: src/components/incentives/MeritIncentivesTooltipContent.tsx
msgid "Visit <0><1>https://aave.self.xyz/</1></0> to get started with Self’s ZK-powered proof-of-humanity authentication."
msgstr "Visit <0><1>https://aave.self.xyz/</1></0> to get started with Self’s ZK-powered proof-of-humanity authentication."

#: src/ui-config/errorMapping.tsx
msgid "Asset is not listed"
msgstr "Asset is not listed"
Expand Down Expand Up @@ -2185,10 +2194,6 @@ msgstr "Borrow APY, variable"
msgid "This asset is eligible for rewards through SuperFest. Aave Labs does not guarantee the program and accepts no liability."
msgstr "This asset is eligible for rewards through SuperFest. Aave Labs does not guarantee the program and accepts no liability."

#: src/components/incentives/MeritIncentivesTooltipContent.tsx
msgid "Eligible for the Merit program."
msgstr "Eligible for the Merit program."

#: src/components/Warnings/CooldownWarning.tsx
msgid "Cooldown period warning"
msgstr "Cooldown period warning"
Expand Down
2 changes: 1 addition & 1 deletion src/locales/es/messages.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/locales/fr/messages.js

Large diffs are not rendered by default.

Loading