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
:
:
mySale.tokenToalSupply()
and your function ismySale.tokenTotalSupply()
Also, where is the variabletoken
in the solidity code for SampleCrowdsale defined, should be_token
, no?