diff --git a/ui/pages/withdraw.tsx b/ui/pages/withdraw.tsx index a288ad63..03eb23c8 100644 --- a/ui/pages/withdraw.tsx +++ b/ui/pages/withdraw.tsx @@ -58,6 +58,18 @@ export default function Withdraw() { !VMOONEYLockLoading && setHasLock(VMOONEYLock && VMOONEYLock[0] != 0) }, [VMOONEYLock, VMOONEYLockLoading, userAddress]) + const [hasMoreThanSixMonths, setHasMoreThanSixMonths] = + useState(false) + const sixMonths = 6 * 30 * 24 * 60 * 60 * 1000 + useEffect(() => { + !VMOONEYLockLoading && + setHasMoreThanSixMonths( + VMOONEYLock && + VMOONEYLock[1] != 0 && + BigNumber.from(+new Date() + sixMonths).lte(VMOONEYLock[1] * 1000) + ) + }, [VMOONEYLock, VMOONEYLockLoading, userAddress]) + const handleWithdraw = async () => { try { await mooneyContract?.call('approve', [ @@ -105,11 +117,13 @@ export default function Withdraw() { > - {userAddress && hasLock ? ( + {userAddress && hasLock && hasMoreThanSixMonths ? ( - Lock MOONEY + {hasLock ? 'Extend Lock' : 'Lock MOONEY'} )}