Hey @DylanKress
Lets check the code.
function placeBet (uint _playerGuess, uint _playerBet) public payable {
playerGuess = _playerGuess;
playerBet = _playerBet * oneWei;
totalPayout = _playerBet * 2 * oneWei;
emit betSubmitted ();}
uint _playerGuess, uint _playerBet
As far as I do understand, _playerGuess
should be 0 or 1 (head or tail), and _playerBet
is the amount of Ether that the user wants to bet.
You do not want to have uint _playerBet
as parameter because you have to use the value that the user is sending to the function () which is correctly set as payable
.
You should also make sure that uint _playerGuess
is either 0 or 1.
This should be:
function placeBet (uint _playerGuess) public payable {
require(_playerGuess == 0 || _playerGuess == 1);
playerGuess = _playerGuess;
playerBet = msg.value;
totalPayout = playerBet * 2;
emit betSubmitted ();
}
Same thing for function function depositETH (uint _amount) public payable onlyOwner {}
You donāt need to ask uint _amount
.
Regarding your function randomFlip()
:
function randomFlip () public {
uint result;
if (now % 2 == playerGuess) {
playerWin = true;
} else {
playerWin = false;
}
}
Happy learning,
Dani