-
Notifications
You must be signed in to change notification settings - Fork 375
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: refactor frozen warnings #1141
Changes from all commits
a9e1c77
0d6b55b
60c4ae9
b0c88b2
2653398
7fd177a
6172cc9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { ExclamationIcon } from '@heroicons/react/outline'; | ||
import { Trans } from '@lingui/macro'; | ||
import { Box, SvgIcon } from '@mui/material'; | ||
|
||
import { ContentWithTooltip } from '../ContentWithTooltip'; | ||
import { Link } from '../primitives/Link'; | ||
import { frozenProposalMap } from '../../utils/marketsAndNetworksConfig'; | ||
|
||
interface FrozenTooltipProps { | ||
symbol?: string; | ||
currentMarket?: string; | ||
} | ||
|
||
export const getFrozenProposalLink = ( | ||
symbol: string | undefined, | ||
currentMarket: string | undefined | ||
): string => { | ||
if (currentMarket && currentMarket === 'proto_harmony_v3') { | ||
return 'https://snapshot.org/#/aave.eth/proposal/0x81a78109941e5e0ac6cb5ebf82597c839c20ad6821a8c3ff063dba39032533d4'; | ||
} else if (currentMarket && currentMarket === 'proto_fantom_v3') { | ||
return 'https://snapshot.org/#/aave.eth/proposal/0xeefcd76e523391a14cfd0a79b531ea0a3faf0eb4a058e255fac13a2d224cc647'; | ||
} else if (symbol && frozenProposalMap[symbol]) { | ||
return frozenProposalMap[symbol]; | ||
} else { | ||
return 'https://app.aave.com/governance'; | ||
} | ||
}; | ||
|
||
export const FrozenTooltip = ({ symbol, currentMarket }: FrozenTooltipProps) => { | ||
return ( | ||
<ContentWithTooltip | ||
tooltipContent={ | ||
<Box> | ||
<Trans> | ||
This asset is frozen due to an Aave Protocol Governance decision.{' '} | ||
<Link | ||
href={getFrozenProposalLink(symbol, currentMarket)} | ||
sx={{ textDecoration: 'underline' }} | ||
> | ||
<Trans>More details</Trans> | ||
</Link> | ||
</Trans> | ||
</Box> | ||
} | ||
> | ||
<SvgIcon sx={{ fontSize: '20px', color: 'error.main', ml: 2 }}> | ||
<ExclamationIcon /> | ||
</SvgIcon> | ||
</ContentWithTooltip> | ||
); | ||
}; |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,6 @@ import { | |
} from '../FlowCommons/TxModalDetails'; | ||
import { AAVEWarning } from '../Warnings/AAVEWarning'; | ||
import { AMPLWarning } from '../Warnings/AMPLWarning'; | ||
import { HarmonyWarning } from '../Warnings/HarmonyWarning'; | ||
import { IsolationModeWarning } from '../Warnings/IsolationModeWarning'; | ||
import { SNXWarning } from '../Warnings/SNXWarning'; | ||
import { SupplyActions } from './SupplyActions'; | ||
|
@@ -217,7 +216,6 @@ export const SupplyModalContent = ({ | |
poolReserve.symbol === 'AAVE' && | ||
isFeatureEnabled.staking(currentMarketData) && <AAVEWarning />} | ||
{poolReserve.symbol === 'SNX' && !maxAmountToSupply.eq('0') && <SNXWarning />} | ||
{currentNetworkConfig.name === 'Harmony' && <HarmonyWarning learnMore={true} />} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This warning is unnecessary since supply is disabled when market is frozen |
||
|
||
<AssetInput | ||
value={amount} | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { Trans } from '@lingui/macro'; | ||
import { Link, Typography } from '@mui/material'; | ||
|
||
import { Warning } from '../../primitives/Warning'; | ||
|
||
const WarningMessage = ({ market }: { market: string }) => { | ||
if (market === 'Harmony') { | ||
return ( | ||
<Trans> | ||
Due to the Horizon bridge exploit, certain assets on the Harmony network are not at parity | ||
with Ethereum, which affects the Aave V3 Harmony market. | ||
</Trans> | ||
); | ||
} else if (market === 'Fantom') { | ||
return <Trans>Per the community, the Fantom market has been frozen.</Trans>; | ||
} else { | ||
return <></>; | ||
} | ||
}; | ||
|
||
const getLink = (market: string, forum: boolean | undefined): string => { | ||
if (market === 'Harmony') { | ||
if (forum) { | ||
return 'https://governance.aave.com/t/harmony-horizon-bridge-exploit-consequences-to-aave-v3-harmony/8614'; | ||
} else { | ||
return 'https://snapshot.org/#/aave.eth/proposal/0x81a78109941e5e0ac6cb5ebf82597c839c20ad6821a8c3ff063dba39032533d4'; | ||
} | ||
} else if (market === 'Fantom') { | ||
if (forum) { | ||
return 'https://governance.aave.com/t/arc-aave-v3-fantom-freeze-reserves/9166'; | ||
} else { | ||
return 'https://snapshot.org/#/aave.eth/proposal/0xeefcd76e523391a14cfd0a79b531ea0a3faf0eb4a058e255fac13a2d224cc647'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly. I think we should create a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also will be covered in other comment ^ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Once we get that file setup, we could setup a mapping of market name to proposal info. Then I think in the asset list components we wouldn't need to do any checking of market name, we just look up in the mapping by market name, if it's empty don't render. Could help clean up some of those if statements in the other pages. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this idea |
||
} | ||
} else { | ||
return ''; | ||
} | ||
}; | ||
|
||
interface MarketWarningProps { | ||
marketName: string; | ||
forum?: boolean; | ||
} | ||
|
||
export const MarketWarning = ({ marketName, forum }: MarketWarningProps) => { | ||
return ( | ||
<Warning severity="error"> | ||
<Typography variant="caption"> | ||
<WarningMessage market={marketName} />{' '} | ||
<Link href={getLink(marketName, forum)} target="_blank"> | ||
{forum ? <Trans>Join the community discussion</Trans> : <Trans>Learn more</Trans>} | ||
</Link> | ||
</Typography> | ||
</Warning> | ||
); | ||
}; |
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small optimization if you wanted to, you could assign the baseUrl to a var for DRY
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now I'll just keep it as is, but I opened aave/aave-utilities#419 to create an enum so we don't have to hardcode the market names, and we can move these links to a separate config (either in utilities or interface) as well when this is added.