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
| Component | Purpose |
|---|---|
| PGC-1 | Game-specific license contract |
| Registry | Game registration and validity |
| Game Store | Authorized minter for purchases |
Data Structures
DeploymentConfig
| Field | Type | Description |
|---|---|---|
| gameId | string | Unique game identifier |
| metadataURI | string | Canonical metadata URI |
State
| Variable | Type | Description |
|---|---|---|
| registry | address | Registry contract address |
| gameStore | address | Game Store contract address |
| governance | address | Governance address |
Functions
1. createGame
Deploys a new PGC-1 contract and performs initial setup.function createGame(gameId, metadataURI)
Params
| Name | Type | Description |
|---|---|---|
| gameId | string | Unique game identifier |
| metadataURI | string | Canonical metadata URI |
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
| Type | Description |
|---|---|
| address | Deployed 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
| Name | Type | Description |
|---|---|---|
| registry | address | New Registry contract address |
Rules
- Only governance
registryMUST NOT be zero address- Event SHOULD be emitted
3. setGameStore
Updates Game Store contract address.function setGameStore(gameStore)
Params
| Name | Type | Description |
|---|---|---|
| gameStore | address | New Game Store contract address |
Rules
- Only governance
gameStoreMUST NOT be zero address- Event SHOULD be emitted
4. setGovernance
Updates governance address.function setGovernance(governance)
Params
| Name | Type | Description |
|---|---|---|
| governance | address | New governance address |
Rules
- Only current governance
governanceMUST NOT be zero address- Event SHOULD be emitted
5. getRegistry
Returns Registry contract address.function getRegistry()
Returns
| Type | Description |
|---|---|
| address | Registry contract address |
6. getGameStore
Returns Game Store contract address.function getGameStore()
Returns
| Type | Description |
|---|---|
| address | Game Store contract address |
7. getGovernance
Returns governance address.function getGovernance()
Returns
| Type | Description |
|---|---|
| address | Governance address |
Access Control
| Function | Access |
|---|---|
| createGame | Public |
| setRegistry | Governance |
| setGameStore | Governance |
| setGovernance | Governance |
| getRegistry | Public |
| getGameStore | Public |
| getGovernance | Public |
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