Skip to content

Commit

Permalink
Fix/merit incentives [skip cypress] (#2225)
Browse files Browse the repository at this point in the history
  • Loading branch information
foodaka authored Oct 24, 2024
1 parent 9404b69 commit 4f270b9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
9 changes: 7 additions & 2 deletions src/components/incentives/MeritIncentivesTooltipContent.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ReserveIncentiveResponse } from '@aave/math-utils/dist/esm/formatters/incentive/calculate-reserve-incentives';
import { Trans } from '@lingui/macro';
import { Box, Typography } from '@mui/material';
import { ExtendedReserveIncentiveResponse } from 'src/hooks/useMeritIncentives';

import { FormattedNumber } from '../primitives/FormattedNumber';
import { Link } from '../primitives/Link';
Expand All @@ -11,7 +11,7 @@ import { getSymbolMap } from './IncentivesTooltipContent';
export const MeritIncentivesTooltipContent = ({
meritIncentives,
}: {
meritIncentives: ReserveIncentiveResponse;
meritIncentives: ExtendedReserveIncentiveResponse;
}) => {
const typographyVariant = 'secondary12';

Expand Down Expand Up @@ -57,6 +57,11 @@ export const MeritIncentivesTooltipContent = ({
</Link>
{'.'}
</Typography>
{meritIncentives.customMessage ? (
<Typography variant="caption" color="text.strong" mb={3}>
<Trans>{meritIncentives.customMessage}</Trans>
</Typography>
) : null}

<Box sx={{ width: '100%' }}>
<Row
Expand Down
10 changes: 9 additions & 1 deletion src/hooks/useMeritIncentives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@ type MeritIncentives = {
};
};

export type ExtendedReserveIncentiveResponse = ReserveIncentiveResponse & {
customMessage: string;
};

const url = 'https://apps.aavechan.com/api/merit/aprs';

export type MeritReserveIncentiveData = Omit<ReserveIncentiveResponse, 'incentiveAPR'> & {
action: MeritAction;
protocolAction?: ProtocolAction;
customMessage?: string;
};

const getMeritData = (market: string, symbol: string): MeritReserveIncentiveData | undefined =>
Expand All @@ -38,12 +43,14 @@ const MERIT_DATA_MAP: Record<string, Record<string, MeritReserveIncentiveData>>
rewardTokenAddress: AaveV3Ethereum.ASSETS.USDC.A_TOKEN,
rewardTokenSymbol: 'aEthUSDC',
protocolAction: ProtocolAction.supply,
customMessage: 'You must supply cbBTC and borrow USDC in order to receive merit rewards.',
},
USDC: {
action: MeritAction.SUPPLY_CBBTC_BORROW_USDC,
rewardTokenAddress: AaveV3Ethereum.ASSETS.USDC.A_TOKEN,
rewardTokenSymbol: 'aEthUSDC',
protocolAction: ProtocolAction.borrow,
customMessage: 'You must supply cbBTC and borrow USDC in order to receive merit rewards.',
},
},
};
Expand Down Expand Up @@ -81,7 +88,8 @@ export const useMeritIncentives = ({
incentiveAPR: (APR / 100).toString(),
rewardTokenAddress: meritReserveIncentiveData.rewardTokenAddress,
rewardTokenSymbol: meritReserveIncentiveData.rewardTokenSymbol,
} as ReserveIncentiveResponse;
customMessage: meritReserveIncentiveData.customMessage,
} as ExtendedReserveIncentiveResponse;
},
});
};
8 changes: 3 additions & 5 deletions src/layouts/MainLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@ import { AppHeader } from './AppHeader';
import TopBarNotify from './TopBarNotify';

export function MainLayout({ children }: { children: ReactNode }) {
const APP_BANNER_VERSION = '3.0.0';
const APP_BANNER_VERSION = '4.0.0';

return (
<>
<TopBarNotify
learnMoreLink="/markets/?marketName=proto_zksync_v3"
buttonText="View Market"
notifyText="Aave Governance has deployed a new ZkSync market"
learnMoreLink="/markets/?marketName=proto_mainnet_v3"
notifyText="Merit incentives are available for users who both supply cbBTC and borrow USDC."
bannerVersion={APP_BANNER_VERSION}
icon={'/icons/networks/zksync.svg'}
/>
<AppHeader />
<Box component="main" sx={{ display: 'flex', flexDirection: 'column', flex: 1 }}>
Expand Down
1 change: 1 addition & 0 deletions src/locales/en/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -3467,6 +3467,7 @@ msgid "withdrew"
msgstr "withdrew"

#: src/components/MarketSwitcher.tsx
#: src/components/incentives/MeritIncentivesTooltipContent.tsx
#: src/components/transactions/DelegationTxsWrapper.tsx
#: src/components/transactions/DelegationTxsWrapper.tsx
#: src/components/transactions/DelegationTxsWrapper.tsx
Expand Down

4 comments on commit 4f270b9

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was deployed on ipfs

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was deployed on ipfs

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was deployed on ipfs

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was deployed on ipfs

Please sign in to comment.