forked from raineorshine/solidity-by-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproposal.sol
More file actions
25 lines (21 loc) · 693 Bytes
/
proposal.sol
File metadata and controls
25 lines (21 loc) · 693 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
pragma solidity ^0.4.17;
/** A proposal contract with O(1) approvals. */
contract Proposal {
mapping (address => bool) approvals;
bytes32 public approvalMask;
bytes32 public approver1;
bytes32 public approver2;
bytes32 public target;
function Proposal() public {
approver1 = 0x00000000000000000000000000000000000000123;
approver2 = bytes32(msg.sender);
target = approver1 | approver2;
}
function approve(address approver) public {
approvalMask |= bytes32(approver);
approvals[approver] = true;
}
function isApproved() public constant returns(bool) {
return approvalMask == target;
}
}