Explain solidity>multiple requires

Multiple Requires

Now let's create the function where Player O accepts the game by matching the stake.

Accept Game Requirements:

Player O must match the stake that Player X put up:

require(msg.value == stake, "Must match stake");

Only Player O can accept:

require(msg.sender == playerO, "Only opponent can accept");

The deadline hasn't expired:

require(block.timestamp <= acceptDeadline, "Accept period expired");

Game isn't already over:

require(!gameOver, "Game already over");



After Validation:

Set gameAccepted = true;

Set lastMoveAt = uint64(block.timestamp);

Double the stake: stake = msg.value * 2;



Create the acceptGame() payable function with all validations.

Create acceptGame function
0%
Requirements:
Declares acceptGame function
acceptGame is public payable
Checks msg.value matches stake
Checks msg.sender is playerO
Checks deadline not expired
Checks game not over
Sets gameAccepted to true
Sets lastMoveAt
Doubles the stake