2017-10-04 57 views
0

這是我們的MEG-Token-Distribution 1.0。我們需要某人的幫助。 Link for full code令牌分配ICO的安全審計

我們如何訪問mint函數(令牌所有者是EggithCrowdsale)?

我們如何改變速度取決於msg.value(如果> 20 ETH價格另一個)?

contract EggithToken is MintableToken { 
    string public constant name = "EggithToken"; 
    string public constant symbol = "MEG"; 
    uint8 public constant decimals = 18; 
} 

contract EggithCrowdsale is Crowdsale { 
    function EggithCrowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet) 
     Crowdsale(_startTime, _endTime, _rate, _wallet) 
    { 
    } 

    // creates the token to be sold. 
    // override this method to have crowdsale of a specific mintable token. 
    function createTokenContract() internal returns (MintableToken) { 
     return new EggithToken(); 
    } 
} 

回答

0

「我們怎樣才能改變速度取決於msg.value(如> 20 ETH價格不同)?」

uint public constant regularPrice = 100; 
    uint public constant moreThan20EthContributionPrice = 75; 

    function() payable { 
    //fallback function that is called when ETH is sent to contract 

    ... some code ... 

    uint price = calculatePrice(); 

    ... some code ... 

    } 

    function calculatePrice() internal constant returns (uint) { 
     if (msg.value > 20 ether) return moreThan20EthContributionPrice; 
     return regularPrice; 
    } 
+0

請記住,在執行回退方法時,您只有2300個可用氣體,因此所有操作都必須少於此數量!請參閱http://solidity.readthedocs.io/en/develop/contracts.html#fallback-function –