I am developing a game on the blockchain platform, this game is a dose game. The scenario of the game is that a user creates a game and a contract is created, other users can see the list of games or the same contracts and join the game and play. I want when the user created the game and no one joined his game, he can cancel the game and get back the amount of coins he deposited. I wrote a method called cancel, but this method does not work properly and calculates the amount of gasfee too much.
This is the error I get:
This is my solidity code:
This is my Web3js code:
addressWage
a contract? Cause if it is, it needs a fallback or receive function.