From 59a276e36be6c87f7c974f0290a7891fe7e2e1bf Mon Sep 17 00:00:00 2001 From: Bill He Date: Wed, 14 Feb 2024 14:51:00 -0800 Subject: [PATCH] Set minimum for CCTP withdraws --- src/constants/numbers.ts | 1 + .../forms/AccountManagementForms/WithdrawForm.tsx | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/constants/numbers.ts b/src/constants/numbers.ts index e515d83..dc6914d 100644 --- a/src/constants/numbers.ts +++ b/src/constants/numbers.ts @@ -22,4 +22,5 @@ export enum NumberSign { // Deposit/Withdraw export const MAX_CCTP_TRANSFER_AMOUNT = 1_000_000; +export const MIN_CCTP_TRANSFER_AMOUNT = 10; export const MAX_PRICE_IMPACT = 0.02; // 2% diff --git a/src/views/forms/AccountManagementForms/WithdrawForm.tsx b/src/views/forms/AccountManagementForms/WithdrawForm.tsx index 33f26ef..58ff137 100644 --- a/src/views/forms/AccountManagementForms/WithdrawForm.tsx +++ b/src/views/forms/AccountManagementForms/WithdrawForm.tsx @@ -11,7 +11,12 @@ import { ButtonSize } from '@/constants/buttons'; import { STRING_KEYS } from '@/constants/localization'; import { ENVIRONMENT_CONFIG_MAP, isMainnet } from '@/constants/networks'; import { TransferNotificationTypes } from '@/constants/notifications'; -import { MAX_CCTP_TRANSFER_AMOUNT, MAX_PRICE_IMPACT, NumberSign } from '@/constants/numbers'; +import { + MAX_CCTP_TRANSFER_AMOUNT, + MAX_PRICE_IMPACT, + MIN_CCTP_TRANSFER_AMOUNT, + NumberSign, +} from '@/constants/numbers'; import { useAccounts, @@ -329,6 +334,12 @@ export const WithdrawForm = () => { }, }); } + if ( + !debouncedAmountBN.isZero() && + MustBigNumber(debouncedAmountBN).lte(MIN_CCTP_TRANSFER_AMOUNT) + ) { + return 'Amount must be greater than 10 USDC'; + } } if (isMainnet && MustBigNumber(summary?.aggregatePriceImpact).gte(MAX_PRICE_IMPACT)) {