Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix veto vote release #2435

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions pages/dao/[symbol]/proposal/components/MyProposalsBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import useRealm from '@hooks/useRealm'
import { useCallback, useEffect, useMemo, useState } from 'react'
import {
getProposalDepositsByDepositPayer,
getVoteRecord,
getVoteRecordAddress,
ProgramAccount,
Proposal,
Expand Down Expand Up @@ -236,7 +237,7 @@ const MyProposalsBn = () => {
instructions,
proposal: ProgramAccount<Proposal>
) => {
const voterTokenRecord =
let voterTokenRecord =
proposal.account.governingTokenMint.toBase58() ===
realm?.account.communityMint.toBase58()
? ownTokenRecord
Expand All @@ -248,12 +249,32 @@ const MyProposalsBn = () => {
const governanceAuthority = wallet!.publicKey!
const beneficiary = wallet!.publicKey!

const voteRecordPk = await getVoteRecordAddress(
let voteRecordPk = await getVoteRecordAddress(
realm!.owner,
proposal.pubkey,
voterTokenRecord!.pubkey
)

let governingTokenMint = proposal.account.governingTokenMint

try {
await getVoteRecord(connection, voteRecordPk)
} catch {
voterTokenRecord = role === "community" ?
ownCouncilTokenRecord :
ownTokenRecord

voteRecordPk = await getVoteRecordAddress(
realm!.owner,
proposal.pubkey,
voterTokenRecord!.pubkey
)

governingTokenMint = role === "community" && realm?.account.config.councilMint ?
realm.account.config.councilMint :
realm?.account.communityMint!
}

const inst = await withRelinquishVote(
instructions,
realm!.owner,
Expand All @@ -262,7 +283,7 @@ const MyProposalsBn = () => {
proposal.account.governance,
proposal.pubkey,
voterTokenRecord!.pubkey,
proposal.account.governingTokenMint,
governingTokenMint,
voteRecordPk,
governanceAuthority,
beneficiary
Expand Down
Loading