diff --git a/lib/wrappers/genesisProtocol.ts b/lib/wrappers/genesisProtocol.ts index 222950fd7..bc4f05aff 100644 --- a/lib/wrappers/genesisProtocol.ts +++ b/lib/wrappers/genesisProtocol.ts @@ -352,6 +352,21 @@ export class GenesisProtocolWrapper extends IntVoteInterfaceWrapper implements S return this.contract.threshold(gpParametersHash, options.avatar); } + /** + * Returns a promise of the number of boosted proposals, not including those + * that have expired but have not yet been executed to update their status. + */ + public async getBoostedProposalsCount(avatar: Address): Promise { + + if (!avatar) { + throw new Error("avatar is not defined"); + } + + this.logContractFunctionCall("GenesisProtocol.getBoostedProposalsCount", { avatar }); + + return this.contract.getBoostedProposalsCount(avatar); + } + /** * Return the current balances on this GenesisProtocol's staking and the given avatar's native tokens. * This can be useful, for example, if you want to know in advance whether the avatar has enough funds diff --git a/test/genesisProtocol.ts b/test/genesisProtocol.ts index 3d499feef..7263bc2b0 100644 --- a/test/genesisProtocol.ts +++ b/test/genesisProtocol.ts @@ -537,6 +537,16 @@ describe("GenesisProtocol", () => { assert.isOk(result.tx); }); + it("can call getBoostedProposalsCount", async () => { + const proposalId = await createProposal(); + + await stakeProposalVote(proposalId, BinaryVoteResult.Yes, 10); + + const count = await genesisProtocol.getBoostedProposalsCount(dao.avatar.address); + assert(typeof count !== "undefined"); + assert(count.eq(1)); + }); + it("can call getScore", async () => { const proposalId = await createProposal(); const result = await genesisProtocol.getScore({ @@ -546,7 +556,6 @@ describe("GenesisProtocol", () => { }); it("can call getThreshold", async () => { - const proposalId = await createProposal(); const result = await genesisProtocol.getThreshold({ avatar: dao.avatar.address, });