From 991f64e70b5d63e647b67f7b85f20480697a7e8c Mon Sep 17 00:00:00 2001 From: Oren Sokolowsky Date: Wed, 15 May 2019 23:30:47 +0300 Subject: [PATCH] emit statechange event for quiteending state --- contracts/votingMachines/GenesisProtocolLogic.sol | 1 + test/genesisprotocol.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/contracts/votingMachines/GenesisProtocolLogic.sol b/contracts/votingMachines/GenesisProtocolLogic.sol index c5a634e..e91f047 100644 --- a/contracts/votingMachines/GenesisProtocolLogic.sol +++ b/contracts/votingMachines/GenesisProtocolLogic.sol @@ -704,6 +704,7 @@ contract GenesisProtocolLogic is IntVoteInterface { if (proposal.state != ProposalState.QuietEndingPeriod) { proposal.currentBoostedVotePeriodLimit = params.quietEndingPeriod; proposal.state = ProposalState.QuietEndingPeriod; + emit StateChange(_proposalId, proposal.state); } // solhint-disable-next-line not-rely-on-time proposal.times[1] = now; diff --git a/test/genesisprotocol.js b/test/genesisprotocol.js index 861a564..86b8163 100644 --- a/test/genesisprotocol.js +++ b/test/genesisprotocol.js @@ -1354,7 +1354,11 @@ contract('GenesisProtocol', accounts => { await helpers.increaseTime(50); //get into the quite period assert.equal(await threshold(testSetup),2); - await testSetup.genesisProtocol.vote(proposalId,NO,0,helpers.NULL_ADDRESS,{from:accounts[0]}); //change winning vote + var tx = await testSetup.genesisProtocol.vote(proposalId,NO,0,helpers.NULL_ADDRESS,{from:accounts[0]}); //change winning vote + + assert.equal(tx.logs[0].event, "StateChange"); + assert.equal(tx.logs[0].args._proposalState, 6); + assert.equal(await threshold(testSetup),2); proposalInfo = await testSetup.genesisProtocol.proposals(proposalId);