Created
August 12, 2015 13:50
-
-
Save d11e9/52d2789d21ecb712eeb9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract Faucet { | |
struct Patron { | |
uint contribution; | |
} | |
struct Proposal { | |
uint approvals; | |
address candidate; | |
string msg; | |
} | |
uint constant minApprovals = 3; | |
mapping (uint160 => Proposal) public proposals; | |
mapping (address => Patron) public patrons; | |
function approve (uint160 proposal) returns (bool) { | |
if (patrons[msg.sender].contribution > 0) { | |
if (proposals[proposal].candidate != msg.sender) { | |
if (proposals[proposal].approvals + 1 >= minApprovals) { | |
// TODO :) | |
} else { | |
proposals[proposal].approvals += 1; | |
return true; | |
} | |
} | |
} | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment