From ce6e0a504fde49b5d82ea9cde367b234b8a3ca74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Santana=20Gon=C3=A7alves?= Date: Tue, 12 Nov 2024 19:46:10 -0300 Subject: [PATCH] check for stRIF balance --- src/app/user/Delegation/DelegationSection.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/user/Delegation/DelegationSection.tsx b/src/app/user/Delegation/DelegationSection.tsx index 87a9777c..406ac7a4 100644 --- a/src/app/user/Delegation/DelegationSection.tsx +++ b/src/app/user/Delegation/DelegationSection.tsx @@ -13,13 +13,16 @@ import { useAccount } from 'wagmi' import { RenderTotalBalance } from '../Balances/RenderTotalBalance' import { BalancesProvider } from '../Balances/context/BalancesContext' import { useGetDelegates } from './hooks/useGetDelegates' -import { ZeroAddress } from 'ethers' import { ReclaimCell } from './ReclaimCell' import { DelegationAction } from './type' +import { useGetAddressBalances } from '../Balances/hooks/useGetAddressBalances' export const DelegationSection = () => { const { address } = useAccount() const { delegateeAddress } = useGetDelegates(address) + const { + stRIF: { balance: stRIFBalance }, + } = useGetAddressBalances() const [isDelegateModalOpened, setIsDelegateModalOpened] = useState(false) const [hash, setHash] = useState(undefined) @@ -43,7 +46,7 @@ export const DelegationSection = () => { } }, [action, isError, isSuccess, setGlobalMessage]) - const isValidDelegatee = delegateeAddress !== address && delegateeAddress !== ZeroAddress + const isValidDelegatee = delegateeAddress !== address && Number(stRIFBalance) > 0 const delegatee = { 'Voting Power Delegated': isValidDelegatee ? : '-', Amount: isValidDelegatee ? : '-',