diff --git a/components/Modal/Action.tsx b/components/Modal/Action.tsx index f927e2e7..ec8e6b1d 100644 --- a/components/Modal/Action.tsx +++ b/components/Modal/Action.tsx @@ -25,7 +25,13 @@ import { SubmitButton } from "./components"; import getShadowRecords from "../../api/get-shadows"; import { expandToken, shrinkToken } from "../../store"; -export default function Action({ maxBorrowAmount, healthFactor, collateralType, poolAsset }) { +export default function Action({ + maxBorrowAmount, + healthFactor, + collateralType, + poolAsset, + isDisabled, +}) { const [loading, setLoading] = useState(false); const { amount, useAsCollateral, isMax } = useAppSelector(getSelectedValues); const { enable_pyth_oracle } = useAppSelector(getConfig); // TODO33 need query from api? @@ -192,7 +198,7 @@ export default function Action({ maxBorrowAmount, healthFactor, collateralType, return ( diff --git a/components/Modal/index.tsx b/components/Modal/index.tsx index 312e7ef9..151424d3 100644 --- a/components/Modal/index.tsx +++ b/components/Modal/index.tsx @@ -150,6 +150,17 @@ const Modal = () => { const isBtcToken = asset.tokenId === NBTCTokenId && selectedWalletId === "btc-wallet"; const isBtcSupply = action === "Supply" && isBtcToken; const isBtcWithdraw = action === "Withdraw" && isBtcToken; + if (isBtcWithdraw) { + const min_withdraw_amount = 0.00005; + if (new Decimal(amount || 0).lt(min_withdraw_amount)) { + alerts["btcWithdraw"] = { + title: `You must withdraw at least ${min_withdraw_amount} NBTC`, + severity: "error", + }; + } else { + delete alerts.btcWithdraw; + } + } return ( { healthFactor={healthFactor} collateralType={selectedCollateralType} poolAsset={assets[tokenId]} + isDisabled={alerts["btcWithdraw"]} />