bridge_ui:market warning for wbnb and wsol

Change-Id: I7da1b079a49258ddebb0bd9c7a52d335ee4afe04
This commit is contained in:
Chase Moran 2021-10-13 11:53:48 -04:00
parent 1d1422e416
commit 75c818d2bf
1 changed files with 23 additions and 0 deletions

View File

@ -1,7 +1,9 @@
import { import {
ChainId, ChainId,
CHAIN_ID_BSC,
CHAIN_ID_ETH, CHAIN_ID_ETH,
CHAIN_ID_SOLANA, CHAIN_ID_SOLANA,
WSOL_ADDRESS,
} from "@certusone/wormhole-sdk"; } from "@certusone/wormhole-sdk";
import { getAddress } from "@ethersproject/address"; import { getAddress } from "@ethersproject/address";
import { Alert } from "@material-ui/lab"; import { Alert } from "@material-ui/lab";
@ -10,6 +12,7 @@ import {
ETH_TOKENS_THAT_CAN_BE_SWAPPED_ON_SOLANA, ETH_TOKENS_THAT_CAN_BE_SWAPPED_ON_SOLANA,
ETH_TOKENS_THAT_EXIST_ELSEWHERE, ETH_TOKENS_THAT_EXIST_ELSEWHERE,
SOLANA_TOKENS_THAT_EXIST_ELSEWHERE, SOLANA_TOKENS_THAT_EXIST_ELSEWHERE,
WBNB_ADDRESS,
} from "../../utils/consts"; } from "../../utils/consts";
export default function TokenWarning({ export default function TokenWarning({
@ -36,10 +39,30 @@ export default function TokenWarning({
: undefined, : undefined,
[sourceChain, tokenAddress, symbol] [sourceChain, tokenAddress, symbol]
); );
const marketsWarning = useMemo(() => {
let show = false;
if (sourceChain === CHAIN_ID_SOLANA && tokenAddress === WSOL_ADDRESS) {
show = true;
} else if (sourceChain === CHAIN_ID_BSC && tokenAddress === WBNB_ADDRESS) {
show = true;
}
if (show) {
return `As of 10/13/2021, markets have not been established for ${
symbol ? "Wormhole-wrapped " + symbol : "this token"
}. Please verify this token will be useful on the target chain.`;
} else {
return null;
}
}, [sourceChain, tokenAddress, symbol]);
return tokenConflictingNativeWarning ? ( return tokenConflictingNativeWarning ? (
<Alert severity="warning" variant="outlined"> <Alert severity="warning" variant="outlined">
{tokenConflictingNativeWarning} {tokenConflictingNativeWarning}
</Alert> </Alert>
) : marketsWarning ? (
<Alert severity="warning" variant="outlined">
{marketsWarning}
</Alert>
) : sourceChain === CHAIN_ID_ETH && ) : sourceChain === CHAIN_ID_ETH &&
tokenAddress && tokenAddress &&
getAddress(tokenAddress) === getAddress(tokenAddress) ===