Skip to content

Commit

Permalink
check for stRIF balance
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigoncalves committed Nov 12, 2024
1 parent 6f14485 commit ce6e0a5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/app/user/Delegation/DelegationSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<Hash | undefined>(undefined)
Expand All @@ -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 ? <HolderColumn address={delegateeAddress || ''} /> : '-',
Amount: isValidDelegatee ? <RenderTotalBalance symbol="stRIF" /> : '-',
Expand Down

0 comments on commit ce6e0a5

Please sign in to comment.