53 lines
1.5 KiB
Solidity
Raw Normal View History

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";
/**
* @title ProposalAbstract
2019-02-21 01:43:41 -03:00
* @author Ricardo Guilherme Schmidt (Status Research & Development GmbH)
* 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;
bytes32 public dataHash;
uint public blockStart;
uint public voteBlockEnd;
QuorumType quorum;
2019-02-21 01:43:41 -03:00
//votes storage
bytes32[] public signatures;
mapping(address => Vote) public voteMap;
2019-02-21 01:43:41 -03:00
//tabulation process
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
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
}