From 499cf72e05b237b055b41d4af86017af2947142e Mon Sep 17 00:00:00 2001 From: rolandpo Date: Fri, 28 Jul 2023 14:11:50 +0200 Subject: [PATCH] stake fixes --- 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); }}