From e2e9cd5c3b76a7058c329eb1a13433c3e9697847 Mon Sep 17 00:00:00 2001 From: bumi Date: Sun, 15 Apr 2018 18:15:21 +0200 Subject: [PATCH] Add batch voting for proposals The batchVote function accepts an array of proposal ids and votes for every one. Normally arrays without fix length are problematic and gas usage can not be estimated really well. So we need to see how that works or what other pattern could be used. --- contracts/Operator.sol | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/contracts/Operator.sol b/contracts/Operator.sol index 7b4fc6f..b950a70 100644 --- a/contracts/Operator.sol +++ b/contracts/Operator.sol @@ -127,6 +127,12 @@ contract Operator is Upgradeable { ProposalVoted(_pId, msg.sender, p.votesCount); } + function batchVote(uint256[] _proposalIds) public coreOnly { + for (uint256 i = 0; i < _proposalIds.length; i++) { + vote(_proposalIds[i]); + } + } + function executeProposal(uint proposalId) private returns (bool) { var p = proposals[proposalId]; require(!p.executed); -- 2.25.1