0

Calling the method of Crowdsale's "token" on the source that inherited Crowdsale of zeppelin v1.8.0 inevitably causes "out of gas".

Error: Error: VM Exception while executing eth_call: out of gas

Is it impossible to use token's method from crowdsale source on here?

Environment

Truffle v4.1.5 (core: 4.1.5)
Solidity v0.4.21 (solc-js)
zeppelin v1.8.0
EthereumJS TestRPC v4.0.1 (ganache-core: 1.0.1) 

Crowdsale Contract

Sample of zeppelin v1.8.0 is almost intact

pragma solidity ^0.4.18;

contract SimpleToken is StandardToken {

  string public constant name = "SimpleToken"; // solium-disable-line uppercase
  string public constant symbol = "SIM"; // solium-disable-line uppercase
  uint8 public constant decimals = 18; // solium-disable-line uppercase

  uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(decimals));

  /**
   * @dev Constructor that gives msg.sender all of existing tokens.
   */
  function SimpleToken() public {
    totalSupply_ = INITIAL_SUPPLY;
    balances[msg.sender] = INITIAL_SUPPLY;
    Transfer(0x0, msg.sender, INITIAL_SUPPLY);
  }

}

--

pragma solidity ^0.4.18;

contract SampleCrowdsale is CappedCrowdsale, RefundableCrowdsale, MintedCrowdsale {


  function SampleCrowdsale(
    uint256 _openingTime,
    uint256 _closingTime,
    uint256 _rate,
    address _wallet,
    uint256 _cap,
    MintableToken _token,
    uint256 _goal
  ) public
    Crowdsale(_rate, _wallet, _token)
    CappedCrowdsale(_cap)
    TimedCrowdsale(_openingTime, _closingTime)
    RefundableCrowdsale(_goal)
  {
    //As goal needs to be met for a successful crowdsale
    //the value needs to less or equal than a cap which is limit for accepted funds
    require(_goal <= _cap);
  }

  function tokenTotalSupply()
      public
      constant
      returns (uint256)
  {
      return token.totalSupply();
  } 
}

After, deploy to testrpc, I got following error output...

truffle(testrpc)> mySale = SampleCrowdsale.at(SampleCrowdsale.address)
truffle(testrpc)> mySale.tokenToalSupply()
Error: Error: VM Exception while executing eth_call: out of gas
    at /c0ban-ico/node_modules/ethereumjs-testrpc/build/cli.node.js:59880:17
    at /c0ban-ico/node_modules/ethereumjs-testrpc/build/cli.node.js:88044:5
    :
    :
  • You typed mySale.tokenToalSupply() and your function is mySale.tokenTotalSupply() Also, where is the variable token in the solidity code for SampleCrowdsale defined, should be _token, no? – Jaime Apr 19 '18 at 14:52
  • Oh,,, mySale.tokenToalSupply() was typo... – todoroki Apr 20 '18 at 5:28
  • "token" is OK. Crowdsale.sol set "token" = "_token". – todoroki Apr 20 '18 at 5:28
0

I solved it. I changed from "ethereumjs-testrpc": "^4.0.1" to "ganache-cli": "^6.1.0". It worked !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.