Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/sonic rewards [skip cypress] #2381

Merged
merged 7 commits into from
Mar 3, 2025
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"dependencies": {
"@aave/contract-helpers": "1.32.1",
"@aave/math-utils": "1.32.1",
"@bgd-labs/aave-address-book": "4.13.1",
"@bgd-labs/aave-address-book": "4.14.0",
"@emotion/cache": "11.10.3",
"@emotion/react": "11.10.4",
"@emotion/server": "latest",
Expand Down
28 changes: 25 additions & 3 deletions src/components/incentives/IncentivesButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Box, SvgIcon, Typography } from '@mui/material';
import { useState } from 'react';
import { useEthenaIncentives } from 'src/hooks/useEthenaIncentives';
import { useMeritIncentives } from 'src/hooks/useMeritIncentives';
import { useSonicIncentives } from 'src/hooks/useSonicIncentives';
import { useZkSyncIgniteIncentives } from 'src/hooks/useZkSyncIgniteIncentives';
import { useRootStore } from 'src/store/root';
import { DASHBOARD } from 'src/utils/mixPanelEvents';
Expand All @@ -16,6 +17,7 @@ import { TokenIcon } from '../primitives/TokenIcon';
import { EthenaAirdropTooltipContent } from './EthenaIncentivesTooltipContent';
import { getSymbolMap, IncentivesTooltipContent } from './IncentivesTooltipContent';
import { MeritIncentivesTooltipContent } from './MeritIncentivesTooltipContent';
import { SonicAirdropTooltipContent } from './SonicIncentivesTooltipContent';
import { ZkSyncIgniteIncentivesTooltipContent } from './ZkSyncIgniteIncentivesTooltipContent';

interface IncentivesButtonProps {
Expand Down Expand Up @@ -109,7 +111,27 @@ export const EthenaIncentivesButton = ({ rewardedAsset }: { rewardedAsset?: stri
setOpen={setOpen}
open={open}
>
<ContentEthenaButton points={points} />
<ContentPointsButton points={points} icon={'/icons/other/ethena.svg'} />
</ContentWithTooltip>
);
};

export const SonicIncentivesButton = ({ rewardedAsset }: { rewardedAsset?: string }) => {
const [open, setOpen] = useState(false);
const points = useSonicIncentives(rewardedAsset);

if (!points) {
return null;
}

return (
<ContentWithTooltip
tooltipContent={<SonicAirdropTooltipContent points={points} />}
withoutHover
setOpen={setOpen}
open={open}
>
<ContentPointsButton points={points} icon={'/icons/networks/sonic.svg'} />
</ContentWithTooltip>
);
};
Expand Down Expand Up @@ -294,7 +316,7 @@ const Content = ({
);
};

const ContentEthenaButton = ({ points }: { points: number }) => {
const ContentPointsButton = ({ points, icon }: { points: number; icon: string }) => {
const [open, setOpen] = useState(false);
const trackEvent = useRootStore((store) => store.trackEvent);

Expand Down Expand Up @@ -326,7 +348,7 @@ const ContentEthenaButton = ({ points }: { points: number }) => {
</Typography>
</Box>
<Box sx={{ display: 'inline-flex' }}>
<img src={'/icons/other/ethena.svg'} width={12} height={12} alt="ethena-icon" />
<img src={icon} width={12} height={12} alt="ethena-icon" />
</Box>
</Box>
);
Expand Down
2 changes: 2 additions & 0 deletions src/components/incentives/IncentivesCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
EthenaIncentivesButton,
IncentivesButton,
MeritIncentivesButton,
SonicIncentivesButton,
ZkIgniteIncentivesButton,
} from './IncentivesButton';

Expand Down Expand Up @@ -87,6 +88,7 @@ export const IncentivesCard = ({
protocolAction={protocolAction}
/>
<EthenaIncentivesButton rewardedAsset={address} />
<SonicIncentivesButton rewardedAsset={address} />
</Box>
</Box>
);
Expand Down
29 changes: 29 additions & 0 deletions src/components/incentives/SonicIncentivesTooltipContent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Trans } from '@lingui/macro';
import { Box } from '@mui/material';

import { Link } from '../primitives/Link';

export const SonicAirdropTooltipContent = ({ points }: { points: number }) => {
return (
<Box>
<Trans>{`This asset is eligible for ${(<b>{points}x</b>)} Sonic Rewards.\n`}</Trans>
<br />
<Trans>{'Learn more about Sonic Rewards program'}</Trans>{' '}
<Link
href="https://blog.soniclabs.com/sonic-points-simplified-how-to-qualify-for-200-million-s-airdrop/"
sx={{ textDecoration: 'underline' }}
variant="caption"
color="text.secondary"
>
{'here'}
</Link>
{'.'}
<br />
<br />
<Trans>
{`Aave Labs does not
guarantee the program and accepts no liability.\n`}
</Trans>
</Box>
);
};
17 changes: 17 additions & 0 deletions src/hooks/useSonicIncentives.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// import { AaveV3Sonic } from '@bgd-labs/aave-address-book';

const getSonicData = (assetAddress: string): number | undefined => SONIC_DATA_MAP.get(assetAddress);

const SONIC_DATA_MAP: Map<string, number> = new Map([
['0xe18Ab82c81E7Eecff32B8A82B1b7d2d23F1EcE96', 4], //AaveV3Sonic.ASSETS.WETH.A_TOKEN
['0x578Ee1ca3a8E1b54554Da1Bf7C583506C4CD11c6', 10], // AaveV3Sonic.ASSETS.USDC.e.A_TOKEN
['0x6C5E14A212c1C3e4Baf6f871ac9B1a969918c131', 8], // AaveV3Sonic.ASSETS.ws.A_TOKEN
]);

export const useSonicIncentives = (rewardedAsset?: string) => {
if (!rewardedAsset) {
return undefined;
}

return getSonicData(rewardedAsset);
};
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.

9 changes: 9 additions & 0 deletions src/locales/en/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ msgid "Receive (est.)"
msgstr "Receive (est.)"

#: src/components/incentives/EthenaIncentivesTooltipContent.tsx
#: src/components/incentives/SonicIncentivesTooltipContent.tsx
msgid "Aave Labs does not guarantee the program and accepts no liability."
msgstr "Aave Labs does not guarantee the program and accepts no liability."

Expand Down Expand Up @@ -481,6 +482,10 @@ msgstr "Borrowing is unavailable because you’re using Isolation mode. To manag
msgid "Share on Lens"
msgstr "Share on Lens"

#: src/components/incentives/SonicIncentivesTooltipContent.tsx
msgid "Learn more about Sonic Rewards program"
msgstr "Learn more about Sonic Rewards program"

#: src/components/transactions/ClaimRewards/ClaimRewardsActions.tsx
msgid "Claim all"
msgstr "Claim all"
Expand Down Expand Up @@ -3251,6 +3256,10 @@ msgstr "With testnet Faucet you can get free assets to test the Aave Protocol. M
msgid "Get ABP v2 Token"
msgstr "Get ABP v2 Token"

#: src/components/incentives/SonicIncentivesTooltipContent.tsx
msgid "This asset is eligible for {0} Sonic Rewards."
msgstr "This asset is eligible for {0} Sonic Rewards."

#: pages/staking.staking.tsx
msgid "As a result of governance decisions, this ABPT staking pool is now deprecated. You have the flexibility to either migrate all of your tokens to v2 or unstake them without any cooldown period."
msgstr "As a result of governance decisions, this ABPT staking pool is now deprecated. You have the flexibility to either migrate all of your tokens to v2 or unstake them without any cooldown period."
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.

8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1066,10 +1066,10 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==

"@bgd-labs/aave-address-book@4.13.1":
version "4.13.1"
resolved "https://registry.yarnpkg.com/@bgd-labs/aave-address-book/-/aave-address-book-4.13.1.tgz#7ac9e148d0d4c4ab16c83e7eedafc62bbfbebc08"
integrity sha512-ssg586aumbC2j4ZDfe0xgaX8KJgtrK3BocSNJVtgtPsbtnCBkPNT+ogUsBp8uNHF8lfCGkZ92rzHgwlFOf2YfQ==
"@bgd-labs/aave-address-book@4.14.0":
version "4.14.0"
resolved "https://registry.yarnpkg.com/@bgd-labs/aave-address-book/-/aave-address-book-4.14.0.tgz#5f639e1e46c6a6544d6d0d83042278c5ab38e107"
integrity sha512-jm8EgsvL9hiPWsbsKh9J1XYi+0kVZ6FxBRmTj19YHJmR1VovQ7Fup9c3NwKtqetf65gsS7MV5TNAM0sJNsnRcg==

"@coinbase/[email protected]":
version "4.2.3"
Expand Down
Loading