Search code examples
javascriptethereumsolidityremix

ParserError in Solidity 0.8.1, works in 0.6.4


I am trying to create ERC20 token in Solidity 0.8.1 in this function i'm getting Parser error don't know why

its working perfectly in 0.6.4 but getting error in 0.8.1 v

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

enter image description here


Solution

  • 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.

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


    Solution:

    Replace 1 finney for 1e15 (because 1 finney == 1000000000000000 wei).

    minBalanceForAccounts = minimumBalanceInfinney * 1e15 ;