2017-10-04 92 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 –