From 41996839a4d0cccc2eb90b20aeb97902405c42a0 Mon Sep 17 00:00:00 2001 From: wraeth-eth <104132113+wraeth-eth@users.noreply.github.com> Date: Fri, 1 Nov 2024 16:51:34 +1100 Subject: [PATCH] Allow transfer of unclaimed tokens for projects with no erc20 (#4492) --- .../ProjectDashboard/hooks/useUnclaimedTokenBalance.ts | 9 +++++---- .../useBalanceMenuItemsUserFlags.ts | 7 +++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/packages/v2v3/components/V2V3Project/ProjectDashboard/hooks/useUnclaimedTokenBalance.ts b/src/packages/v2v3/components/V2V3Project/ProjectDashboard/hooks/useUnclaimedTokenBalance.ts index edfec86d9d..9ae20bbdf5 100644 --- a/src/packages/v2v3/components/V2V3Project/ProjectDashboard/hooks/useUnclaimedTokenBalance.ts +++ b/src/packages/v2v3/components/V2V3Project/ProjectDashboard/hooks/useUnclaimedTokenBalance.ts @@ -12,12 +12,13 @@ export const useUnclaimedTokenBalance = () => { const { data: claimedBalance } = useERC20BalanceOf(tokenAddress, userAddress) const { data: totalBalance } = useTotalBalanceOf(userAddress, projectId) - if ( - typeof claimedBalance === 'undefined' || - typeof totalBalance === 'undefined' - ) { + if (typeof totalBalance === 'undefined') { return undefined } + if (typeof claimedBalance === 'undefined') { + return totalBalance + } + return totalBalance.sub(claimedBalance) } diff --git a/src/packages/v2v3/components/V2V3Project/ProjectDashboard/hooks/useYourBalanceMenuItems/useBalanceMenuItemsUserFlags.ts b/src/packages/v2v3/components/V2V3Project/ProjectDashboard/hooks/useYourBalanceMenuItems/useBalanceMenuItemsUserFlags.ts index 5d315a4305..48653d41db 100644 --- a/src/packages/v2v3/components/V2V3Project/ProjectDashboard/hooks/useYourBalanceMenuItems/useBalanceMenuItemsUserFlags.ts +++ b/src/packages/v2v3/components/V2V3Project/ProjectDashboard/hooks/useYourBalanceMenuItems/useBalanceMenuItemsUserFlags.ts @@ -47,8 +47,11 @@ export const useBalanceMenuItemsUserFlags = () => { ) const canTransferTokens = useMemo( - () => !!unclaimedTokenBalance?.gt(0) || isDev, - [unclaimedTokenBalance, isDev], + () => + (!!unclaimedTokenBalance?.gt(0) && + !fundingCycleMetadata?.global.pauseTransfers) || + isDev, + [unclaimedTokenBalance, fundingCycleMetadata?.global.pauseTransfers, isDev], ) return {