TwoKeyCongress
contract TwoKeyCongress
Index
- ChangeOfRules
- MembershipChanged
- ProposalAdded
- ProposalTallied
- ReceivedEther
- Voted
- addMember
- changeVotingRules
- checkIsMember
- checkProposalCode
- executeProposal
- fallback
- fallback
- getAllMemberAddresses
- getAllowedMethods
- getMaxVotingPower
- getMemberInfo
- getMemberVotingPower
- getMembersLength
- getMethodNameFromMethodHash
- getProposalData
- getVoteCount
- newProposal
- newProposalInEther
- onlyMembers
- removeMember
- replaceMemberAddress
- vote
Reference
Events
ChangeOfRules
event ChangeOfRules(uint256 _newMinimumQuorum, uint256 _newDebatingPeriodInMinutes)- Parameters:
_newMinimumQuorum- uint256_newDebatingPeriodInMinutes- uint256
MembershipChanged
event MembershipChanged(address member, bool isMember)- Parameters:
member- addressisMember- bool
ProposalAdded
event ProposalAdded(uint proposalID, address recipient, uint amount, string description)- Parameters:
proposalID- uintrecipient- addressamount- uintdescription- string
ProposalTallied
event ProposalTallied(uint proposalID, int result, uint quorum, bool active)- Parameters:
proposalID- uintresult- intquorum- uintactive- bool
ReceivedEther
event ReceivedEther(address sender, uint amount)- Parameters:
sender- addressamount- uint
Voted
event Voted(uint proposalID, bool position, address voter, string justification)- Parameters:
proposalID- uintposition- boolvoter- addressjustification- string
Modifiers
onlyMembers
modifier onlyMembers()
Functions
addMember
function addMember(address targetMember, bytes32 memberName, uint _votingPower) internalAdd member * Make `targetMember` a member named `memberName` * @param targetMember ethereum address to be added.
- Parameters:
targetMember- addressmemberName- public name for that member_votingPower- uint
changeVotingRules
function changeVotingRules(uint256 minimumQuorumForProposals, uint256 minutesForDebate) internalChange voting rules * Make so that proposals need to be discussed for at least `minutesForDebate/60` hours, have at least `minimumQuorumForProposals` votes, and have 50% + `marginOfVotesForMajority` votes to be executed * @param minimumQuorumForProposals how many members must vote on a proposal for it to be executed.
- Parameters:
minimumQuorumForProposals- uint256minutesForDebate- the minimum amount of delay between when a proposal is made and when it can be executed
checkIsMember
function checkIsMember(address _member) public view returns (bool)To check if an address is member.
- Parameters:
_member- is the address we're checking for- Returns:
- bool
checkProposalCode
function checkProposalCode(uint proposalNumber, address beneficiary, uint weiAmount, bytes transactionBytecode) public view returns (bool)Check if a proposal code matches * @param proposalNumber ID number of the proposal to query.
- Parameters:
proposalNumber- uintbeneficiary- who to send the ether toweiAmount- amount of ether to sendtransactionBytecode- bytecode of transaction- Returns:
- bool
executeProposal
function executeProposal(uint proposalNumber, bytes transactionBytecode) publicFinish vote * Count the votes proposal #`proposalNumber` and execute it if approved * @param proposalNumber proposal number.
- Parameters:
proposalNumber- uinttransactionBytecode- optional: if the transaction contained a bytecode, you need to send it
fallback
function (uint256 _minutesForDebate, address[] initialMembers, bytes32[] initialMemberNames, uint[] votingPowers) public payableInitialMembers.length must be equal votingPowers.length, Function which will be called only once, immediately after contract deployment.
- Parameters:
_minutesForDebate- is the number of minutes debate lengthinitialMembers- is the array containing addresses of initial membersinitialMemberNames- bytes32[]votingPowers- is the array of unassigned integers containing voting powers respectively
fallback
function () public payableFallback function.
getAllMemberAddresses
function getAllMemberAddresses() public view returns (address[])Function to get addresses of all members in congress.
- Returns:
- array of addresses
getAllowedMethods
function getAllowedMethods() public view returns (bytes32[])Function / Getter for hashes of allowed methods.
- Returns:
- array of bytes32 hashes
getMaxVotingPower
function getMaxVotingPower() public view returns (uint)Getter for maximum voting power.
- Returns:
- maxVotingPower
getMemberInfo
function getMemberInfo() public view returns (address, bytes32, uint, uint)Basic getter function.
- Returns:
- address
- bytes32
- uint
- uint
getMemberVotingPower
function getMemberVotingPower(address _memberAddress) public view returns (uint)Function getter for voting power for specific member.
- Parameters:
_memberAddress- is the address of the member- Returns:
- integer representing voting power
getMembersLength
function getMembersLength() public view returns (uint)Getter for length for how many members are currently.
- Returns:
- length of members
getMethodNameFromMethodHash
function getMethodNameFromMethodHash(bytes32 _methodHash) public view returns (string)Function to fetch method name from method hash.
- Parameters:
_methodHash- bytes32- Returns:
- methodname string representation
getProposalData
function getProposalData(uint proposalId) public view returns (uint, string, uint, bool, uint, int, bytes)Function to get major proposal data.
- Parameters:
proposalId- is the id of proposal- Returns:
- tuple containing all the data for proposal
getVoteCount
function getVoteCount(uint256 proposalNumber) public view returns (uint256, int256, string)- Modifiers:
- onlyMembers
- Parameters:
proposalNumber- uint256- Returns:
- uint256
- int256
- string
newProposal
function newProposal(address beneficiary, uint weiAmount, string jobDescription, bytes transactionBytecode) public returns (uint)Add Proposal * Propose to send `weiAmount / 1e18` ether to `beneficiary` for `jobDescription`. `transactionBytecode ? Contains : Does not contain` code. * @param beneficiary who to send the ether to.
- Modifiers:
- onlyMembers
- Parameters:
beneficiary- addressweiAmount- amount of ether to send, in weijobDescription- Description of jobtransactionBytecode- bytecode of transaction- Returns:
- uint
newProposalInEther
function newProposalInEther(address beneficiary, uint etherAmount, string jobDescription, bytes transactionBytecode) public returns (uint)Add proposal in Ether * Propose to send `etherAmount` ether to `beneficiary` for `jobDescription`. `transactionBytecode ? Contains : Does not contain` code. This is a convenience function to use if the amount to be given is in round number of ether units. * @param beneficiary who to send the ether to.
- Modifiers:
- onlyMembers
- Parameters:
beneficiary- addressetherAmount- amount of ether to sendjobDescription- Description of jobtransactionBytecode- bytecode of transaction- Returns:
- uint
removeMember
function removeMember(address targetMember) internalRemove member * @notice Remove membership from `targetMember` * @param targetMember ethereum address to be removed.
- Parameters:
targetMember- address
replaceMemberAddress
function replaceMemberAddress(address _newMemberAddress) publicMember can change only it's own address, Function where member can replace it's own address.
- Parameters:
_newMemberAddress- is the new address we'd like to set for us
vote
function vote(uint proposalNumber, bool supportsProposal, string justificationText) public returns (uint256)Log a vote for a proposal * Vote `supportsProposal? in support of : against` proposal #`proposalNumber` * @param proposalNumber number of proposal.
- Modifiers:
- onlyMembers
- Parameters:
proposalNumber- uintsupportsProposal- either in favor or against itjustificationText- optional justification text- Returns:
- uint256