2019-02-21 01:43:41 -03:00
|
|
|
pragma solidity >=0.5.0 <0.6.0;
|
|
|
|
|
|
|
|
import "../../common/Controlled.sol";
|
|
|
|
import "../../deploy/InstanceAbstract.sol";
|
|
|
|
import "../../token/MiniMeToken.sol";
|
|
|
|
import "../delegation/Delegation.sol";
|
|
|
|
import "./Proposal.sol";
|
|
|
|
|
|
|
|
/**
|
2019-02-26 01:30:02 -03:00
|
|
|
* @title ProposalAbstract
|
2019-02-21 01:43:41 -03:00
|
|
|
* @author Ricardo Guilherme Schmidt (Status Research & Development GmbH)
|
2019-02-26 01:30:02 -03:00
|
|
|
* Store votes and tabulate results for Democracy.
|
2019-02-21 01:43:41 -03:00
|
|
|
*/
|
|
|
|
contract ProposalAbstract is InstanceAbstract, Proposal, Controlled {
|
|
|
|
|
|
|
|
MiniMeToken public token;
|
|
|
|
Delegation public delegation;
|
|
|
|
uint256 public tabulationBlockDelay;
|
|
|
|
|
2019-02-26 01:30:02 -03:00
|
|
|
bytes32 public dataHash;
|
|
|
|
uint public blockStart;
|
|
|
|
uint public voteBlockEnd;
|
|
|
|
QuorumType quorum;
|
2019-02-21 01:43:41 -03:00
|
|
|
//votes storage
|
2019-02-26 01:30:02 -03:00
|
|
|
bytes32[] public signatures;
|
|
|
|
mapping(address => Vote) public voteMap;
|
2019-02-21 01:43:41 -03:00
|
|
|
|
|
|
|
//tabulation process
|
2019-02-26 01:30:02 -03:00
|
|
|
uint256 public lastTabulationBlock;
|
|
|
|
mapping(address => address) public delegationOf;
|
|
|
|
mapping(address => address) public tabulated;
|
|
|
|
mapping(uint8 => uint256) public results;
|
2019-02-21 01:43:41 -03:00
|
|
|
|
2019-02-26 01:30:02 -03:00
|
|
|
Vote public result;
|
2019-02-21 01:43:41 -03:00
|
|
|
|
2019-03-23 06:16:41 -03:00
|
|
|
modifier votingPeriod {
|
|
|
|
require(block.number >= blockStart, "Voting not started");
|
|
|
|
require(block.number <= voteBlockEnd, "Voting ended");
|
|
|
|
_;
|
|
|
|
}
|
|
|
|
|
|
|
|
modifier tabulationPeriod {
|
|
|
|
require(block.number > voteBlockEnd, "Voting not ended");
|
|
|
|
require(result == Vote.Null, "Tabulation ended");
|
|
|
|
_;
|
|
|
|
}
|
|
|
|
|
|
|
|
modifier tabulationFinished {
|
|
|
|
require(lastTabulationBlock != 0, "Tabulation not started");
|
|
|
|
require(lastTabulationBlock + tabulationBlockDelay < block.number, "Tabulation not ended");
|
|
|
|
_;
|
|
|
|
}
|
2019-02-21 01:43:41 -03:00
|
|
|
}
|