bridge_ui: Block transfers of aUSD from Karura

This commit is contained in:
Kevin Peters 2022-06-03 12:50:55 +02:00 committed by Evan Gray
parent cf8c97082b
commit ff9f200fb5
2 changed files with 22 additions and 1 deletions

View File

@ -26,7 +26,11 @@ import useMarketsMap from "../../hooks/useMarketsMap";
import { NFTParsedTokenAccount } from "../../store/nftSlice";
import { selectTransferTargetChain } from "../../store/selectors";
import { balancePretty } from "../../utils/balancePretty";
import { AVAILABLE_MARKETS_URL, CHAINS_BY_ID } from "../../utils/consts";
import {
AVAILABLE_MARKETS_URL,
CHAINS_BY_ID,
getIsTokenTransferDisabled,
} from "../../utils/consts";
import { shortenAddress } from "../../utils/solana";
import NFTViewer from "./NFTViewer";
@ -556,6 +560,10 @@ export default function TokenPicker({
option.mintKey +
(option.tokenId || "")
}
disabled={getIsTokenTransferDisabled(
chainId,
option.mintKey
)}
>
<RenderOption account={option} />
</ListItem>
@ -580,6 +588,7 @@ export default function TokenPicker({
key={
option.publicKey + option.mintKey + (option.tokenId || "")
}
disabled={getIsTokenTransferDisabled(chainId, option.mintKey)}
>
<RenderOption account={option} />
</ListItem>

View File

@ -1456,3 +1456,15 @@ export const COLOR_BY_CHAIN_ID: { [key in ChainId]?: string } = {
[CHAIN_ID_KARURA]: "#FF4B3B",
[CHAIN_ID_ACALA]: "#E00F51",
};
export const DISABLED_TOKEN_TRANSFERS: { [key in ChainId]?: string[] } = {
[CHAIN_ID_KARURA]: [
"0x0000000000000000000100000000000000000081", // aUSD
],
};
export const getIsTokenTransferDisabled = (
chainId: ChainId,
tokenAddress: string
) => {
return !!DISABLED_TOKEN_TRANSFERS[chainId]?.includes(tokenAddress);
};