Skip to content

Instantly share code, notes, and snippets.

@d11e9
Created August 12, 2015 13:50
Show Gist options
  • Save d11e9/52d2789d21ecb712eeb9 to your computer and use it in GitHub Desktop.
Save d11e9/52d2789d21ecb712eeb9 to your computer and use it in GitHub Desktop.
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