Skip to content

Commit

Permalink
outcomes changed to mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Zoghb committed Oct 3, 2017
1 parent 89b1cce commit 54b9ccd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ex2/contracts/Betting_skeleton.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ contract Betting {
address public gamblerA;
address public gamblerB;
address public oracle;
uint[] outcomes; // Feel free to replace with a mapping

/* Structs are custom data structures with self-defined parameters */
struct Bet {
Expand All @@ -19,6 +18,8 @@ contract Betting {
mapping (address => Bet) bets;
/* Keep track of every player's winnings (if any) */
mapping (address => uint) winnings;
/* Keep track of all outcomes (maps index to numerical outcome) */
mapping (uint => uint) public outcomes;

/* Add any events you think are necessary */
event BetMade(address gambler);
Expand All @@ -27,6 +28,7 @@ contract Betting {
/* Uh Oh, what are these? */
modifier OwnerOnly() {_;}
modifier OracleOnly() {_;}
modifier OutcomeExists(uint outcome) {_;}

/* Constructor function, where owner and outcomes are set */
function BettingContract(uint[] _outcomes) {
Expand All @@ -41,15 +43,15 @@ contract Betting {
}

/* The oracle chooses which outcome wins */
function makeDecision(uint _outcome) OracleOnly() {
function makeDecision(uint _outcome) OracleOnly() OutcomeExists(_outcome) {
}

/* Allow anyone to withdraw their winnings safely (if they have enough) */
function withdraw(uint withdrawAmount) returns (uint remainingBal) {
}

/* Allow anyone to check the outcomes they can bet on */
function checkOutcomes() constant returns (uint[]) {
function checkOutcomes(uint outcome) constant returns (uint) {
}

/* Allow anyone to check if they won any bets */
Expand Down

0 comments on commit 54b9ccd

Please sign in to comment.