From 70a322f83f5ee33daacb4105af4a87751bf91183 Mon Sep 17 00:00:00 2001 From: roland <62400812+rolandpo@users.noreply.github.com> Date: Wed, 2 Aug 2023 20:29:09 +0200 Subject: [PATCH] stake fixes (#401) --- client/components/vote-escrow/LockupForm.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/client/components/vote-escrow/LockupForm.tsx b/client/components/vote-escrow/LockupForm.tsx index c71049de..12022a9c 100644 --- a/client/components/vote-escrow/LockupForm.tsx +++ b/client/components/vote-escrow/LockupForm.tsx @@ -194,6 +194,7 @@ const LockupForm: FunctionComponent = ({ existingLockup }) => { approvalStatus === "waiting-for-network"; const actionDisabledExistingLockup = + lockupDuration < 1 || lockupDuration <= Math.floor((existingLockup?.end - blockTimestamp) / SECONDS_IN_A_MONTH) || lockupStatus === "waiting-for-user" || @@ -409,7 +410,11 @@ const LockupForm: FunctionComponent = ({ existingLockup }) => { max={formattedOgvBalance} value={lockupAmount} onChange={(e) => { - setLockupAmount(e.target.value); + setLockupAmount( + e.target.value === formattedOgvBalance + ? ethers.utils.formatUnits(balances.ogv.toString()) + : e.target.value + ); }} markers={lockupAmountInputMarkers} onMarkerClick={(markerValue) => { @@ -428,7 +433,7 @@ const LockupForm: FunctionComponent = ({ existingLockup }) => { counterUnit="months" min={"0"} max={maxLockupDurationInMonths} - value={lockupDuration} + value={Number(lockupDuration) >= 0 ? lockupDuration : 0} onChange={(e) => { setLockupDuration(e.target.value); }}