Skip to content

Commit

Permalink
check for valid delegated address (#366)
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigoncalves authored Nov 12, 2024
1 parent 50554aa commit 055ec14
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/app/user/Delegation/DelegationSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { useAccount } from 'wagmi'
import { RenderTotalBalance } from '../Balances/RenderTotalBalance'
import { BalancesProvider } from '../Balances/context/BalancesContext'
import { useGetDelegates } from './hooks/useGetDelegates'
import { ZeroAddress } from 'ethers'

export const DelegationSection = () => {
const { address } = useAccount()
Expand All @@ -35,10 +36,10 @@ export const DelegationSection = () => {
}
}, [isSuccess, setGlobalMessage])

const isValidDelegatee = delegateeAddress !== address && delegateeAddress !== ZeroAddress
const delegatee = {
'Voting Power Delegated':
delegateeAddress !== address ? <HolderColumn address={delegateeAddress || ''} /> : '-',
Amount: delegateeAddress !== address ? <RenderTotalBalance symbol="stRIF" /> : '-',
'Voting Power Delegated': isValidDelegatee ? <HolderColumn address={delegateeAddress || ''} /> : '-',
Amount: isValidDelegatee ? <RenderTotalBalance symbol="stRIF" /> : '-',
}

return (
Expand Down

0 comments on commit 055ec14

Please sign in to comment.