Skip to content

Instantly share code, notes, and snippets.

@d11e9
Last active August 29, 2015 14:27
Show Gist options
  • Save d11e9/28de415321289d06aeb2 to your computer and use it in GitHub Desktop.
Save d11e9/28de415321289d06aeb2 to your computer and use it in GitHub Desktop.
contract AnOrg {
address[] members;
// percent of members needed for quorum
uint quorum = 67;
struct Motion {
string key;
string value;
uint votes;
}
mapping (uint160 => Motion) public motions;
function AnOrg () {
members.length++;
members[members.length - 1] = msg.sender;
}
function move (uint160 contentHash, string key, string value) {
if (motions[contentHash].votes > 0) {
motions[contentHash].votes++;
if (members.length / motions[contentHash].votes * 100 > quorum) {
// approve motion
}
} else {
motions[contentHash] = Motion( key, value, 1 );
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment