Skip to content

Commit 2e3d300

Browse files
authored
fix bn overflow (#207)
* fix bn overflow * fix type
1 parent f974315 commit 2e3d300

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

hooks/useProposalVotes.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,13 @@ export default function useProposalVotes(proposal?: Proposal) {
197197

198198
const minimumVetoVotes = vetoMaxVoteWeight
199199
?.div(new BN(10).pow(new BN(vetoMintInfo.decimals ?? 0)))
200-
.muln(vetoThreshold.value / 100)
200+
.mul(new BN(vetoThreshold.value))
201+
.div(new BN(100))
201202

202-
const vetoVotesRequired = minimumVetoVotes.subn(vetoVoteCount).toString()
203+
const vetoVotesRequired =
204+
new BN(vetoVoteCount).gt(minimumVetoVotes) ?
205+
new BN(0).toString() :
206+
minimumVetoVotes.sub(new BN(vetoVoteCount)).toString()
203207

204208
return {
205209
_programVersion: programVersion,

0 commit comments

Comments
 (0)