I have a contract that "is Initializable" and it is the base contract so I am using the onlyInitializing
modifier. However, after I deploy my contract and call the initialize function I receive "Error: VM Exception while processing transaction: reverted with reason string 'Initializable: contract is not initializing'"
I am using hardhat deploy.
My initialize function
function initialize(
IERC20 _token,
uint256 _maxDuration,
uint256 _minDuration
) public onlyInitializing {
token = _token;
maxDuration = _maxDuration;
minDuration = _minDuration;
}
and here is some of my deploy script where I hit the error
await deploy('Crowdfund', {
from: deployer,
log: true,
waitConfirmations: waitBlockConfirmations
});
log('Initializing Crowdfund');
crowdfund = await ethers.getContract('Crowdfund');
const initTx = await crowdfund.initialize(
initArgs.tokenAddress,
initArgs.min_duration,
initArgs.max_duration
);
initTx.wait(1);
log('Crowdfund initialized');