2

我目前正在处理众包销售合同,但我遇到了一个函数问题,因为错误列表和函数代码已附加,我需要有人告诉我代码中发生了什么以及如何我解决了我在代码中面临的错误。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 不能隐式转换为预期的类型地址。创始人时间锁 = 新代币时间锁(代币,创始人基金,发布时间);

4

0 回答 0