TwoKey documentation

TwoKey documentation

  • Docs

›2KEY / CAMPAIGN-MUTUAL-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

TwoKeyCampaign

contract TwoKeyCampaign

is ArcERC20

Source: contracts/2key/campaign-mutual-contracts/TwoKeyCampaign.sol
Author: Nikola Madjarevic (https://github.com/madjarevicn)

Index

  • buyTokensFromUpgradableExchange
  • getConstantInfo
  • getContractProxyAddress
  • getContractorBalanceAndTotalProceeds
  • getInfluencersKeysAndWeightsFromSignature
  • getModeratorTotalEarnings
  • getReceivedFrom
  • getReferrerCut
  • getReferrerPlasmaBalance
  • onlyContractor
  • publicLinkKeyOf
  • referrerWithdraw
  • setPublicLinkKey
  • setPublicLinkKeyOf
  • startCampaignWithInitialParams
  • transferFrom
  • updateIpfsHashOfCampaign
  • updateReferrerPlasmaBalance
  • withdrawContractorInternal

Reference

Modifiers

  • onlyContractor

    modifier onlyContractor()

Functions

  • buyTokensFromUpgradableExchange

    function buyTokensFromUpgradableExchange(uint amountOfMoney, address receiver) internal returns (uint)

    Private function which will be executed at the withdraw time to buy 2key tokens from upgradable exchange contract.

    Parameters:
    amountOfMoney - is the ether balance person has on the contract
    receiver - is the address of the person who withdraws money
    Returns:
    uint
  • getConstantInfo

    function getConstantInfo() public view returns (uint, uint, bool)

    Function to return the constants from the contract.

    Returns:
    uint
    uint
    bool
  • getContractProxyAddress

    function getContractProxyAddress(string contractName) internal view returns (address)
    Parameters:
    contractName - string
    Returns:
    address
  • getContractorBalanceAndTotalProceeds

    function getContractorBalanceAndTotalProceeds() external view returns (uint, uint)

    Only contractor can call this function, otherwise it will revert, Function to fetch contractor balance in ETH.

    Returns:
    value of contractor balance in ETH WEI
  • getInfluencersKeysAndWeightsFromSignature

    function getInfluencersKeysAndWeightsFromSignature(bytes sig, address _converter) internal view returns (address[], address[], uint8[], address)

    Function which will unpack signature and get referrers, keys, and weights from it.

    Parameters:
    sig - is signature
    _converter - address
    Returns:
    address[]
    address[]
    uint8[]
    address
  • getModeratorTotalEarnings

    function getModeratorTotalEarnings() public view returns (uint)

    Only contractor or moderator are eligible to call this function, Function to fetch moderator balance in ETH and his total earnings.

    Returns:
    value of his balance in ETH
  • getReceivedFrom

    function getReceivedFrom(address _receiver) public view returns (address)

    Getter for the referral chain.

    Parameters:
    _receiver - is address we want to check who he has received link from
    Returns:
    address
  • getReferrerCut

    function getReferrerCut(address me) public view returns (uint256)

    Function to get cut for an (ethereum) address.

    Parameters:
    me - is the ethereum address
    Returns:
    uint256
  • getReferrerPlasmaBalance

    function getReferrerPlasmaBalance(address _influencer) public view returns (uint)

    Function to get balance of influencer for his plasma address.

    Parameters:
    _influencer - is the plasma address of influencer
    Returns:
    balance in wei's
  • publicLinkKeyOf

    function publicLinkKeyOf(address me) public view returns (address)

    Function to get public link key of an address.

    Parameters:
    me - is the address we're checking public link key
    Returns:
    address
  • referrerWithdraw

    function referrerWithdraw(address _address, bool _withdrawAsStable) public

    It can be called by the address specified in the param or by the one of two key maintainers, Function where moderator or referrer can withdraw their available funds.

    Parameters:
    _address - is the address we're withdrawing funds to
    _withdrawAsStable - bool
  • setPublicLinkKey

    function setPublicLinkKey(address new_public_key) public

    Function to set public link key.

    Parameters:
    new_public_key - is the new public key
  • setPublicLinkKeyOf

    function setPublicLinkKeyOf(address me, address new_public_key) internal

    Private function to set public link key to plasma address.

    Parameters:
    me - is the ethereum address
    new_public_key - is the new key user want's to set as his public key
  • startCampaignWithInitialParams

    function startCampaignWithInitialParams(string _publicMetaHash, string _privateMetaHash, address new_public_key) public

    Only contractor can call this, Function to set or update public meta hash.

    Modifiers:
    onlyContractor
    Parameters:
    _publicMetaHash - is the hash of the campaign
    _privateMetaHash - string
    new_public_key - address
  • transferFrom

    function transferFrom(address _from, address _to, uint256 _value) internal returns (bool)

    Transfer tokens from one address to another.

    Parameters:
    _from - address The address which you want to send tokens from ALREADY converted to plasma
    _to - address The address which you want to transfer to ALREADY converted to plasma
    _value - uint256 the amount of tokens to be transferred
    Returns:
    bool
  • updateIpfsHashOfCampaign

    function updateIpfsHashOfCampaign(string _newPublicMetaHash) public

    Function to allow updating public meta hash.

    Modifiers:
    onlyContractor
    Parameters:
    _newPublicMetaHash - is the new meta hash
  • updateReferrerPlasmaBalance

    function updateReferrerPlasmaBalance(address _influencer, uint _balance) public

    Function to update referrer plasma balance.

    Parameters:
    _influencer - is the plasma address of referrer
    _balance - is the new balance
  • withdrawContractorInternal

    function withdrawContractorInternal() internal

    OnlyContractor can call this method, Function where contractor can withdraw his funds.

    Returns:
    true if successful otherwise will 'revert'
← ArcERC20TwoKeyCampaignConversionHandler →
Copyright © 2019 2key.network