Here are the errors i'm getting with the code all coming from balanceOf function:
TypeError: Data location must be "memory" or "calldata" for parameter in function, but none was given. --> contracts/Htoken.sol:39:24: | 39 | function balanceOf(address [msg.sender]) public override view returns (uint256) { | ^^^^^^^^^^^^^^^^^^^^
TypeError: Invalid array length, expected integer literal or constant expression. --> contracts/Htoken.sol:39:33: | 39 | function balanceOf(address [msg.sender]) public override view returns (uint256) { | ^^^^^^^^^^
THE CONTRACT CODE
contract NewToken {
string public constant name = "NewToken";
string public constant symbol = "NTKN";
uint8 public constant decimals = 18;
uint256 totalSupply_ = 10000000000000000000000000;
mapping(address => uint256) public balances;
mapping(address => mapping (address => uint256)) allowed;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
constructor() { balances[msg.sender] = totalSupply_; }
function totalSupply() public override view returns (uint256) {
return totalSupply_;
}
function balanceOf(address [msg.sender]) public override view returns (uint256) {
return balances[msg.sender];
}
function transfer(address to, uint256 value) public override returns (bool) {
require(value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender]-value;
balances[to] = balances[to]+value;
emit transfer(msg.sender, to, value);
return true;
}
function approve(address spender, uint256 value) public override returns (bool) {
allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function allowance(address owner, address spender) public override view returns (uint) {
return allowed[owner][spender];
}
function transferFrom(address from, address to, uint256 value) public override returns (bool) {
require(value <= balances[from]);
require(value <= allowed[from][msg.sender]);
balances[from] = balances[from]-value;
allowed[from][msg.sender] = allowed[from][msg.sender]+value;
balances[to] = balances[to]+value;
emit Transfer(from, to, value);
return true;
}
}