TwoKeyAcquisitionCampaignERC20
contract TwoKeyAcquisitionCampaignERC20
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 conversionconversionAmountFiatWei
- 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 signaturereceiver
- 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 campaignvalues
- 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