I have just started coding some basic smart contracts with solidity and have a question on how to approach a particular problem. I hope I can make it make sense.
If I were to create a smart contract for a simple game, lets say its a dice rolling game where two players can play once another and wager some sort of game token or Ethereum that they have a balance of in the smart contract.
One player challenges another, the dice is rolled, a function in the smart contract decides the winner and they get the winnings.
My question is whats the fastest way to handle the contract verifying both players balances when they enter their wagers and then verify that they both agreed to play on another.
Right now in my mind it seems like one player would challenge another with a wager, the next player would have to agree and set their own wager, and then the first would have to confirm that. This would take multiple smart contract operations and players would be waiting for everything to get mined and written to the blockchain, especially if one of them used a low amount of gas or something.
What would be the proper approach for something like this?