0

I'm trying to deploy a token contract and a crowdsale contract via Remix on Ropsten. However I am running into trouble. Below are both of my smart contracts and an explanation of what is happening.

MyCoin.sol

pragma solidity ^0.4.18;

import 'github.com/OpenZeppelin/zeppelin-solidity/contracts/token/ERC20/CappedToken.sol';

contract MyCoin is CappedToken {
    string public name = "MY COIN";
    string public symbol = "MYC";
    uint8 public decimals = 18;
    uint256 public cap = 500000000000000000000000;

    function MyCoin ()
        CappedToken(cap)
        public
        payable
    {

    }
}

MyCoinCrowdsale.sol

pragma solidity ^0.4.19;

import 'browser/MyCoin.sol';
import 'github.com/OpenZeppelin/zeppelin-solidity/contracts/crowdsale/emission/MintedCrowdsale.sol';

contract MyCoinCrowdsale is MintedCrowdsale {
    function MyCoinCrowdsale
        (
            uint256 _rate,
            address _wallet,
            CappedToken _token
        )
        public
        Crowdsale(_rate, _wallet, _token) {

        }
}

First I deploy MyCoin.sol via Remix and everything runs smoothly as shown in this txn.

However, when I deploy MyCoinCrowdsale.sol via Remix I get a txn error, which states :

Warning! Error encountered during contract execution [Reverted]

Any help would be greatly appreciated as I am completed stumped.

enter image description here

1 Answer 1

0

You have to understand why it fails at deployement, and for that, you have to inspect the constructor(s).

MintedCrowdsale doesn't have a specific constructor and it inherits of Crowdsale, which has one.

  constructor(uint256 _rate, address _wallet, ERC20 _token) public {
    require(_rate > 0);
    require(_wallet != address(0));
    require(_token != address(0));

    rate = _rate;
    wallet = _wallet;
    token = _token;
}

You can see the 3 require and it's highly probable that you are passing a wrong value for at least one of these parameters.

1
  • Yep, figured out that I didn't provide any params to the my crowdsale about 25 secs after I posted my question.
    – user17571
    Jun 25, 2018 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.