ParserError: Expected '=>' but got '=' mapping (address => uint256) public balances; ^

Hello All!

I am trying to test a contract on the Ropsten Test Network, for a University Project, and I get the following:

ParserError: Expected ‘=>’ but got ‘=’ mapping (address => uint256) public balances; ^
Below is the line that causes the issue.

uint256 constant private MAX_UINT256 = 2**256 - 1;
    mapping (address => uint256) public balances;
    mapping (address => mapping (address => uint256)) public allowed;

Many thanks in advance!

1 Like

Hi @alin.tpn,

Welcome to the community :wave:

I tried a simple example on Remix and it compiled.

pragma solidity ^0.6.0;

contract MyContract {
  uint256 constant private MAX_UINT256 = 2**256 - 1;
  mapping (address => uint256) public balances;
  mapping (address => mapping (address => uint256)) public allowed;
}

I suggest creating a simple contract which shows the error.