GovernorHarness.sol 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. import "../../contracts/governance/Governor.sol";
  2. contract GovernorHarness is Governor {
  3. function isExecuted(uint256 proposalId) public view returns (bool) {
  4. return _proposals[proposalId].executed;
  5. }
  6. function isCanceled(uint256 proposalId) public view returns (bool) {
  7. return _proposals[proposalId].canceled;
  8. }
  9. function initialized(uint256 proposalId) public view returns (bool){
  10. if (_proposals[proposalId].voteStart._deadline != 0 && _proposals[proposalId].voteEnd._deadline != 0) {
  11. return true;
  12. }
  13. return false;
  14. }
  15. mapping(uint256 => uint256) _quorum;
  16. function quorum(uint256 blockNumber) public view override virtual returns (uint256) {
  17. return _quorum[blockNumber];
  18. }
  19. mapping (address => mapping (uint256 => uint256)) _getVotes;
  20. function getVotes(address account, uint256 blockNumber) public view override virtual returns (uint256) {
  21. return _getVotes[account][blockNumber];
  22. }
  23. mapping (uint256 => bool) __quoromReached;
  24. function _quorumReached(uint256 proposalId) public view override virtual returns (bool) {
  25. return __quoromReached[proposalId];
  26. }
  27. mapping (uint256 => bool) __voteSucceeded;
  28. function _voteSucceeded(uint256 proposalId) public view override virtual returns (bool) {
  29. return __voteSucceeded[proposalId];
  30. }
  31. //string _COUNTING_MODE;
  32. function COUNTING_MODE() public pure override virtual returns (string memory) {
  33. return "dummy";
  34. }
  35. mapping(uint256 => mapping(address => bool)) _hasVoted;
  36. function hasVoted(uint256 proposalId, address account) public view override virtual returns (bool) {
  37. return _hasVoted[proposalId][account];
  38. }
  39. uint256 _votingDelay;
  40. function votingDelay() public view override virtual returns (uint256) {
  41. return _votingDelay;
  42. }
  43. uint256 _votingPeriod;
  44. function votingPeriod() public view override virtual returns (uint256) {
  45. return _votingPeriod;
  46. }
  47. function _countVote(
  48. uint256 proposalId,
  49. address account,
  50. uint8 support,
  51. uint256 weight
  52. ) internal override virtual {
  53. // havoc something
  54. }
  55. constructor(string memory name) Governor(name) {}
  56. // _countVots == Sum of castVote
  57. //
  58. // RHS:
  59. // 1) use counter_vote_power as a counter
  60. // 2) use counter_vote_power as a temp var for a ghost
  61. //
  62. // LHS:
  63. // mapping of count
  64. // countMap
  65. // uint decision;
  66. // uint numberOfOptions;
  67. function callPropose(address[] memory targets,
  68. uint256[] memory values,
  69. bytes[] memory calldatas) public virtual returns (uint256) {
  70. return super.propose(targets, values, calldatas, "");
  71. }
  72. }