Skip to content

Commit

Permalink
Multiply quorum percentage by 10000 to get it into proper format duri…
Browse files Browse the repository at this point in the history
…ng Safe deployment, adjust quorum displaying accordingly
  • Loading branch information
mudrila committed Feb 9, 2024
1 parent e4166d5 commit 871bc54
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
5 changes: 4 additions & 1 deletion src/components/Proposals/ProposalSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ export default function ProposalSummary({

const strategyQuorum =
votesToken && isERC20
? votingStrategy.quorumPercentage!.value.toNumber()
? votingStrategy
.quorumPercentage!.value.mul(100)
.div(votingStrategy.quorumDenominator?.value || 1000000)
.toNumber()
: isERC721
? votingStrategy.quorumThreshold!.value.toNumber()
: 1;
Expand Down
20 changes: 13 additions & 7 deletions src/hooks/DAO/loaders/governance/useERC20LinearStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@ export const useERC20LinearStrategy = () => {
if (!ozLinearVotingContract || !azoriusContract) {
return {};
}
const [votingPeriodBlocks, quorumNumerator, timeLockPeriod] = await Promise.all([
ozLinearVotingContract.asSigner.votingPeriod(),
ozLinearVotingContract.asSigner.quorumNumerator(),
azoriusContract.asSigner.timelockPeriod(),
]);
const [votingPeriodBlocks, quorumNumerator, quorumDenominator, timeLockPeriod] =
await Promise.all([
ozLinearVotingContract.asSigner.votingPeriod(),
ozLinearVotingContract.asSigner.quorumNumerator(),
ozLinearVotingContract.asSigner.QUORUM_DENOMINATOR(),
azoriusContract.asSigner.timelockPeriod(),
]);

const quorumPercentage = quorumNumerator.mul(100).div(quorumDenominator);
const votingPeriodValue = await blocksToSeconds(votingPeriodBlocks, provider);
const timeLockPeriodValue = await blocksToSeconds(timeLockPeriod, provider);
const votingData = {
Expand All @@ -42,8 +45,11 @@ export const useERC20LinearStrategy = () => {
formatted: getTimeDuration(votingPeriodValue),
},
quorumPercentage: {
value: quorumNumerator,
formatted: quorumNumerator.toString() + '%',
value: quorumPercentage,
formatted: quorumPercentage.toString() + '%',
},
quorumDenominator: {
value: quorumDenominator,
},
timeLockPeriod: {
value: BigNumber.from(timeLockPeriodValue),
Expand Down
2 changes: 1 addition & 1 deletion src/models/AzoriusTxBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ export class AzoriusTxBuilder extends BaseTxBuilder {
'0x0000000000000000000000000000000000000001', // Azorius module
azoriusGovernanceDaoData.votingPeriod,
BigNumber.from(1), // proposer weight, how much is needed to create a proposal.
azoriusGovernanceDaoData.quorumPercentage, // quorom numerator, denominator is 1,000,000, so quorum percentage is 50%
azoriusGovernanceDaoData.quorumPercentage.mul(10000), // quorom numerator, denominator is 1,000,000, so quorum percentage is quorumNumerator * 100 / quorumDenominator
BigNumber.from(500000), // basis numerator, denominator is 1,000,000, so basis percentage is 50% (simple majority)
]
);
Expand Down
1 change: 1 addition & 0 deletions src/types/fractal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ export interface VotingStrategyAzorius extends VotingStrategy {
export interface VotingStrategy<Type = BNFormattedPair> {
votingPeriod?: Type;
quorumPercentage?: Type;
quorumDenominator?: Type;
quorumThreshold?: Type;
timeLockPeriod?: Type;
}
Expand Down

0 comments on commit 871bc54

Please sign in to comment.