From 31b532e61cbd87e95f026f90c30e6a8048876b67 Mon Sep 17 00:00:00 2001 From: Nicola Miotto Date: Fri, 10 May 2024 10:59:47 +0200 Subject: [PATCH] fix delegation voting count --- .../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 334b2d7..d409692 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 ac14d9e..79c9aeb 100644 --- a/test/Integration.ts +++ b/test/Integration.ts @@ -284,6 +284,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