Skip to content

Commit

Permalink
Merge pull request #134 from axelarnetwork/fix/disable-OP-send
Browse files Browse the repository at this point in the history
chore: restrict send function for OP token from optimism
  • Loading branch information
canhtrinh authored Jan 14, 2024
2 parents 5a9e73c + 8e218f5 commit 45aad90
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
10 changes: 10 additions & 0 deletions apps/maestro/src/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,13 @@ export const NEXT_PUBLIC_DISABLED_WALLET_IDS = Maybe.of(
)
.map(split(","))
.mapOr([], map(trim));

export const shouldDisableSend = (
axelarChainId: string,
tokenAddress: `0x${string}`
) => {
const shouldDisable: Record<string, Record<`0x${string}`, boolean>> = {
optimism: { "0x4200000000000000000000000000000000000042": true },
};
return shouldDisable[axelarChainId]?.[tokenAddress];
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import Link from "next/link";
import { TransactionExecutionError } from "viem";
import { useAccount, useChainId, useSwitchNetwork } from "wagmi";

import { shouldDisableSend } from "~/config/env";
import { useInterchainTokenBalanceForOwnerQuery } from "~/services/interchainToken/hooks";
import BigNumberText from "~/ui/components/BigNumberText";
import { ChainIcon } from "~/ui/components/EVMChainsDropdown";
Expand Down Expand Up @@ -233,7 +234,13 @@ export const RegisteredInterchainTokenCard: FC<Props> = (props) => {
size="xs"
variant="primary"
className="absolute right-6"
disabled={!props.hasRemoteTokens}
disabled={
!props.hasRemoteTokens ||
shouldDisableSend(
props.axelarChainId,
props.tokenAddress
)
}
>
Transfer
</Button>
Expand Down
1 change: 1 addition & 0 deletions apps/maestro/src/features/InterchainTokenList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { ExtendedWagmiChainConfig } from "~/config/wagmi";
type Kind = "canonical" | "interchain";

export type TokenInfo = {
axelarChainId: string;
chainId: number;
isRegistered: boolean;
isOriginToken: boolean;
Expand Down

2 comments on commit 45aad90

@vercel
Copy link

@vercel vercel bot commented on 45aad90 Jan 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

axelar-ui – ./packages/ui

axelar-ui-git-main-axelar-network.vercel.app
axelar-ui.vercel.app
ui.axelar.dev
axelar-ui-axelar-network.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 45aad90 Jan 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

axelar-registry – ./apps/registry

axelar-registry-axelar-network.vercel.app
axelar-registry-git-main-axelar-network.vercel.app

Please sign in to comment.