From 51e44ea66d8dcfee68c2932469476565df288e8c Mon Sep 17 00:00:00 2001 From: Nicola Miotto Date: Fri, 10 May 2024 11:03:13 +0200 Subject: [PATCH] fix resolution counting with delegation --- .../ResolutionManagerBase.sol | 1 + test/Integration.ts | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/contracts/ResolutionManager/ResolutionManagerBase.sol b/contracts/ResolutionManager/ResolutionManagerBase.sol index 819e139..a72692c 100644 --- a/contracts/ResolutionManager/ResolutionManagerBase.sol +++ b/contracts/ResolutionManager/ResolutionManagerBase.sol @@ -383,6 +383,7 @@ abstract contract ResolutionManagerBase { //if (!resolution.hasVoted[msg.sender]) { // Did sender's delegate vote? if ( + !resolution.hasVoted[msg.sender] && resolution.hasVoted[delegate] && resolution.hasVotedYes[delegate] ) { diff --git a/test/Integration.ts b/test/Integration.ts index eeb77cd..29004df 100644 --- a/test/Integration.ts +++ b/test/Integration.ts @@ -291,6 +291,28 @@ describe("Integration", async () => { expect(resolutionResult).equal(true); }); + it("bug #10", async () => { + await _makeContributor(user1, 65); + await _makeContributor(user2, 32); + + await _delegate(user1, user2); // yesTotalVote == 33 + + const resolutionId = await _prepareResolution(); + await _makeVotable(resolutionId); + + await _vote(user1, false, resolutionId); + await _vote(user2, true, resolutionId); + await _vote(user1, true, resolutionId); + + await _endResolution(); + + const resolutionResult = await resolutionManager.getResolutionResult( + resolutionId + ); + + expect(resolutionResult).equal(true); + }); + // Mint token to a multiple shareholder // Promote them to contributor // Self-delegate