I have this method on a contract that I'm testing on rinkeby
function addMatch(string _name, uint _fixtureId, uint8 _home, uint8 away, uint _start) public onlyOwner returns (uint8) {
require(_home < NUM_TEAMS && _away < NUM_TEAMS && _home != _away);
require(_start >= now);
Match memory newMatch = Match({
home: _home,
away: _away,
fixtureId: uint2str(_fixtureId),
winner: 0,
start: _start,
name: _name
});
uint8 matchId = uint8(matches.push(newMatch));
string memory url = strConcat(
"json(https://api.basketball-matches.org/[my api key]/",
newMatch.fixtureId,
").[?(@.status=='FINISHED')].result[scoreHome,scoreAway]");
bytes32 oraclizeId = oraclize_query(_start + QUERY_INTERVAL, "URL", url);
oraclizeIds[oraclizeId] = matchId;
emit MatchCreated(matchId);
return matchId;
}
No matter how much I set the gas limit to the transaction still fails, however the gasUsed displayed on ether scan is less than the gasLimit (which I set to the limit of the network). Does anyone have any idea what the issue might be. I'm using web3 and using infura through the truffle HDWallet provide.
Attempting to estimate the gas cost using web3 just throws an error. The error returned when I call this method on the blockchain is:
Error: Transaction ran out of gas. Please provide more gas: