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

ComponentPurpose
PGC-1Game-specific license contract
RegistryGame registration and validity
Game StoreAuthorized minter for purchases

Data Structures

DeploymentConfig

FieldTypeDescription
gameIdstringUnique game identifier
metadataURIstringCanonical metadata URI

State

VariableTypeDescription
registryaddressRegistry contract address
gameStoreaddressGame Store contract address
governanceaddressGovernance address

Functions

1. createGame

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

Params

NameTypeDescription
gameIdstringUnique game identifier
metadataURIstringCanonical metadata URI

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

TypeDescription
addressDeployed PGC-1 contract

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

NameTypeDescription
registryaddressNew Registry contract address

Rules

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

3. setGameStore

Updates Game Store contract address. function setGameStore(gameStore)

Params

NameTypeDescription
gameStoreaddressNew Game Store contract address

Rules

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

4. setGovernance

Updates governance address. function setGovernance(governance)

Params

NameTypeDescription
governanceaddressNew governance address

Rules

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

5. getRegistry

Returns Registry contract address. function getRegistry()

Returns

TypeDescription
addressRegistry contract address

6. getGameStore

Returns Game Store contract address. function getGameStore()

Returns

TypeDescription
addressGame Store contract address

7. getGovernance

Returns governance address. function getGovernance()

Returns

TypeDescription
addressGovernance address

Access Control

FunctionAccess
createGamePublic
setRegistryGovernance
setGameStoreGovernance
setGovernanceGovernance
getRegistryPublic
getGameStorePublic
getGovernancePublic

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