TwoKey documentation

TwoKey documentation

  • Docs

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

TwoKeyAcquisitionCampaignERC20

contract TwoKeyAcquisitionCampaignERC20

is UpgradeableCampaign, TwoKeyCampaign

Source: contracts/2key/acquisition-campaign-contracts/TwoKeyAcquisitionCampaignERC20.sol
Author: Nikola Madjarevic

Index

  • buyTokensAndDistributeReferrerRewards
  • buyTokensForModeratorRewards
  • convert
  • convertFiat
  • getAvailableAndNonReservedTokensAmount
  • getContractorBalance
  • getInventoryStatus
  • getReferrerCuts
  • getTokenBalance
  • joinAndShareARC
  • moveFungibleAsset
  • onlyTwoKeyConversionHandler
  • sendBackEthWhenConversionCancelled
  • setCut
  • setCutOf
  • setInitialParamsCampaign
  • specifyFiatConversionRewards
  • storeRateBeforeInventoryIsAdded
  • updateContractorProceeds
  • updateReservedAmountOfTokensIfConversionRejectedOrExecuted
  • withdrawContractor
  • withdrawRemainingRewardsInventory
  • withdrawUnsoldTokens

Reference

Modifiers

  • onlyTwoKeyConversionHandler

    modifier onlyTwoKeyConversionHandler()

    Modifier which will enable only twoKeyConversionHandlerContract to execute some functions.

Functions

  • buyTokensAndDistributeReferrerRewards

    function buyTokensAndDistributeReferrerRewards(uint256 _maxReferralRewardETHWei, address _converter, uint _conversionId, bool _isConversionFiat) public returns (uint)

    Function to delegate call to logic handler and update data, and buy tokens.

    Modifiers:
    onlyTwoKeyConversionHandler
    Parameters:
    _maxReferralRewardETHWei - total reward in ether wei
    _converter - is the converter address
    _conversionId - is the ID of conversion
    _isConversionFiat - bool
    Returns:
    uint
  • buyTokensForModeratorRewards

    function buyTokensForModeratorRewards(uint moderatorFee) public

    Function which will buy tokens from upgradable exchange for moderator.

    Modifiers:
    onlyTwoKeyConversionHandler
    Parameters:
    moderatorFee - is the fee in tokens moderator earned
  • convert

    function convert(bytes signature, bool _isAnonymous) public payable

    Payable function, Function where converter can convert.

    Parameters:
    signature - bytes
    _isAnonymous - bool
  • convertFiat

    function convertFiat(bytes signature, address _converter, uint conversionAmountFiatWei, bool _isAnonymous) public

    This can be executed only in case currency is fiat, Function to convert if the conversion is in fiat.

    Parameters:
    signature - bytes
    _converter - is the address of converter who want's fiat conversion
    conversionAmountFiatWei - is the amount of conversion converted to wei units
    _isAnonymous - if converter chooses to be anonymous
  • getAvailableAndNonReservedTokensAmount

    function getAvailableAndNonReservedTokensAmount() public view returns (uint)

    Function to check available amount of the tokens on the contract.

    Returns:
    uint
  • getContractorBalance

    function getContractorBalance() external view returns (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
  • getInventoryStatus

    function getInventoryStatus() public view returns (uint, uint, uint, uint)

    Function to return status of inventory.

    Returns:
    current ERC20 balance on inventory address, reserved amount of tokens for converters, and reserved amount of tokens for the rewards
  • getReferrerCuts

    function getReferrerCuts(address last_influencer) public view returns (uint256[])

    Function which acts like getter for all cuts in array.

    Parameters:
    last_influencer - is the last influencer
    Returns:
    array of integers containing cuts respectively
  • getTokenBalance

    function getTokenBalance(address tokenAddress) internal view returns (uint)

    Internal function to check the balance of the specific ERC20 on this contract.

    Parameters:
    tokenAddress - is the ERC20 contract address
    Returns:
    uint
  • joinAndShareARC

    function joinAndShareARC(bytes signature, address receiver) public

    Function to join with signature and share 1 arc to the receiver.

    Parameters:
    signature - is the signature
    receiver - is the address we're sending ARCs to
  • moveFungibleAsset

    function moveFungibleAsset(address _to, uint256 _amount) public

    Move some amount of ERC20 from our campaign to someone.

    Modifiers:
    onlyTwoKeyConversionHandler
    Parameters:
    _to - address we're sending the amount of ERC20
    _amount - is the amount of ERC20's we're going to transfer
    Returns:
    true if successful, otherwise reverts
  • sendBackEthWhenConversionCancelled

    function sendBackEthWhenConversionCancelled(address _cancelledConverter, uint _conversionAmount) public

    This function can be called only by conversion handler, Function to send ether back to converter if his conversion is cancelled.

    Modifiers:
    onlyTwoKeyConversionHandler
    Parameters:
    _cancelledConverter - is the address of cancelled converter
    _conversionAmount - is the amount he sent to the contract
  • setCut

    function setCut(uint256 cut) public

    Executes internal setCutOf method, Function to set cut.

    Parameters:
    cut - is the cut value
  • setCutOf

    function setCutOf(address me, uint256 cut) internal

    Function to set cut of.

    Parameters:
    me - is the address (ethereum)
    cut - is the cut value
  • setInitialParamsCampaign

    function setInitialParamsCampaign(address _twoKeySingletonesRegistry, address _twoKeyAcquisitionLogicHandler, address _conversionHandler, address _moderator, address _assetContractERC20, address _contractor, uint[] values) public

    This function is simulation for the constructor, since we're relying on proxies.

    Parameters:
    _twoKeySingletonesRegistry - is the address of TwoKeySingletonsRegistry contract
    _twoKeyAcquisitionLogicHandler - is the address of TwoKeyAcquisitionLogicHandler contract
    _conversionHandler - is the address of TwoKeyConversionHandler contract
    _moderator - is the moderator address
    _assetContractERC20 - is the ERC20 contract being sold inside campaign
    _contractor - is the contractor of the campaign
    values - is the array containing values [maxReferralRewardPercent (in weis), conversionQuota]
  • specifyFiatConversionRewards

    function specifyFiatConversionRewards() public payable

    Only contractor can add this inventory, Function to add fiat inventory for rewards.

    Modifiers:
    onlyContractor
  • storeRateBeforeInventoryIsAdded

    function storeRateBeforeInventoryIsAdded() internal view returns (uint)
    Returns:
    uint
  • updateContractorProceeds

    function updateContractorProceeds(uint value) public

    Can be called only from TwoKeyConversionHandler contract, Option to update contractor proceeds.

    Modifiers:
    onlyTwoKeyConversionHandler
    Parameters:
    value - it the value we'd like to add to total contractor proceeds and contractor balance
  • updateReservedAmountOfTokensIfConversionRejectedOrExecuted

    function updateReservedAmountOfTokensIfConversionRejectedOrExecuted(uint value) public

    Function to update amount of the reserved tokens in case conversion is rejected.

    Modifiers:
    onlyTwoKeyConversionHandler
    Parameters:
    value - is the amount to reduce from reserved state
  • withdrawContractor

    function withdrawContractor() public

    OnlyContractor can call this function, Function where contractor can withdraw his earnings after campaign ends.

    Modifiers:
    onlyContractor
  • withdrawRemainingRewardsInventory

    function withdrawRemainingRewardsInventory() internal
  • withdrawUnsoldTokens

    function withdrawUnsoldTokens() public

    This function will throw in case the caller is not contractor, Function where contractor can withdraw all unsold tokens from his campaign once time has passed.

    Modifiers:
    onlyContractor
← UpgradabilityProxyAcquisitionTwoKeyAcquisitionLogicHandler →
Copyright © 2019 2key.network