TwoKey documentation

TwoKey documentation

  • Docs

›2KEY / SINGLETON-CONTRACTS

2KEY

  • Migrations
  • Ownable
  • TwoKeyConversionStates
  • TwoKeyConverterStates
  • TwoKeyTypes
  • UpgradabilityProxyAcquisition

2KEY / ACQUISITION-CAMPAIGN-CONTRACTS

  • TwoKeyAcquisitionCampaignERC20
  • TwoKeyAcquisitionLogicHandler
  • TwoKeyConversionHandler
  • TwoKeyPurchasesHandler

2KEY / CAMPAIGN-MUTUAL-CONTRACTS

  • ArcERC20
  • TwoKeyCampaign
  • TwoKeyCampaignConversionHandler
  • TwoKeyCampaignIncentiveModels
  • TwoKeyCampaignLogicHandler

2KEY / DONATION-CAMPAIGN-CONTRACTS

  • InvoiceTokenERC20
  • TwoKeyDonationCampaign
  • TwoKeyDonationCampaignType
  • TwoKeyDonationConversionHandler
  • TwoKeyDonationLogicHandler

2KEY / ERC20

  • ERC20

2KEY / INTERFACES

  • IBancorContract
  • IERC20
  • IGetImplementation
  • IHandleCampaignDeployment
  • IKyberNetworkProxy
  • IMaintainingPattern
  • IStructuredStorage
  • ITwoKeyAcquisitionCampaignERC20
  • ITwoKeyAcquisitionLogicHandler
  • ITwoKeyAdmin
  • ITwoKeyBaseReputationRegistry
  • ITwoKeyCampaign
  • ITwoKeyCampaignGetReferrers
  • ITwoKeyCampaignPublicAddresses
  • ITwoKeyCampaignValidator
  • ITwoKeyConversionHandler
  • ITwoKeyConversionHandlerGetConverterState
  • ITwoKeyDonationCampaign
  • ITwoKeyDonationCampaignFetchAddresses
  • ITwoKeyDonationConversionHandler
  • ITwoKeyDonationLogicHandler
  • ITwoKeyEventSource
  • ITwoKeyEventSourceEvents
  • ITwoKeyExchangeRateContract
  • ITwoKeyMaintainersRegistry
  • ITwoKeyPlasmaEvents
  • ITwoKeyPlasmaRegistry
  • ITwoKeyPurchasesHandler
  • ITwoKeyReg
  • ITwoKeyRegistry
  • ITwoKeyRegistryEvents
  • ITwoKeySingletoneAddressStorage
  • ITwoKeySingletoneRegistryFetchAddress
  • ITwoKeySingletonesRegistry
  • ITwoKeyWeightedVoteContract
  • IUpgradableExchange

2KEY / INTERFACES / STORAGE-CONTRACTS

  • ITwoKeyAdminStorage
  • ITwoKeyBaseReputationRegistryStorage
  • ITwoKeyCampaignValidatorStorage
  • ITwoKeyCommunityTokenPoolStorage
  • ITwoKeyDeepFreezeTokenPoolStorage
  • ITwoKeyEventSourceStorage
  • ITwoKeyExchangeRateContractStorage
  • ITwoKeyFactoryStorage
  • ITwoKeyLongTermTokenPoolStorage
  • ITwoKeyMaintainersRegistryStorage
  • ITwoKeyPlasmaEventsStorage
  • ITwoKeyPlasmaMaintainersRegistryStorage
  • ITwoKeyPlasmaRegistryStorage
  • ITwoKeyRegistryStorage
  • ITwoKeySignatureValidatorStorage
  • ITwoKeyUpgradableExchangeStorage

2KEY / LIBRARIES

  • Call
  • GetCode
  • IncentiveModels
  • SafeMath
  • Utils

2KEY / SINGLETON-CONTRACTS

  • ITwoKeySingletonUtils
  • StandardTokenModified
  • TwoKeyAdmin
  • TwoKeyBaseReputationRegistry
  • TwoKeyCampaignValidator
  • TwoKeyCongress
  • TwoKeyEconomy
  • TwoKeyEventSource
  • TwoKeyExchangeRateContract
  • TwoKeyFactory
  • TwoKeyMaintainersRegistry
  • TwoKeyPlasmaEvents
  • TwoKeyPlasmaMaintainersRegistry
  • TwoKeyPlasmaRegistry
  • TwoKeyPlasmaSingletoneRegistry
  • TwoKeyRegistry
  • TwoKeySignatureValidator
  • TwoKeySingletonesRegistry
  • TwoKeyUpgradableExchange

2KEY / SINGLETON-STORAGE-CONTRACTS

  • TwoKeyAdminStorage
  • TwoKeyBaseReputationRegistryStorage
  • TwoKeyCampaignValidatorStorage
  • TwoKeyCommunityTokenPoolStorage
  • TwoKeyDeepFreezeTokenPoolStorage
  • TwoKeyEventSourceStorage
  • TwoKeyExchangeRateStorage
  • TwoKeyFactoryStorage
  • TwoKeyLongTermTokenPoolStorage
  • TwoKeyMaintainersRegistryStorage
  • TwoKeyPlasmaEventsStorage
  • TwoKeyPlasmaMaintainersRegistryStorage
  • TwoKeyPlasmaRegistryStorage
  • TwoKeyRegistryStorage
  • TwoKeySignatureValidatorStorage
  • TwoKeyUpgradableExchangeStorage

2KEY / TOKEN-POOLS

  • TokenPool
  • TwoKeyCommunityTokenPool
  • TwoKeyDeepFreezeTokenPool
  • TwoKeyLongTermTokenPool

2KEY / UPGRADABILITY

  • Proxy
  • StructuredStorage
  • UpgradeabilityStorage
  • UpgradeabilityProxy
  • Upgradeable

2KEY / UPGRADABLE-PATTERN-CAMPAIGNS

  • ProxyCampaign
  • UpgradeabilityCampaignStorage
  • UpgradeableCampaign

TEST

  • FungibleMockToken
  • TestA
  • TestB
  • KyberNetworkTestMockContract

TwoKeyCongress

contract TwoKeyCongress

Source: contracts/2key/singleton-contracts/TwoKeyCongress.sol

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 - address
    isMember - bool
  • ProposalAdded

    event ProposalAdded(uint proposalID, address recipient, uint amount, string description)
    Parameters:
    proposalID - uint
    recipient - address
    amount - uint
    description - string
  • ProposalTallied

    event ProposalTallied(uint proposalID, int result, uint quorum, bool active)
    Parameters:
    proposalID - uint
    result - int
    quorum - uint
    active - bool
  • ReceivedEther

    event ReceivedEther(address sender, uint amount)
    Parameters:
    sender - address
    amount - uint
  • Voted

    event Voted(uint proposalID, bool position, address voter, string justification)
    Parameters:
    proposalID - uint
    position - bool
    voter - address
    justification - string

Modifiers

  • onlyMembers

    modifier onlyMembers()

Functions

  • addMember

    function addMember(address targetMember, bytes32 memberName, uint _votingPower) internal

    Add member * Make `targetMember` a member named `memberName` * @param targetMember ethereum address to be added.

    Parameters:
    targetMember - address
    memberName - public name for that member
    _votingPower - uint
  • changeVotingRules

    function changeVotingRules(uint256 minimumQuorumForProposals, uint256 minutesForDebate) internal

    Change 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 - uint256
    minutesForDebate - 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 - uint
    beneficiary - who to send the ether to
    weiAmount - amount of ether to send
    transactionBytecode - bytecode of transaction
    Returns:
    bool
  • executeProposal

    function executeProposal(uint proposalNumber, bytes transactionBytecode) public

    Finish vote * Count the votes proposal #`proposalNumber` and execute it if approved * @param proposalNumber proposal number.

    Parameters:
    proposalNumber - uint
    transactionBytecode - optional: if the transaction contained a bytecode, you need to send it
  • fallback

    function (uint256 _minutesForDebate, address[] initialMembers, bytes32[] initialMemberNames, uint[] votingPowers) public payable

    InitialMembers.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 length
    initialMembers - is the array containing addresses of initial members
    initialMemberNames - bytes32[]
    votingPowers - is the array of unassigned integers containing voting powers respectively
  • fallback

    function () public payable

    Fallback 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 - address
    weiAmount - amount of ether to send, in wei
    jobDescription - Description of job
    transactionBytecode - 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 - address
    etherAmount - amount of ether to send
    jobDescription - Description of job
    transactionBytecode - bytecode of transaction
    Returns:
    uint
  • removeMember

    function removeMember(address targetMember) internal

    Remove member * @notice Remove membership from `targetMember` * @param targetMember ethereum address to be removed.

    Parameters:
    targetMember - address
  • replaceMemberAddress

    function replaceMemberAddress(address _newMemberAddress) public

    Member 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 - uint
    supportsProposal - either in favor or against it
    justificationText - optional justification text
    Returns:
    uint256
← TwoKeyCampaignValidatorTwoKeyEconomy →
Copyright © 2019 2key.network