The library SafeERC20 is to safely interact with a third party token. It is not to be used inside your own token contract.
OpenZeppelin contracts already have require to check for preconditions so they will return true or fail early.
Also I'd suggest to remove the protection for short address attack onlyPayloadSize
. They were removed from the OpenZeppelin contracts several months ago #261 Remove short address attack checks from tokens.
I was able to deploy your FinalizableCrowdsale
SampleCrowdsale
after I removed the FinalizableCrowdsale()
call from the constructor.
I used the following parameters in the constructor call:
1511030956, 1511117356, 1, 100, 200, "0x01", "0x02"
I deployed my contract using Remix, so I modified the code slightly to this (especially since I didn't have the TestToken code):
pragma solidity ^0.4.15;
import "github.com/OpenZeppelin/zeppelin-solidity/contracts/crowdsale/CappedCrowdsale.sol";
import "github.com/OpenZeppelin/zeppelin-solidity/contracts/crowdsale/FinalizableCrowdsale.sol";
import "github.com/OpenZeppelin/zeppelin-solidity/contracts/crowdsale/RefundableCrowdsale.sol";
import "github.com/OpenZeppelin/zeppelin-solidity/contracts/token/MintableToken.sol";
contract SampleCrowdsale is CappedCrowdsale, FinalizableCrowdsale {
MintableToken public testToken ;
function SampleCrowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, uint256 _goal, uint256 _cap, address _wallet, address _tokenContractAddress)
CappedCrowdsale(_cap)
Crowdsale(_startTime, _endTime, _rate, _wallet)
{
testToken = MintableToken(_tokenContractAddress);
}
function createTokenContract() internal returns (MintableToken) {
return testToken;
}
}
One thing that I noticed is that RefundableCrowdsale
requires one argument for its constructor, where as FinalizableCrowdsale
does not and it isn't necessary to call a parent's constructor if it doesn't take any arguments.
I suspect that this minor detail is the cause of the problem.
Best Answer
Potential areas to look at which could be causing your problem when using the default emission Crowdsale:
For information on the rate: https://docs.openzeppelin.org/v2.3.0/crowdsales#crowdsale-rate
For information on default emission: https://docs.openzeppelin.org/v2.3.0/crowdsales#default-emission
I recommend reading through the OpenZeppelin documentation on Crowdsales: https://docs.openzeppelin.org/v2.3.0/crowdsales
If you have more questions about OpenZeppelin you can always ask in the community forum