When I run the mock contract “RefundablePostDeliveryCrowdsaleImpl ” in Remix, I get the following error:
“Creation of RefundablePostDeliveryCrowdsaleImpl errored: transaction execution failed”
Surprisingly the other contract “RefundableCrowdsaleImpl”, which is almost exactly the same, works just fine.
Does anyone face this issue as well?
Environment
OpenZeppelin: 2.2.0
Remix (online)
Code to reproduce bug
contract RefundablePostDeliveryCrowdsaleImpl is RefundablePostDeliveryCrowdsale {
constructor (
uint256 openingTime,
uint256 closingTime,
uint256 rate,
address payable wallet,
IERC20 token,
uint256 goal
)
public
Crowdsale(rate, wallet, token)
TimedCrowdsale(openingTime, closingTime)
RefundableCrowdsale(goal)
{
// solhint-disable-previous-line no-empty-blocks
}
}
Thank you!
Hm, that is indeed very strange. Could you share both of the sources you used for the Refundable
and RefundablePostDelivery
?
sure, here are the two codes:
For RefundablePostDeliveryCrowdsaleImpl :
pragma solidity ^0.5.0;
import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/crowdsale/distribution/RefundablePostDeliveryCrowdsale.sol";
contract RefundablePostDeliveryCrowdsaleImpl is RefundablePostDeliveryCrowdsale {
constructor (
uint256 openingTime,
uint256 closingTime,
uint256 rate,
address payable wallet,
IERC20 token,
uint256 goal
)
public
Crowdsale(rate, wallet, token)
TimedCrowdsale(openingTime, closingTime)
RefundableCrowdsale(goal)
{
// solhint-disable-previous-line no-empty-blocks
}
}
For RefundableCrowdsaleImpl
pragma solidity ^0.5.0;
import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/crowdsale/distribution/RefundablePostDeliveryCrowdsale.sol";
contract RefundableCrowdsaleImpl is RefundableCrowdsale {
constructor (
uint256 openingTime,
uint256 closingTime,
uint256 rate,
address payable wallet,
IERC20 token,
uint256 goal
)
public
Crowdsale(rate, wallet, token)
TimedCrowdsale(openingTime, closingTime)
RefundableCrowdsale(goal)
{
// solhint-disable-previous-line no-empty-blocks
}
}
RockmanR:
RefundableCrowdsaleImpl
I'm using the same import link since it works for the RefundableCrowdsaleImpl as well.
The RefundablePostDelivery
crowdsale will have a more expensive constructor, since it needs to create an escrow contract to hold the tokens. Are you sure you’re not running out of gas during deployment?
I just run a quick test locally, and deploying a RefundablePostDeliveryCrowdsaleImpl
should cost around 3.6 million gas, which may be higher than your defaults (though still fits inside a block).
3 Likes
Yes, the issue was from the gas!
Remix default is 3 million, I’ve increased it to 3.6 and it works fine now.
Thanks a lot nventuro.
2 Likes