Hi, I am currently working on a crowd sale contract, But I am having an issue with a function as the list of the error and the code of the function is attached, I need someone to tell me that what is happening in the code and how can i resolve the error that I'm facing in the code.
function _finalization() internal {
if(goalReached()) {
ERC20Mintable erc20Mintable = ERC20Mintable(token);
//getting the total tokens that are been minted yet
uint256 alreadyMintedToken = erc20Mintable.totalSupply();
//tokens of the final total supply
uint256 finalTotalTokenSupply = alreadyMintedToken.div(tokenSalePercentage).mul(100);
foundersTimelock = new TokenTimelock(token,foundersFund,releaseTime);
partnersTimelock = new TokenTimelock(token,foundersFund,releaseTime);
foundationTimelock = new TokenTimelock(token,foundersFund,releaseTime);
//we will have the tokens that the founder will get
erc20Mintable.mint(address(foundersTimelock), finalTotalTokenSupply.mul(foundersPercentage).div(100));
erc20Mintable.mint(address(partnersTimelock), finalTotalTokenSupply.mul(partnersPercentage).div(100));
erc20Mintable.mint(address(foundationTimelock),finalTotalTokenSupply.mul(foundationPercentage).div(100));
erc20Mintable.renounceMinter();
// Unpause the token
ERC20Pausable erc20Pausable = new ERC20Pausable(token);
erc20Pausable.unpause();
erc20Pausable.renounceOwnership(wallet);
}
super._finalization();
}
}
Error 1:
Explicit type conversion not allowed from "function () view returns (contract IERC20)" to "contract ERC20Mintable".
ERC20Mintable erc20Mintable = ERC20Mintable(token);
Error 2:
Crowdsale.sol:179:46: TypeError: Invalid type for argument in function call. Invalid implicit conversion from function () view returns (contract IERC20) to contract IERC20 requested.
foundersTimelock = new TokenTimelock(token,foundersFund,releaseTime);
^---^
Error 3:
Crowdsale.sol:179:28: TypeError: Type contract TokenTimelock is not implicitly convertible to expected type address.
foundersTimelock = new TokenTimelock(token,foundersFund,releaseTime);