Remix accepts the following code and allows me to deploy the contract:
pragma solidity 0.4.24;
contract bytes32array {
mapping(address => uint)[] balances;
function addBalance(address _address, uint _index, uint _amount) public {
balances[_index][_address] = _amount;
}
function getBalance(address _address, uint8 _index) public view returns(uint) {
return balances[_index][_address];
}
}
However, when I try to use the "addBalance" function, I just get an error (both in Javascript VM and through web3/testrpc). I get the error "VM Exception while processing transaction: invalid opcode". I can't figure out what I'm doing wrong, especially since the syntax is accepted.