I am getting the following error when deploying with web3js a smart contract based on Open Zeppelin:
Uncaught (in promise) Error: VM Exception while processing transaction: invalid opcode
at Object.InvalidResponse (errors.js:35)
at requestmanager.js:86
at XMLHttpRequest.request.onreadystatechange (httpprovider.js:122)
where the contract code is
pragma solidity ^0.4.15;
import "./libs/zeppelin/crowdsale/CappedCrowdsale.sol";
import "./libs/zeppelin/crowdsale/FinalizableCrowdsale.sol";
import './TestToken.sol';
contract SampleCrowdsale is CappedCrowdsale, FinalizableCrowdsale {
TestToken public testToken ;
function SampleCrowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, uint256 _goal, uint256 _cap, address _wallet, address _tokenContractAddress)
CappedCrowdsale(_cap)
FinalizableCrowdsale()
Crowdsale(_startTime, _endTime, _rate, _wallet)
{
testToken = TestToken(_tokenContractAddress);
}
function createTokenContract() internal returns (MintableToken) {
return testToken;
}
}
However everything works when I change FinalizableCrowdsale
to RefundableCrowdsale
:
pragma solidity ^0.4.15;
import "./libs/zeppelin/crowdsale/CappedCrowdsale.sol";
import "./libs/zeppelin/crowdsale/RefundableCrowdsale.sol";
import './TestToken.sol';
contract SampleCrowdsale is CappedCrowdsale, RefundableCrowdsale {
TestToken public testToken ;
function SampleCrowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, uint256 _goal, uint256 _cap, address _wallet, address _tokenContractAddress)
CappedCrowdsale(_cap)
FinalizableCrowdsale()
Crowdsale(_startTime, _endTime, _rate, _wallet)
{
require(_goal <= _cap);
testToken = TestToken(_tokenContractAddress);
}
function createTokenContract() internal returns (MintableToken) {
return testToken;
}
}
Question: Can anyone please explain to me why the first contract that uses FinalizableCrowdsale
is throwing that error? RefundableCrowdsale
inherits FinalizableCrowdsale
but isnt giving any errors...
Related Files:
- https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/crowdsale/Crowdsale.sol
- https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/crowdsale/FinalizableCrowdsale.sol
- https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/crowdsale/RefundableCrowdsale.sol