I am trying to do an Auction project and this part is bugging me. I can't figure out what is the problem that's causing the following error message: "VM error: invalid opcode.". Even if I do this simple smart contact I get the same error message. So I would like it if someone can figure out what is the problem with the provided smart contract. Thanks!
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.6.0 < 0.7.0;
contract testing {
mapping(address => uint256[]) fundsByBidder;
mapping(uint256 => uint256) newBidToGoods;
function update(uint256 _goodsId) public payable {
newBidToGoods[_goodsId] = fundsByBidder[msg.sender][_goodsId] + msg.value;
}
function show(uint256 _goodsId) public view returns(uint256) {
return newBidToGoods[_goodsId];
}
}
fundsByBidder[msg.sender].length
is not larger than_goodsId
.