github.com/iotexproject/iotex-core@v1.14.1-rc1/action/protocol/execution/testdata/proposal.sol (about)

     1  pragma solidity 0.4.24;
     2  
     3  /** A proposal contract with O(1) approvals. */
     4  
     5  contract Proposal {
     6      mapping (address => bool) approvals;
     7      bytes32 public approvalMask;
     8      bytes32 public approver1;
     9      bytes32 public approver2;
    10      bytes32 public target;
    11      
    12      function Proposal() public {
    13          approver1 = 0x00000000000000000000000000000000000000123;
    14          approver2 = bytes32(msg.sender);
    15          target = approver1 | approver2;
    16      }
    17      
    18      function approve(address approver) public {
    19          approvalMask = bytes32(approver) | bytes32(msg.sender);
    20          approvals[approver] = true;
    21      }
    22      
    23      function isApproved() public constant returns(bool) {
    24          return approvalMask == target;
    25      }
    26  }