pragma solidity ^0.5.0; import "./oraclizeAPI_0.5.sol"; import "./Strings.sol"; contract BettingContract is usingOraclize { using Strings for string; address[] public players; string[] public TemperatureGuess; uint totalReceived; uint playerCount = 0; struct Player { address addr; //The address of their account uint betAmount; //The amount they're betting string guess; //What they've made as prediction } Player[] players; //When called for, Oraclize needs to be called and the Total needs to be updated. constructor(uint bet) public { OAR = OraclizeAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475); updateTotalReceived(bet); } //The Total needs to be counted, so that it can be sent (in total) to the winner(s) function updateTotalReceived(uint bet) internal { totalReceived = totalReceived + bet; AddPlayer(/*info*/); } function AddPlayer(address player, string memory guess ) internal { playerCount = playerCount + 1; players[playerCount] = player; TemperatureGuess[playerCount] = guess; } //This function will do everything needed to give the winnings to the winner of the bet. function Ending(/* temperature and winner(?) */) public { //totalReceived should get sent to the winner. //Thus, the winner needs to be chosen. //I have yet to decide/figure out what the correct place for the code to calculate the winner is. } }
0.4.18