【问题标题】:ParserError in Solidity 0.8.1, works in 0.6.4Solidity 0.8.1 中的 ParserError,适用于 0.6.4
【发布时间】:2021-05-30 19:49:39
【问题描述】:

我正在尝试在 Solidity 0.8.1 中创建 ERC20 令牌 在这个函数中我得到解析器错误不知道为什么

它在 0.6.4 中完美运行,但在 0.8.1 v 中出现错误

  function setMinbalance(uint256 minimumBalanceInfinney) public onlyOwner {
            
       minBalanceForAccounts = minimumBalanceInfinney * 1 finney ;
   }

【问题讨论】:

    标签: javascript ethereum solidity remix


    【解决方案1】:

    finney 和 szabo 面额被删除。它们很少使用,并且不会使实际数量很容易看到。相反,可以使用像 1e20 或非常常见的 gwei 这样的显式值。

    来源:https://docs.soliditylang.org/en/v0.8.0/070-breaking-changes.html#expressions


    解决方案:

    1 finney 替换为 1e15(因为 1 finney == 1000000000000000 wei)。

    minBalanceForAccounts = minimumBalanceInfinney * 1e15 ;
    

    【讨论】:

      猜你喜欢
      • 2022-12-11
      • 1970-01-01
      • 2022-08-12
      • 2021-08-20
      • 2021-06-29
      • 2021-12-11
      • 2021-08-15
      • 1970-01-01
      • 2021-02-20
      相关资源
      最近更新 更多