Skip to main content

Overview

Factory is the developer onboarding layer for Peridot. Responsibilities:
  • Deploy new PGC-1 contracts
  • Initialize canonical game data
  • Authorize Game Store as minter
  • Register the game in Registry
  • Reduce manual setup for developers
Factory does NOT handle pricing, payments for game purchases, moderation, or license ownership.

Dependencies


Data Structures

DeploymentConfig


State


Functions

1. createGame

Deploys a new PGC-1 contract and performs initial setup. function createGame(gameId, metadataURI)

Params

Rules

  • gameId MUST NOT be empty
  • metadataURI MUST NOT be empty
  • Registry registration MUST succeed
  • Game Store authorization MUST succeed
  • Factory MUST deploy exactly one PGC-1 contract for this call

Flow

  1. Deploy new PGC-1 contract
  2. Initialize:
    • gameId
    • publisher = msg.sender
    • metadataURI
  3. Authorize gameStore as minter in PGC-1
  4. Register game in Registry
  5. Return deployed contract address

Returns

Notes

  • Registration fee policy is enforced by Registry
  • If publisher is fee-exempt in Registry, registration proceeds without fee
  • Entire process SHOULD revert if any step fails

2. setRegistry

Updates Registry contract address. function setRegistry(registry)

Params

Rules

  • Only governance
  • registry MUST NOT be zero address
  • Event SHOULD be emitted

3. setGameStore

Updates Game Store contract address. function setGameStore(gameStore)

Params

Rules

  • Only governance
  • gameStore MUST NOT be zero address
  • Event SHOULD be emitted

4. setGovernance

Updates governance address. function setGovernance(governance)

Params

Rules

  • Only current governance
  • governance MUST NOT be zero address
  • Event SHOULD be emitted

5. getRegistry

Returns Registry contract address. function getRegistry()

Returns


6. getGameStore

Returns Game Store contract address. function getGameStore()

Returns


7. getGovernance

Returns governance address. function getGovernance()

Returns


Access Control


Requirements

  • Factory MUST deploy a valid PGC-1 contract
  • Factory MUST initialize gameId, publisher, and metadataURI in PGC-1
  • Factory MUST authorize Game Store as minter in PGC-1
  • Factory MUST register the deployed PGC-1 contract in Registry
  • gameId MUST match the canonical gameId stored in PGC-1
  • Entire deployment and registration flow SHOULD be atomic

Notes

  • Factory is an orchestration layer, not a source of truth
  • Publisher and metadata belong to PGC-1
  • Game validity belongs to Registry
  • Pricing and purchase flow belong to Game Store
  • Factory is intended to improve developer experience and reduce manual errors