Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
abrzezinski94 committed Nov 23, 2023
1 parent 7d5892c commit 06a7d66
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion components/GovernancePower/GovernancePowerForRole.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import VanillaVotingPower from './Vanilla/VanillaVotingPower'
import { Deposit } from './Vanilla/Deposit'
import { useUserCommunityTokenOwnerRecord } from '@hooks/queries/tokenOwnerRecord'
import { ExclamationIcon } from '@heroicons/react/solid'
import { VSR_PLUGIN_PKS } from '@constants/plugins'
import { useRealmConfigQuery } from '@hooks/queries/realmConfig'

export default function GovernancePowerForRole({
role,
Expand All @@ -21,10 +23,16 @@ export default function GovernancePowerForRole({
}) {
const { connection } = useConnection()
const realmPk = useSelectedRealmPubkey()
const config = useRealmConfigQuery().data?.result

const ownTokenRecord = useUserCommunityTokenOwnerRecord().data?.result
//if dao transited to use plugin and some users have still deposited tokens they should withdraw before
//depositing to plugin
const isVsr =
config?.account?.communityTokenConfig?.voterWeightAddin &&
VSR_PLUGIN_PKS.includes(
config?.account?.communityTokenConfig?.voterWeightAddin?.toBase58()
)
const didWithdrawFromVanillaSetup =
!ownTokenRecord ||
ownTokenRecord.account.governingTokenDepositAmount.isZero()
Expand Down Expand Up @@ -52,7 +60,7 @@ export default function GovernancePowerForRole({
<div>
<VanillaVotingPower role="community" {...props} />
<Deposit role="community" />
{!didWithdrawFromVanillaSetup && (
{isVsr && !didWithdrawFromVanillaSetup && (
<small className="flex items-center mt-3 text-xs">
<ExclamationIcon className="w-5 h-5 mr-2"></ExclamationIcon>
Please withdraw your tokens and deposit again to get governance
Expand Down
4 changes: 2 additions & 2 deletions components/TokenBalance/TokenDeposit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ export const TokenDeposit = ({
? availableTokens
: 0
const isVsr =
config?.account.communityTokenConfig.voterWeightAddin &&
config?.account?.communityTokenConfig?.voterWeightAddin &&
VSR_PLUGIN_PKS.includes(
config?.account.communityTokenConfig.voterWeightAddin.toBase58()
config?.account?.communityTokenConfig?.voterWeightAddin?.toBase58()
) &&
tokenRole === GoverningTokenRole.Community

Expand Down

0 comments on commit 06a7d66

Please sign in to comment.