令牌分发ICO的安全审计

时间:2017-10-04 09:44:26

标签: blockchain ethereum solidity

这是我们的MEG-Token-Distribution 1.0。我们需要某人的帮助。 Link for full code

我们如何才能访问mint函数(令牌所有者是EggithCrowdsale)?

我们如何改变费率取决于msg.value(如果> 20 ETH另一个价格)?

import kotlinx.android.synthetic.main.department_chooser_dialog.view.dep_list
...
class DepartmentChoiceDialog : DialogFragment() {
    override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
        val builder = AlertDialog.Builder(activity)
        val dialog = inflater.inflate(R.layout.department_chooser_dialog, null)
        dialog.dep_list.layoutManager = LinearLayoutManager(activity)
        dialog.dep_list.itemAnimator = DefaultItemAnimator()
        dialog.dep_list.setHasFixedSize(true)
        builder.setTitle(R.string.choose_or_create_dep)
               .setView(dialog)
                    ...

1 个答案:

答案 0 :(得分: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;
   }