Skip to content

Latest commit

 

History

History
59 lines (46 loc) · 2.41 KB

File metadata and controls

59 lines (46 loc) · 2.41 KB

BuySystem Affected Tables

This document provides an overview of the tables affected by various functions within the BuySystem contract. Each section describes the function, the affected tables, and the values set in those tables.

commitBuy

function commitBuy(bytes32 _commitHash, bytes32 _matchEntity) public;

Affected Tables:

  • MatchPlayer: Sets the player entity for the given match and sender address.
    • Key: matchEntity, playerEntity
    • Value: The player entity associated with the sender address.
  • SpawnStatus: Sets the spawn status to LockCommitBuying.
    • Key: matchEntity, playerEntity
    • Value: SpawnStatusTypes.LockCommitBuying
  • Commit: Stores the commit hash for the player.
    • Key: matchEntity, playerEntity
    • Value: The commit hash for the player.

Scenario:

  • Commits the player's purchase intentions by setting the commit hash and updating the spawn status to LockCommitBuying.

revealBuy

function revealBuy(bytes32 _matchEntity, uint256[] memory _pieceTypes, bytes32 _secret) public;

Affected Tables:

  • Inventory: Updates the player's inventory balance and purchased pieces.
    • Key: matchEntity, playerEntity
    • Value: The updated inventory balance and pieces.
  • Piece: Adds the purchased pieces to the match.
    • Key: matchEntity, pieceEntity
    • Value: The piece entity added to the match.
  • Battle: Sets the battle attributes for the purchased pieces.
    • Key: matchEntity, pieceEntity
    • Value: The battle attributes for the piece.
  • Movement: Sets the movement attributes for the purchased pieces.
    • Key: matchEntity, pieceEntity
    • Value: The movement attributes for the piece.
  • OwnedBy: Sets the ownership of the purchased pieces.
    • Key: matchEntity, pieceEntity
    • Value: The ownership information of the piece.
  • PrimaryPiece: Marks the purchased pieces as primary if applicable.
    • Key: matchEntity, pieceEntity
    • Value: true if the piece is primary, otherwise false.
  • MatchEntityCounter: Increments the entity counter for the match.
    • Key: matchEntity
    • Value: The updated entity counter.

Scenario:

  • Reveals the player's committed purchases by validating the secret and updating the player's inventory and purchased pieces.