Solidity 0.8.1 中的 ParserError,适用于 0.6.4
ParserError in Solidity 0.8.1, works in 0.6.4
我正在尝试在 Solidity 0.8.1 中创建 ERC20 令牌
在此函数中,我收到解析器错误,不知道为什么
它在 0.6.4 中运行完美,但在 0.8.1 v 中出现错误
function setMinbalance(uint256 minimumBalanceInfinney) public onlyOwner {
minBalanceForAccounts = minimumBalanceInfinney * 1 finney ;
}
The finney and szabo denominations are removed. They are rarely used and do not make the actual amount readily visible. Instead, explicit values like 1e20
or the very common gwei
can be used.
来源:https://docs.soliditylang.org/en/v0.8.0/070-breaking-changes.html#expressions
解法:
将1 finney
替换为1e15
(因为1 finney == 1000000000000000 wei)。
minBalanceForAccounts = minimumBalanceInfinney * 1e15 ;
我正在尝试在 Solidity 0.8.1 中创建 ERC20 令牌 在此函数中,我收到解析器错误,不知道为什么
它在 0.6.4 中运行完美,但在 0.8.1 v 中出现错误
function setMinbalance(uint256 minimumBalanceInfinney) public onlyOwner {
minBalanceForAccounts = minimumBalanceInfinney * 1 finney ;
}
The finney and szabo denominations are removed. They are rarely used and do not make the actual amount readily visible. Instead, explicit values like
1e20
or the very commongwei
can be used.
来源:https://docs.soliditylang.org/en/v0.8.0/070-breaking-changes.html#expressions
解法:
将1 finney
替换为1e15
(因为1 finney == 1000000000000000 wei)。
minBalanceForAccounts = minimumBalanceInfinney * 1e15 ;