bridge_ui: Warn when transferring shuttle wrapped tokens from Polygon

This commit is contained in:
Kevin Peters 2021-12-24 15:21:40 +00:00 committed by Evan Gray
parent 2b00826847
commit 4ec81b48da
2 changed files with 29 additions and 1 deletions

View File

@ -1,10 +1,17 @@
import { ChainId, CHAIN_ID_ETH, isEVMChain } from "@certusone/wormhole-sdk"; import {
ChainId,
CHAIN_ID_ETH,
CHAIN_ID_POLYGON,
CHAIN_ID_TERRA,
isEVMChain,
} from "@certusone/wormhole-sdk";
import { Box, Link, makeStyles, Typography } from "@material-ui/core"; import { Box, Link, makeStyles, Typography } from "@material-ui/core";
import { Alert } from "@material-ui/lab"; import { Alert } from "@material-ui/lab";
import { import {
AVAILABLE_MARKETS_URL, AVAILABLE_MARKETS_URL,
CHAINS_BY_ID, CHAINS_BY_ID,
MULTI_CHAIN_TOKENS, MULTI_CHAIN_TOKENS,
POLYGON_TERRA_WRAPPED_TOKENS,
} from "../../utils/consts"; } from "../../utils/consts";
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
@ -14,6 +21,7 @@ const useStyles = makeStyles((theme) => ({
}, },
alert: { alert: {
textAlign: "center", textAlign: "center",
marginTop: theme.spacing(2),
}, },
line: { line: {
marginBottom: theme.spacing(2), marginBottom: theme.spacing(2),
@ -84,6 +92,17 @@ function RewardsWarning() {
); );
} }
function PolygonTerraWrappedWarning() {
const classes = useStyles();
return (
<Alert severity="warning" variant="outlined" className={classes.alert}>
Transferring Shuttle wrapped tokens from Polygon will result in double
wrapped (Wormhole wrapped Shuttle wrapped) tokens. There are no liquid
markets for these tokens.
</Alert>
);
}
export default function TokenWarning({ export default function TokenWarning({
sourceChain, sourceChain,
sourceAsset, sourceAsset,
@ -117,6 +136,9 @@ export default function TokenWarning({
const showMultiChainWarning = isMultiChain && isWormholeWrapped; const showMultiChainWarning = isMultiChain && isWormholeWrapped;
const showWrappedWarning = !isMultiChain && isWormholeWrapped; //Multichain warning is more important const showWrappedWarning = !isMultiChain && isWormholeWrapped; //Multichain warning is more important
const showRewardsWarning = isRewardsToken; const showRewardsWarning = isRewardsToken;
const showPolygonTerraWrappedWarning =
sourceChain === CHAIN_ID_POLYGON &&
POLYGON_TERRA_WRAPPED_TOKENS.includes(searchableAddress);
return ( return (
<> <>
@ -128,6 +150,7 @@ export default function TokenWarning({
) : null} ) : null}
{showWrappedWarning ? <WormholeWrappedWarning /> : null} {showWrappedWarning ? <WormholeWrappedWarning /> : null}
{showRewardsWarning ? <RewardsWarning /> : null} {showRewardsWarning ? <RewardsWarning /> : null}
{showPolygonTerraWrappedWarning ? <PolygonTerraWrappedWarning /> : null}
</> </>
); );
} }

View File

@ -893,3 +893,8 @@ export const getHowToAddToTokenListUrl = (chainId: ChainId) => {
export const SOLANA_TOKEN_METADATA_PROGRAM_URL = export const SOLANA_TOKEN_METADATA_PROGRAM_URL =
"https://github.com/metaplex-foundation/metaplex/tree/master/rust/token-metadata/program"; "https://github.com/metaplex-foundation/metaplex/tree/master/rust/token-metadata/program";
export const MAX_VAA_UPLOAD_RETRIES_SOLANA = 5; export const MAX_VAA_UPLOAD_RETRIES_SOLANA = 5;
export const POLYGON_TERRA_WRAPPED_TOKENS = [
"0x692597b009d13c4049a947cab2239b7d6517875f", // Wrapped UST Token
"0x24834bbec7e39ef42f4a75eaf8e5b6486d3f0e57", // Wrapped LUNA Token
];