Why Diamond?
Gotchipus uses the Diamond Standard (EIP-2535) — a proxy pattern that splits contract logic into modular pieces called Facets. This means:- No monolithic contract — features are isolated into separate facets
- Upgradeable without redeployment — individual facets can be added, replaced, or removed
- Shared storage — all facets share a unified
AppStoragestruct, avoiding fragmentation - Gas efficient — common logic is shared across facets
How It Works
The 12 Facets
| Facet | Responsibility |
|---|---|
| GotchipusFacet | ERC-721 standard (transfers, approvals, enumeration, burning) |
| MintFacet | Minting Pharos NFTs, summoning Gotchipus, whitelist management |
| AttributesFacet | Pet interaction, naming, attribute queries, soul queries |
| DNAFacet | Identity seed and trait data storage |
| GotchiWearableFacet | Wearable balance, equipping, cross-diamond calls |
| HooksFacet | Hook registration, removal, and querying |
| ERC6551Facet | Token-Bound Account creation and execution |
| SecurityFacet | Session management, security flags, transfer limits, whitelists |
| SetBonusFacet | Wearable set creation, updates, and activation |
| TimeFacet | Timezone-based weather system |
| MetadataFacet | Token URI generation, trait indexing |
| PaymasterFacet | Sponsored transaction processing, nonce management |
Core Libraries
The heavy lifting happens in shared libraries:| Library | Purpose |
|---|---|
| LibAppStorage | Central state storage struct |
| LibDna | Identity seed storage and trait packing |
| LibAttributes | Base attribute initialization and decay calculation |
| LibExperience | Level and skill point calculations |
| LibSoul | Soul energy balance and collateral conversion |
| LibDynamicStates | Health/energy/morale/focus mechanics |
| LibFaction | Faction assignment and stat bonuses |
| LibWearableStats | Wearable bonus calculations with faction multiplier |
| LibSetBonus | Set detection and bonus aggregation |
| LibSecurity | Transfer limits and session validation |
| LibHooks | Hook execution pipeline |
| LibSvg | On-chain SVG rendering |
Wearable Diamond
Wearables live in a separate Diamond with its own ERC-1155 implementation. The two Diamonds communicate via cross-contract calls — the main Diamond queries wearable balances and stats from the Wearable Diamond.Compilation
- Solidity: 0.8.29
- VIA-IR: Enabled (optimized compilation pipeline)
- Optimizer: 44,000,000 runs
- Network: Pharos (devnet + testnet)