πPlay To Earn Contract
Last updated
The P2EGame (Play-to-Earn Game) contract is designed for managing a gaming ecosystem where players can stake ERC20 tokens in a gaming escrow.
The contract handles the staking of tokens, tracks game states, and manages token payouts based on game outcomes.
gameStateRetrieves the current state of game funds in escrow.
Parameter
Type
Description
_gameId
uint256
Identifier of the game.
_player
address
Address of the player.
Return
Type
Description
Tuple
(uint256, bool, address)
Balance, lock status, and treasury address.
createGameParameter
Type
Description
_player
address
Address of the player.
_treasury
address
Treasury address for the game.
_p
uint256
Player's staked amount.
_t
uint256
Treasury's staked amount.
Return
Type
Description
success
bool
Returns true if the game is successfully created.
playerWonParameter
Type
Description
_gameId
uint256
Identifier of the game.
_player
address
Address of the winning player.
Return
Type
Description
success
bool
Returns true if tokens are unlocked successfully.
playerLostParameter
Type
Description
_gameId
uint256
Identifier of the game.
_player
address
Address of the losing player.
Return
Type
Description
success
bool
Returns true if funds are sent to treasury.
WithdrawParameter
Type
Description
_gameId
uint256
Identifier of the game.
Return
Type
Description
success
bool
Returns true if withdrawal is successful.
Last updated