WizardControlFirstPriority.sol 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.2;
  3. import "../munged/governance/Governor.sol";
  4. import "../munged/governance/extensions/GovernorCountingSimple.sol";
  5. import "../munged/governance/extensions/GovernorVotes.sol";
  6. import "../munged/governance/extensions/GovernorVotesQuorumFraction.sol";
  7. import "../munged/governance/extensions/GovernorTimelockControl.sol";
  8. import "../munged/governance/extensions/GovernorProposalThreshold.sol";
  9. import "../munged/token/ERC20/extensions/ERC20Votes.sol";
  10. /*
  11. Wizard options:
  12. ProposalThreshhold = 10
  13. ERC20Votes
  14. TimelockController
  15. */
  16. contract WizardControlFirstPriority is
  17. Governor,
  18. GovernorProposalThreshold,
  19. GovernorCountingSimple,
  20. GovernorVotes,
  21. GovernorVotesQuorumFraction,
  22. GovernorTimelockControl
  23. {
  24. constructor(
  25. ERC20Votes _token,
  26. TimelockController _timelock,
  27. string memory name,
  28. uint256 quorumFraction
  29. )
  30. Governor(name)
  31. GovernorVotes(_token)
  32. GovernorVotesQuorumFraction(quorumFraction)
  33. GovernorTimelockControl(_timelock)
  34. {}
  35. //HARNESS
  36. function isExecuted(uint256 proposalId) public view returns (bool) {
  37. return _proposals[proposalId].executed;
  38. }
  39. function isCanceled(uint256 proposalId) public view returns (bool) {
  40. return _proposals[proposalId].canceled;
  41. }
  42. uint256 _votingDelay;
  43. uint256 _votingPeriod;
  44. uint256 _proposalThreshold;
  45. mapping(uint256 => uint256) public ghost_sum_vote_power_by_id;
  46. function _castVote(
  47. uint256 proposalId,
  48. address account,
  49. uint8 support,
  50. string memory reason
  51. ) internal virtual override returns (uint256) {
  52. uint256 deltaWeight = super._castVote(proposalId, account, support, reason); //HARNESS
  53. ghost_sum_vote_power_by_id[proposalId] += deltaWeight;
  54. return deltaWeight;
  55. }
  56. function snapshot(uint256 proposalId) public view returns (uint64) {
  57. return _proposals[proposalId].voteStart._deadline;
  58. }
  59. function getExecutor() public view returns (address) {
  60. return _executor();
  61. }
  62. // original code, harnessed
  63. function votingDelay() public view override returns (uint256) {
  64. // HARNESS: pure -> view
  65. return _votingDelay; // HARNESS: parametric
  66. }
  67. function votingPeriod() public view override returns (uint256) {
  68. // HARNESS: pure -> view
  69. return _votingPeriod; // HARNESS: parametric
  70. }
  71. function proposalThreshold() public view override returns (uint256) {
  72. // HARNESS: pure -> view
  73. return _proposalThreshold; // HARNESS: parametric
  74. }
  75. // original code, not harnessed
  76. // The following functions are overrides required by Solidity.
  77. function quorum(uint256 blockNumber)
  78. public
  79. view
  80. override(IGovernor, GovernorVotesQuorumFraction)
  81. returns (uint256)
  82. {
  83. return super.quorum(blockNumber);
  84. }
  85. function getVotes(address account, uint256 blockNumber)
  86. public
  87. view
  88. override(IGovernor, Governor)
  89. returns (uint256)
  90. {
  91. return super.getVotes(account, blockNumber);
  92. }
  93. function state(uint256 proposalId) public view override(Governor, GovernorTimelockControl) returns (ProposalState) {
  94. return super.state(proposalId);
  95. }
  96. function propose(
  97. address[] memory targets,
  98. uint256[] memory values,
  99. bytes[] memory calldatas,
  100. string memory description
  101. ) public override(Governor, GovernorProposalThreshold, IGovernor) returns (uint256) {
  102. return super.propose(targets, values, calldatas, description);
  103. }
  104. function _execute(
  105. uint256 proposalId,
  106. address[] memory targets,
  107. uint256[] memory values,
  108. bytes[] memory calldatas,
  109. bytes32 descriptionHash
  110. ) internal override(Governor, GovernorTimelockControl) {
  111. super._execute(proposalId, targets, values, calldatas, descriptionHash);
  112. }
  113. function _cancel(
  114. address[] memory targets,
  115. uint256[] memory values,
  116. bytes[] memory calldatas,
  117. bytes32 descriptionHash
  118. ) internal override(Governor, GovernorTimelockControl) returns (uint256) {
  119. return super._cancel(targets, values, calldatas, descriptionHash);
  120. }
  121. function _executor() internal view override(Governor, GovernorTimelockControl) returns (address) {
  122. return super._executor();
  123. }
  124. function supportsInterface(bytes4 interfaceId)
  125. public
  126. view
  127. override(Governor, GovernorTimelockControl)
  128. returns (bool)
  129. {
  130. return super.supportsInterface(interfaceId);
  131. }
  132. }