SHAFactory¶
Overview¶
SHAFactory is a factory contract for deploying new SHA token instances. It handles ownership setup and transfer during creation.
- License: Sharia
- Solidity: ^0.8.21
What This Means For Players¶
Plain English Summary: SHAFactory is like a key-cutting machine - it creates new SHA tokens (your cryptographic keys) on demand. When the game needs a new SHA for a player or operation, it asks the factory to make one. Players don't use this directly; it works automatically when you create your account.
Real-World Analogy: Think of a hardware store that cuts keys. You don't operate the machine yourself - you just ask for a key and it gets made for you. SHAFactory works the same way: other game contracts ask it to make SHA tokens, and it produces them with the right ownership already set up.
How It Affects Your Gameplay: - Automatic key creation - When you join, SHA tokens are created for you automatically - Proper ownership - The factory ensures you own your keys, not the system
State Variables¶
None - stateless factory pattern
Write Functions¶
New¶
- Access:public
- Parameters:
- name (string): Token name for the new SHA (e.g., "Shio Rod", "Shio Cone")
- symbol (string): Token symbol for the new SHA (e.g., "SROD", "SCONE")
- MathLib (address): Address of VMREQ math library contract for cryptographic operations
- Returns:
- Eta (SHA): Newly deployed SHA contract instance, fully owned by caller
- Description: Deploys a new SHA token with specified name/symbol, configures ownership, and renounces factory control.
- Logic Flow:
1. Deploy new SHA: Eta = new SHA(name, symbol, MathLib)
2. Add caller as owner: Eta.addOwner(msg.sender)
3. Add transaction origin as owner: Eta.addOwner(tx.origin)
4. Renounce factory ownership: Eta.renounceOwnership(address(this))
5. Return new SHA contract
- Side Effects: Deploys new SHA contract; modifies ownership list
- In Plain English: Create a fresh cryptographic key with the name you specify. The factory creates the SHA, gives ownership to both the calling contract and the human wallet initiator, then removes itself from ownership entirely. After creation, you own the key - the factory has no control.
Contract Interactions¶
Depends On¶
- SHA - Contract being deployed
Depended On By¶
Ownership Pattern¶
1. Factory deploys SHA
2. Factory adds msg.sender as owner
3. Factory adds tx.origin as owner
4. Factory renounces its own ownership
This ensures: - The calling contract becomes an owner - The human initiator becomes an owner - The factory retains no control
Usage Example¶
// From YI contract
SHA Rod = SHAFactoryInterface.New("Shio Rod", "SROD", MathLib);
SHA Cone = SHAFactoryInterface.New("Shio Cone", "SCONE", MathLib);
Contract Verification¶
| Property | Value |
|---|---|
| Keccak256 Hash | 0x5376888581e85e2d9f79459f4ceb8c4be0d256103e5e76485270d545b87a4d82 |
| Source URL | https://raw.githubusercontent.com/busytoby/atropa_pulsechain/main/solidity/dysnomia/02c_shafactory.sol |
| Hash Generated | 2026-02-08T00:29:57Z |