solidity - 铸造代币时的众售合同问题
问题描述
我目前正在处理众包销售合同,但我遇到了一个函数问题,因为错误列表和函数代码已附加,我需要有人告诉我代码中发生了什么以及如何我解决了我在代码中面临的错误。Solidity 版本 ^0.5.0
代码:
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();
}
错误一:
不允许从“函数()视图返回(合同 IERC20)”到“合同 ERC20Mintable”的显式类型转换。ERC20Mintable erc20Mintable = ERC20Mintable(token);
错误2:
Crowdsale.sol:179:46:TypeError:函数调用中的参数类型无效。从函数 () 视图返回(合同 IERC20)到请求的合同 IERC20 的无效隐式转换。 创始人时间锁 = 新代币时间锁(代币,创始人基金,发布时间); ^---^
错误 3:
Crowdsale.sol:179:28:TypeError:类型合约 TokenTimelock 不能隐式转换为预期的类型地址。创始人时间锁 = 新代币时间锁(代币,创始人基金,发布时间);
解决方案
推荐阅读
- javascript - 将多个控制值更改组合在一起
- java - 获取前几个月的第一个和最后一个日期
- tinymce - TinyMCE 5:如何修改格式?
- swift - Firebase 多个 API 调用?
- html - Bootstrap 的下拉菜单需要 Popper.js
- c++ - 是否可以在 qt 项目中添加嵌入式 linux 上的 qml 支持小部件?
- python - 尝试安装人脸识别的 CMake 错误
- sql - 根据 Oracle SQL 中的先前行值计算行值
- c++ - 具有跨翻译单元的潜在类重新定义的全局静态内联变量 - 这种特殊情况是 C++17 中未定义的行为吗?
- maven - maven 发布:在 azure 构建管道中准备