Skip to content

GWAT

Overview

GWAT is the seventh and final contract in the soeng chain. It creates derivative QINGs (also called GWATs) that are personal variations of existing QINGs.

  • Inherits: DYSNOMIA V2
  • License: Sharia
  • Solidity: ^0.8.21
  • Name: 骨 (Chinese for "bone")

What This Means For Players

Plain English Summary: GWAT lets you create your own personal venue derived from an existing QING. It's like opening a franchise of your favorite club - you get your own version with your name on it. Each player can have one GWAT per parent QING.

Real-World Analogy: Imagine your favorite coffee shop lets you open a franchise location with your name on it (e.g., "Alice's Starbucks"). That's what GWAT does - you take an existing venue (QING) and create a personalized spinoff (GWAT) that you own and control. Your GWAT even gets a special symbol with 骨 (bone) prefix.

How It Affects Your Gameplay: - Personal venues - Create your own derivative QING with your username - Unique positions - Each GWAT gets its own spot on the world map - Token rewards - Creating a GWAT mints tokens to you - One per parent - You can only have one GWAT per original QING per YUE

State Variables

Variable Type Visibility Description
Type string public constant "GWAT"
War WARINTERFACE public Reference to WAR
_qings mapping(address => mapping(address => address)) private Asset+YUE → GWAT
_waats mapping(uint256 => address) private Waat → GWAT
_map mapping(int256 => mapping(int256 => address)) private Lat/Lon → GWAT

Read Functions

GetMapGwat

function GetMapGwat(int256 Latitude, int256 Longitude) public view returns (QINGINTERFACE)
- Returns: GWAT at coordinates - In Plain English: Look up a player-created venue at specific map coordinates. Returns the GWAT located at that latitude/longitude, or nothing if no GWAT exists there.

Write Functions

Gwat

function Gwat(address Qing, uint256 Lin) public returns (QING Mu)
- Access: public - Parameters: - Qing (address): Parent QING address to derive the GWAT from - Lin (uint256): Position in distribution queue (used to generate unique Waat) - Returns: - Mu (QING): Newly created GWAT instance (a QING with GWAT=true) - Description: Creates a personal derivative QING (GWAT) named after the user. - Logic Flow: 1. Get player's YUE and LAU: (Chi, UserToken) = War.World().Cheon().Sei().Chi() 2. Verify parent QING exists in MAP: assert(Qing == address(Map.GetQing(Integrative.Waat()))) 3. Check user doesn't already have GWAT for this parent: if(_qings[Qing][address(Chi)] != address(0x0)) revert YourGwatAlreadyExists 4. Check token is not forbidden: if(Map.Forbidden(Asset)) revert ForbiddenToken 5. Generate unique Waat via WAR: Luo = War.Faa(Qing, Lin) 6. Verify Waat is valid: must not be divisible by offset and must be unoccupied 7. Deploy new QING contract: Mu = new QING(Luo, Qing, address(CHO)) 8. Rename to: "[Username]'s [Asset.name] GWAT" with symbol "骨[Asset.symbol]" 9. Configure ownership: add CHO and caller as owners 10. Mint tokens to caller: _mint(msg.sender, Mu.maxSupply() * 10^18) 11. Set market rate and register in mappings 12. Add to map at generated coordinates - Computation Details: - Luo (Waat) comes from WAR.Faa(), ensuring unique positioning - GWAT is true when Luo % offset != 0 - Creates a full QING contract with parent reference - Side Effects: - Deploys new QING contract - Mints GWAT tokens to caller (maxSupply amount) - Registers in _qings, _waats, and _map mappings - Adds ownership to CHO and caller - Emits NewQing event - In Plain English: Create your own personal venue derived from an existing QING! You pick a parent venue and get your own spinoff named after you (e.g., "Alice's DYS GWAT" with symbol "骨DYS"). You become the owner and receive a large token reward. Each player can only have one GWAT per parent QING per YUE wallet, preventing spam while allowing everyone to have their personalized venues.

Events

Event Parameters Description
NewQing Qing, Integrative, Waat New GWAT created

Errors

Error Parameters Description
YourGwatAlreadyExists Token, Qing Already have GWAT for this QING
ForbiddenToken which Token is forbidden
SpawningFailure Lin Failed to generate unique Waat

Contract Interactions

Depends On

Creates

  • QING - GWAT instances (QING with GWAT=true)

Special Mechanisms

GWAT Creation

function Gwat(address Qing, uint256 Lin) public returns (QING Mu) {
    // Get player
    (YUEINTERFACE Chi, LAU UserToken) = War.World().Cheon().Sei().Chi();
    QING Integrative = QING(Qing);

    // Verify parent QING
    assert(Qing == address(War.World().Map().GetQing(Integrative.Waat())));

    // Check not already created
    if(_qings[Qing][address(Chi)] != address(0x0))
        revert YourGwatAlreadyExists(Qing, _qings[Qing][address(Chi)]);

    // Check not forbidden
    if(War.World().Map().Forbidden(address(Integrative.Asset())))
        revert ForbiddenToken(address(Integrative.Asset()));

    // Get Luo from WAR
    uint256 Luo = War.Faa(Qing, Lin);
    if(Luo % War.World().Map().Offset() == 0 || _waats[Luo] != address(0x0))
        revert SpawningFailure(Lin);

    // Create GWAT
    Mu = new QING(Luo, Qing, address(War.World().Map().Cho()));

    // Name it: "Username's Asset GWAT"
    Mu.Rename(
        string.concat(UserToken.Username(), "'s ", Integrative.Asset().name(), " GWAT"),
        string.concat(unicode"骨", Integrative.Asset().symbol())
    );

    // Configure ownership
    War.World().Map().Cho().addOwner(address(Mu));
    Mu.addOwner(address(War.World().Map().Cho()));
    Mu.addOwner(msg.sender);

    // Mint tokens to creator
    _mint(msg.sender, Mu.maxSupply() * 10 ** decimals());

    // Set rate and register
    Mu.AddMarketRate(Qing, 1 * 10 ** decimals());
    Mu.renounceOwnership(address(this));
    _qings[Qing][address(Chi)] = address(Mu);
    _waats[Luo] = address(Mu);
    addToMap(Luo, address(Mu));
}

GWAT Properties

  • Has GWAT=true (Luo not divisible by offset)
  • Named with username prefix
  • Symbol prefixed with 骨
  • Personal to each player's YUE

Contract Verification

Property Value
Keccak256 Hash 0xbda02dc6dc9bcc6bdc2a5ad5bb10d0e2d93d50eb49e80f3460b6d63ba8aa688c
Source URL https://raw.githubusercontent.com/busytoby/atropa_pulsechain/main/solidity/dysnomia/domain/soeng/07_gwat.sol
Hash Generated 2026-02-08T00:29:08Z