From a76c3fecde469f6a51266d0f75398400dda9a65a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Volpe?= Date: Wed, 9 Aug 2023 13:05:16 +0200 Subject: [PATCH] Fixed --- packages/sdk/contractkit/src/wrappers/Governance.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/sdk/contractkit/src/wrappers/Governance.ts b/packages/sdk/contractkit/src/wrappers/Governance.ts index 895c926f53a..a52b20f3240 100644 --- a/packages/sdk/contractkit/src/wrappers/Governance.ts +++ b/packages/sdk/contractkit/src/wrappers/Governance.ts @@ -211,7 +211,10 @@ export class GovernanceWrapper extends BaseWrapperForGoverning { * @param proposal Proposal to determine the constitution for running. */ async getConstitution(proposal: Proposal): Promise { - let constitution = new BigNumber(0) + // Default value that is harcoded on Governance contract + // it's 0.5 in Fixidity + // https://github.com/celo-org/celo-monorepo/blob/3fffa158d67ffd6366e81ba7243eadede1974b1b/packages/protocol/contracts/governance/Governance.sol#L39 + let constitution = fromFixed(new BigNumber('500000000000000000000000')) for (const tx of proposal) { constitution = BigNumber.max(await this.getTransactionConstitution(tx), constitution) } @@ -236,7 +239,7 @@ export class GovernanceWrapper extends BaseWrapperForGoverning { // in the total of yes votes required async getSupportWithConstitutionThreshold(proposalID: BigNumber.Value, constitution: BigNumber) { const support = await this.getSupport(proposalID) - support.required = support.required.times(constitution) + support.required = support.required.times(constitution).integerValue() return support }