2

An invalid opcode exception typically implies either one of the following two scenarios: An assert(cond) statement with cond == false An array[i] expression with i >= array.length You don't have any assert statements in your code, so you should start by looking into every x[y] statement. However, some of those statements in your code are with x being a ...


2

You can avoid the modifier and the hashing. It is simpler to do: function set(uint _index, string calldata _data_to_store) external { require(bytes(storedData[_index]).length == 0); storedData[_index] = _data_to_store; } Checking the length of the bytes was inspired by this answer.


2

Change this: assert.equal(supplyCap, _cap); To this: assert.equal(supplyCap.toString(), _cap.toString());


2

Short answer: You can't. That's it. Better answer: The async flow has two steps. You have a transaction receipt which is a unique identifier for what you sent. It hasn't been mined, only accepted. It gets mined, and something happens. You're outputting the response from step 1. For step 2, you have a few options and they are documented all over so ...


2

Truffle is not using solc. You can see what it IS using with ./truffle version This is a little ambiguous, IMO. pragma solidity ^0.5.5; In practice, what I like to do is specify exactly what compiler to use for top-level contracts and ^ for inherited contracts and libraries. That way, the toolchain will emit an error at the first sign of an ...


1

For that type of situations it is recommended to use a withdrawal pattern. You do not pay directly but instead you store the winning address, then the winner have to call a withdraw function and it will be able to retrieve the prize. function makePayment(string result) public { if (result.toSlice().equals("home".toSlice())) { winner = homeBet;...


1

You cannot pass on additional information while querying provable, and due to this we cannot have any additional information with us when callback is received as callback is sent us by provable You can give each match a specific id and then make a call to provable with that specific id As when we query provable and receive callback it provides us query id ...


1

Does solidity always show that error message when the condition of require is not met? First of all, it is not Solidity which generates this error-message, it is Web3.js. Second, it is indeed arguably not the most suitable error-message because it makes one think that it has something to do with the gas, where in fact the transaction reverts because the ...


1

Based on The failing function call is the set Two suspects: Suspect ONE require( keccak256(abi.encodePacked(storedData[_index])) == keccak256(abi.encodePacked('')) ); If I read that correctly, the requirement is the storedData == '', so possibly that isn't the case. Suspect TWO require(owner == msg.sender); Check owner() and make sure that is your ...


1

The error message is misleading. You can safely disregard it since you aren't calling the constructor or sending funds. It's a lot of code to wade through so this won't be very specific. You say this seems to be the issue: request.recipient.transfer(request.value); The most likely cause is the contract doesn't have sufficient funds to make that happen. ...


1

Your technical mistake is that uint[] memory count is not initialized, so any access attempt of the sort count[number] or count[i] will naturally cause your function to revert; you must find the maximum value in the input array, and then initialize count = new uint[](maxInputValue + 1). Your logical mistake is that instead of this: if (count[number] > ...


1

I got a little lost in it, in part because we can't see the whole thing and in part because the data structure is leading to convoluted code. You eluded to that. Btw. I realize that arrays are a terrible data structure for what I'm trying to do to begin with. If Solidity has better data structures available (like a binary heap for starters), please let ...


Only top voted, non community-wiki answers of a minimum length are eligible