Skip to content

Commit

Permalink
Merge pull request #155 from curvefi/task/synthetix-pools-warning
Browse files Browse the repository at this point in the history
task: add synthetix alert
  • Loading branch information
amytsang committed Apr 24, 2024
2 parents e3c0295 + 272b84e commit 3d9c2ad
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 13 deletions.
2 changes: 1 addition & 1 deletion apps/loan/src/components/CollateralLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const CollateralLabel = ({ className, chainId, isVisible, collateralData, tableL
<div>
<Box flex flexAlignItems="center">
{collateralAlert?.isDeprecated && (
<AlertTooltipIcon placement="start" {...collateralAlert}>
<AlertTooltipIcon minWidth="300px" placement="start" {...collateralAlert}>
{collateralAlert.message}
</AlertTooltipIcon>
)}
Expand Down
47 changes: 35 additions & 12 deletions apps/main/src/components/PoolLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import usePoolAlert from '@/hooks/usePoolAlert'
import useTokenAlert from '@/hooks/useTokenAlert'

import { Chip } from '@/ui/Typography'
import AlertBox from '@/ui/AlertBox'
import AlertTooltipIcon from '@/ui/Tooltip/TooltipAlert'
import Box from '@/ui/Box'
import ChipPool from '@/components/ChipPool'
Expand Down Expand Up @@ -72,7 +73,7 @@ const PoolLabel = ({
/>
)}
</IconsWrapper>
<div>
<Box fillWidth>
<PoolTypeWrapper>
<TableCellReferenceAsset
isCrypto={poolData?.pool?.isCrypto}
Expand All @@ -82,15 +83,20 @@ const PoolLabel = ({
</PoolTypeWrapper>

<Box flex flexAlignItems="center">
{poolAlert && poolAlert.isInformationOnly ? (
<AlertTooltipIcon placement="start" {...poolAlert}>
{poolAlert.message}
</AlertTooltipIcon>
) : tokenAlert ? (
<AlertTooltipIcon minWidth="300px" placement="start" {...tokenAlert}>
{tokenAlert.message}
</AlertTooltipIcon>
) : null}
{!isMobile && (
<>
{poolAlert?.isInformationOnly && (
<AlertTooltipIcon minWidth="300px" placement="start" {...poolAlert}>
{poolAlert.message}
</AlertTooltipIcon>
)}
{tokenAlert && (
<AlertTooltipIcon minWidth="300px" placement="start" {...tokenAlert}>
{tokenAlert.message}
</AlertTooltipIcon>
)}
</>
)}
{pool && (
<ChipPool
isHighlightPoolName={isHighlightPoolName}
Expand Down Expand Up @@ -134,9 +140,19 @@ const PoolLabel = ({
)}
</PoolLabelTokensWrapper>
{quickViewValue && <Chip>{quickViewValue}</Chip>}
</div>
</Box>
</Wrapper>
{poolAlert && !poolAlert.isInformationOnly && <Box padding="0.5rem 0 0 0">{poolAlert.message}</Box>}

{tokenAlert && isMobile && <StyledAlertBox alertType={tokenAlert.alertType}>{tokenAlert.message}</StyledAlertBox>}
{poolAlert && (
<>
{!poolAlert.isInformationOnly ? (
<Box padding="0.5rem 0 0 0">{poolAlert.message}</Box>
) : isMobile ? (
<StyledAlertBox alertType={poolAlert.alertType}>{poolAlert.message}</StyledAlertBox>
) : null}
</>
)}
</div>
)
}
Expand Down Expand Up @@ -170,4 +186,11 @@ const TokenLabel = styled.span`
font-size: var(--font-size-2);
`

const StyledAlertBox = styled(AlertBox)`
font-size: var(--font-size-2);
margin: var(--spacing-2) 0;
max-height: 100px;
overflow: scroll;
`

export default PoolLabel
40 changes: 40 additions & 0 deletions apps/main/src/hooks/usePoolAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import useStore from '@/store/useStore'

import { RCCrossCurve } from '@/ui/images'
import { ExternalLink, InternalLink } from '@/ui/Link'
import Box from '@/ui/Box'
import PoolAlertCustomMessage from '@/components/PoolAlertCustomMessage'

const usePoolAlert = (poolAddress: string | undefined, hasVyperVulnerability: boolean | undefined) => {
Expand Down Expand Up @@ -76,6 +77,36 @@ const usePoolAlert = (poolAddress: string | undefined, hasVyperVulnerability: bo
),
}
}
const synthetixAlert = (): PoolAlert => ({
alertType: 'warning',
isInformationOnly: true,
isCloseOnTooltipOnly: true,
minWidth: '350px',
message: (
<MessageWrapper>
<Box grid gridGap={2}>
<p>
Please note that exchanges on synthetix synths are expected to be disabled and users can either withdraw
liquidity from the underlying token, or redeem their synths to sUSD on{' '}
<ExternalLink $noStyles href="https://staking.synthetix.io/wallet/balances/">
https://staking.synthetix.io/wallet/balances/
</ExternalLink>
</p>
<p>
Users are encouraged to exit the pools in order to avoid getting their holdings&lsquo; value diluted with
the discountRate For more information please refer to{' '}
<ExternalLink
$noStyles
href="https://gov.curve.fi/t/kill-gauges-on-all-non-susd-curve-pools-on-ethereum/10033/2"
>
https://gov.curve.fi/t/kill-gauges-on-all-non-susd-curve-pools-on-ethereum/10033/2
</ExternalLink>
</p>
<p>Please note that sUSD is not involved, so these would be on the other pools sETH, sBTC, sForex ...</p>
</Box>
</MessageWrapper>
),
})

// Fantom networks
const crossCurveAlert = (externalLinks: { label: string; url: string }[]): PoolAlert => ({
Expand Down Expand Up @@ -138,6 +169,15 @@ const usePoolAlert = (poolAddress: string | undefined, hasVyperVulnerability: bo
'0x68934f60758243eafaf4d2cfed27bf8010bede3a': zunamiAlert(),
'0x0fa949783947bf6c1b171db13aeacbb488845b3f': geistFinanceAlert(),
'0xc2d54ffb8a61e146110d2fbdd03b12467fe155ac': yPrismaAlert(),
'0xf253f83aca21aabd2a20553ae0bf7f65c755a07f': synthetixAlert(),
'0x7fc77b5c7614e1533320ea6ddc2eb61fa00a9714': synthetixAlert(),
'0xc5424b857f758e906013f3555dad202e4bdb4567': synthetixAlert(),
'0x0ce6a5ff5217e38315f87032cf90686c96627caa': synthetixAlert(),
'0x9c2c8910f113181783c249d8f6aa41b51cde0f0c': synthetixAlert(),
'0x8461a004b50d321cb22b7d034969ce6803911899': synthetixAlert(),
'0x19b080fe1ffa0553469d20ca36219f17fcf03859': synthetixAlert(),
'0x8818a9bb44fbf33502be7c15c500d0c783b73067': synthetixAlert(),
'0x3f1b0278a9ee595635b61817630cc19de792f506': synthetixAlert(),
// arbitrum
'0x960ea3e3c7fb317332d990873d354e18d7645590': possibleVyperExploitedAlert(), // tricrypto
}
Expand Down

0 comments on commit 3d9c2ad

Please sign in to comment.