Skip to content

Latest commit

 

History

History
52 lines (39 loc) · 1.87 KB

File metadata and controls

52 lines (39 loc) · 1.87 KB

SpawnSystem Affected Tables

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

commitSpawn

function commitSpawn(bytes32 _commitHash, bytes32 _matchEntity) public;

Affected Tables:

  • MatchPlayer: Retrieves 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 LockCommitSpawning.
    • Key: matchEntity, playerEntity
    • Value: SpawnStatusTypes.LockCommitSpawning
  • Commit: Stores the commit hash for the player.
    • Key: matchEntity, playerEntity
    • Value: The commit hash for the player.

Scenario:

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

commitSpawn

function revealSpawn(
    bytes32 _matchEntity,
    PositionData[] calldata _coordinates,
    bytes32[] calldata _pieceEntities,
    bytes32 _secret
) public;

Affected Tables:

  • EntityAtPosition: Adds the piece entities to the match at the specified positions.
    • Key: matchEntity, position
    • Value: The entity at the specified position.
  • Position: Updates the positions of the piece entities.
    • Key: pieceEntity
    • Value: The new position of the piece entity.
  • SpawnStatus: Sets the spawn status to LockRevealSpawning.
    • Key: matchEntity, playerEntity
    • Value: SpawnStatusTypes.LockRevealSpawning

Scenario:

  • Reveals the player's committed spawn positions by validating the secret and updating the positions and piece entities on the board.