Alex Van de Sande's Congress DAO from Dec 28, 2015: on-chain voting with member registry (mapping) and configurable quorum.
Key Facts
Source Verified
Compiled with soljson-v0.1.7+commit.b4e666cc. Optimizer=1. Exact 3590-byte runtime bytecode match. Block 762632.
Heuristic Analysis
The following characteristics were detected through bytecode analysis and may not be accurate.
Frontier Era
The initial release of Ethereum. A bare-bones implementation for technical users.
Bytecode Overview
Verified Source Available
Source verified through compiler archaeology and exact bytecode matching.
View Verification ProofShow source code (Solidity)
contract owned {
address public owner;
function owned() {
owner = msg.sender;
}
modifier onlyOwner {
if (msg.sender != owner) throw;
_
}
function transferOwnership(address newOwner) onlyOwner {
owner = newOwner;
}
}
contract Congress is owned {
uint public minimumQuorum;
uint public debatingPeriodInMinutes;
int public majorityMargin;
Proposal[] public proposals;
uint public numProposals;
mapping (address => bool) public isMember;
mapping (uint => Member) public members;
uint public numberOfMembers;
event ProposalAdded(uint proposalID, address recipient, uint amount, string description);
event Voted(uint proposalID, bool position, address voter, string justification);
event ProposalTallied(uint proposalID, int result, uint quorum, bool active);
event MembershipChanged(address member, bool isMember);
event ChangeOfRules(uint minimumQuorum, uint debatingPeriodInMinutes, int majorityMargin);
struct Proposal {
address recipient;
uint amount;
string description;
uint votingDeadline;
bool executed;
bool proposalPassed;
uint numberOfVotes;
int currentResult;
bytes32 proposalHash;
Vote[] votes;
mapping (address => bool) voted;
}
struct Member {
address member;
bool canVote;
uint memberSince;
}
struct Vote {
bool inSupport;
address voter;
string justification;
}
modifier onlyMembers {
if (!isMember[msg.sender]) throw;
_
}
function Congress(uint minimumQuorumForProposals, uint minutesForDebate, int marginOfVotesForMajority) {
minimumQuorum = minimumQuorumForProposals;
debatingPeriodInMinutes = minutesForDebate;
majorityMargin = marginOfVotesForMajority;
}
function changeMembership(address targetMember, bool canVote) onlyOwner {
isMember[targetMember] = canVote;
MembershipChanged(targetMember, canVote);
}
function changeVotingRules(uint minimumQuorumForProposals, uint minutesForDebate, int marginOfVotesForMajority) onlyOwner {
minimumQuorum = minimumQuorumForProposals;
debatingPeriodInMinutes = minutesForDebate;
majorityMargin = marginOfVotesForMajority;
ChangeOfRules(minimumQuorum, debatingPeriodInMinutes, majorityMargin);
}
function newProposal(address beneficiary, uint etherAmount, string JobDescription, bytes transactionBytecode) onlyMembers returns (uint proposalID) {
proposalID = proposals.length++;
Proposal p = proposals[proposalID];
p.recipient = beneficiary;
p.amount = etherAmount;
p.description = JobDescription;
p.proposalHash = sha3(beneficiary, etherAmount, transactionBytecode);
p.votingDeadline = now + debatingPeriodInMinutes * 1 minutes;
p.executed = false;
p.proposalPassed = false;
p.numberOfVotes = 0;
ProposalAdded(proposalID, beneficiary, etherAmount, JobDescription);
numProposals = proposalID+1;
}
function checkProposalCode(uint proposalNumber, address beneficiary, uint etherAmount, bytes transactionBytecode) constant returns (bool codeChecksOut) {
Proposal p = proposals[proposalNumber];
return p.proposalHash == sha3(beneficiary, etherAmount, transactionBytecode);
}
function vote(uint proposalNumber, bool supportsProposal, string justificationText) onlyMembers returns (uint voteID) {
Proposal p = proposals[proposalNumber];
if (p.voted[msg.sender] == true) throw;
p.voted[msg.sender] = true;
p.numberOfVotes++;
if (supportsProposal) {
p.currentResult++;
} else {
p.currentResult--;
}
Voted(proposalNumber, supportsProposal, msg.sender, justificationText);
}
function executeProposal(uint proposalNumber, bytes transactionBytecode) returns (int result) {
Proposal p = proposals[proposalNumber];
if (now < p.votingDeadline || p.executed || p.proposalHash != sha3(p.recipient, p.amount, transactionBytecode) || p.numberOfVotes <= minimumQuorum) throw;
if (p.currentResult > majorityMargin) {
p.recipient.call.value(p.amount * 1 ether)(transactionBytecode);
p.executed = true;
p.proposalPassed = true;
} else {
p.executed = true;
p.proposalPassed = false;
}
ProposalTallied(proposalNumber, p.currentResult, p.numberOfVotes, p.proposalPassed);
}
}External Links
Related contracts
Association (Mist D.A.O.)
Same deployerA token-weighted governance contract deployed by Avsa on Dec 3, 2015, using MistCoin as voting shares. 0.1 ETH remains locked after 10 years.
0x8d554c...d9b8dcDecember 3, 2015Congress
Same deployerAlex Van de Sande's Congress DAO from Dec 28, 2015: on-chain voting system for proposals with configurable quorum and majority threshold.
0x7f6b46...03f101December 28, 2015Congress
Same deployerAlex Van de Sande's Congress DAO from Dec 28, 2015: on-chain voting system for proposals with configurable quorum and majority threshold.
0x1e5cbb...b7ff63December 28, 2015Doge-ETH Bounty DAO
Same deployerThe Doge-Ethereum Bounty DAO created by avsa on Dec 28, 2015. Funded over 5,400 ETH in bridge development, holds 50,000 MistCoin. Active 2015-2021.
0xdbf03b...c8c6fbDecember 28, 2015Unicorns
Same deployerUnicorns (๐ฆ) token by avsa โ 1830B variant A. Source recovered by bytecode analysis, verified on Etherscan and Sourcify.
0x1a3970...dd1076February 11, 2016Unicorns
Same deployerUnicorns (๐ฆ) token by avsa โ 1830B variant A. Source recovered by bytecode analysis, verified on Etherscan and Sourcify.
0x59a273...5c6786February 11, 2016