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
Dependencies
Data Structures
DeploymentConfig
State
Functions
1. createGame
Deploys a new PGC-1 contract and performs initial setup.function createGame(gameId, metadataURI)
Params
Rules
gameIdMUST NOT be emptymetadataURIMUST NOT be empty- Registry registration MUST succeed
- Game Store authorization MUST succeed
- Factory MUST deploy exactly one PGC-1 contract for this call
Flow
- Deploy new PGC-1 contract
- Initialize:
gameIdpublisher = msg.sendermetadataURI
- Authorize
gameStoreas minter in PGC-1 - Register game in Registry
- 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
registryMUST NOT be zero address- Event SHOULD be emitted
3. setGameStore
Updates Game Store contract address.function setGameStore(gameStore)
Params
Rules
- Only governance
gameStoreMUST NOT be zero address- Event SHOULD be emitted
4. setGovernance
Updates governance address.function setGovernance(governance)
Params
Rules
- Only current governance
governanceMUST 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, andmetadataURIin PGC-1 - Factory MUST authorize Game Store as minter in PGC-1
- Factory MUST register the deployed PGC-1 contract in Registry
gameIdMUST match the canonicalgameIdstored 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