📌Play To Earn Contract
Overview
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.
Methods
gameState
gameState
Retrieves the current state of game funds in escrow.
Parameters
Parameter | Type | Description |
|
| Identifier of the game. |
|
| Address of the player. |
Returns
Return | Type | Description |
Tuple |
| Balance, lock status, and treasury address. |
createGame
createGame
Parameters
Parameter | Type | Description |
|
| Address of the player. |
|
| Treasury address for the game. |
|
| Player's staked amount. |
|
| Treasury's staked amount. |
Returns
Return | Type | Description |
|
| Returns true if the game is successfully created. |
playerWon
playerWon
Parameters
Parameter | Type | Description |
|
| Identifier of the game. |
|
| Address of the winning player. |
Returns
Return | Type | Description |
|
| Returns true if tokens are unlocked successfully. |
playerLost
playerLost
Parameters
Parameter | Type | Description |
|
| Identifier of the game. |
|
| Address of the losing player. |
Returns
Return | Type | Description |
|
| Returns true if funds are sent to treasury. |
Withdraw
Withdraw
Parameters
Parameter | Type | Description |
|
| Identifier of the game. |
Returns
Return | Type | Description |
|
| Returns true if withdrawal is successful. |
Last updated