Skip to content

QING

Overview

QING is the token wrapper contract that creates tradeable representations of any token with geographic positioning, access control, and chat functionality. Each QING has a unique Waat (position) in the Hecke coordinate system.

  • Inherits: DYSNOMIA V2
  • License: Sharia
  • Solidity: ^0.8.21

What This Means For Players

Plain English Summary: QING is a venue/location - like a chatroom or marketplace you can join. Every QING wraps an existing token and gives it a physical location on the game map. You can join QINGs to chat, trade, and participate in their community. Some have cover charges, bouncers, and guest lists.

Real-World Analogy: Think of a QING like a nightclub. It has a location (Waat), a cover charge to enter, bouncers who control access, a VIP guest list, and an interior where people can chat. The club is "built on" an existing token - like how a club might be themed around a band or brand.

How It Affects Your Gameplay: - Join venues - Pay the cover charge (if any) and become a member - Chat - Send messages visible to other members - Access control - Meet the requirements: hold enough tokens, be on the guest list, or have CROWS status - Derivative QINGs (GWATs) - Players can create their own personal venues

State Variables

Variable Type Visibility Description
Type string public constant "QING"
Cho CHOINTERFACE public Reference to CHO
Asset DYSNOMIA public Wrapped token
Map MAPINTERFACE public Reference to MAP
Waat uint256 public Geographic position
Entropy uint64 public QING-specific entropy
BouncerDivisor uint16 public Access threshold divisor
CoverCharge uint256 public Entry fee
NoCROWS bool public Disable CROWS access
GWAT bool immutable Is this a GWAT (derivative QING)

Read Functions

GetQing

function GetQing(uint256 QingWaat) public view returns (QINGINTERFACE)
- Returns: QING at specified Waat via MAP - In Plain English: Look up any venue by its map position. Returns the venue's contract address so you can interact with it.

Admitted

function Admitted(address UserToken) public view returns (bool)
- Returns: True if user can enter - In Plain English: Check if you're allowed into this venue. Returns true if you hold enough tokens, are on the guest list, or have CROWS status.

bouncer

function bouncer(address cBouncer) public view returns (bool)
- Returns: True if address has bouncer privileges - In Plain English: Check if an address has staff/management powers at this venue. Bouncers can change cover charges, manage the guest list, and grant access.

Write Functions

AddMarketRate

function AddMarketRate(address Contract, uint256 Rate) public onlyOwners
- Access: onlyOwners - Parameters: - Contract (address): Token contract to set rate for - Rate (uint256): Exchange rate (must be >= current rate) - Description: Sets market rate with increase-only restriction. - Logic Flow: 1. Check Rate >= GetMarketRate(Contract) or revert MarketRateCanOnlyBeIncreased 2. Check Rate <= TokenMaximumRate or revert 3. Store rate - Side Effects: Updates internal market rate mapping - In Plain English: Set the exchange rate for a token at this venue. Rates can only go up, never down - this protects traders from manipulation and ensures early traders get fair value.

Withdraw

function Withdraw(address what, uint256 amount) public onlyOwners
- Access: onlyOwners - Parameters: - what (address): Token address to withdraw - amount (uint256): Amount to transfer - Description: Transfers tokens from QING to caller (blocked for GWATs). - Logic Flow: 1. Check GWAT == false or revert 2. Transfer tokens to msg.sender 3. Emit Withdrawal event with Soul and Aura - Side Effects: Transfers tokens; emits event - In Plain English: Take tokens out of the venue's treasury. Only official QINGs (not player-created GWATs) allow this - prevents GWAT creators from draining user funds.

setBouncerDivisor

function setBouncerDivisor(uint16 _d) public onlyBouncers
- Access: onlyBouncers - Parameters: - _d (uint16): Divisor for whale threshold (e.g., 100 = 1% of supply) - Description: Sets the token holding threshold for automatic bouncer access. - Logic Flow: 1. Set BouncerDivisor = _d - Computation Details: - Threshold = totalSupply / BouncerDivisor - Divisor of 100 = 1% needed, 10 = 10% needed - Side Effects: Updates BouncerDivisor - In Plain English: Set how many tokens someone needs to be a "whale" at this venue. Lower divisor = higher threshold. Whales automatically get bouncer powers.

setCoverCharge

function setCoverCharge(uint256 _c) public onlyBouncers
- Access: onlyBouncers - Parameters: - _c (uint256): Entry fee in wrapped Asset tokens (wei) - Description: Sets the entry fee for joining this QING. - Logic Flow: 1. Set CoverCharge = _c - Side Effects: Updates CoverCharge - In Plain English: Set how much it costs to enter this venue. The fee is paid in the venue's wrapped token. Set to 0 for free entry. Cover grants 24-hour access.

setStaff / setGuestlist / removeGuest

function setStaff(address _a, bool active) public onlyBouncers
function setGuestlist(address _a) public onlyBouncers
function removeGuest(address _a) public onlyBouncers
- Access: onlyBouncers - Parameters: - _a (address): Target address (usually a LAU or wallet) - active (bool): Enable/disable staff status (for setStaff) - Description: Manage venue access control lists. - Logic Flow: - setStaff: Set _staff[_a] = active - setGuestlist: Set _guestlist[_a] = true - removeGuest: Set _guestlist[_a] = false - Side Effects: Updates internal mappings - In Plain English: Manage who can enter. Staff get bouncer powers (can manage others and always admitted). Guest list members can enter without meeting token requirements. Remove guests to revoke their bypass.

AllowCROWS

function AllowCROWS(bool _b) public onlyOwners
- Access: onlyOwners - Parameters: - _b (bool): True to allow CROWS holders, false to block - Description: Toggles whether CROWS token holders get automatic bouncer access. - Logic Flow: 1. Set NoCROWS = !_b (inverted logic) - Side Effects: Updates NoCROWS flag - In Plain English: Toggle whether CROWS token holders (25+ tokens) automatically get bouncer access. Set to false for a more exclusive venue that only recognizes staff and whales.

Join

function Join(address UserToken) public
- Access: public - Parameters: - UserToken (address): LAU token address of the joining user - Description: Pays cover charge (if required) and grants 24-hour venue access. - Logic Flow: 1. If CoverCharge > 0 and access expired: - Transfer CoverCharge of Asset from caller to QING 2. Set _list[UserToken] = block.timestamp + 1 days - Side Effects: Transfers Asset tokens; updates access timestamp - In Plain English: Enter the venue by paying the cover charge (if any). Once inside, you can chat and participate. Your access lasts 24 hours before you need to pay again. Free venues require no payment.

Chat

function Chat(LAU UserToken, string memory MSG) public
- Access: public - Parameters: - UserToken (LAU): User's LAU token contract - MSG (string): Message content to broadcast - Description: Sends a chat message visible to all venue members. - Logic Flow: 1. Check token not forbidden: if(Map.Forbidden(Asset)) revert 2. Verify LAU permissions: Cho.VerifyUserTokenPermissions 3. Check admission: if(!Admitted(UserToken)) revert NotAdmitted 4. Check cover paid: if(CoverCharge != 0 && !access) revert PayCover 5. Emit LogEvent(Username, Soul, Aura, MSG) - Side Effects: Emits LogEvent (permanent on-chain message) - In Plain English: Send a message visible to everyone in the venue. You must be admitted (meet token/guest requirements) and have paid any cover charge. Messages include your username and are permanently recorded on-chain.

Events

Event Parameters Description
Withdrawal Soul, Aura, Token, amount Token withdrawal
LogEvent Username, Soul, Aura, LogLine Chat message

Errors

Error Parameters Description
MarketRateCanOnlyBeIncreased Contract, CurrentRate Rate decrease blocked
TokenMaximumRate Contract, MaximumRate Rate exceeds limit
BouncerUnauthorized origin, account, what Not authorized
AlreadyJoined UserToken Already member
CoverChargeUnauthorized Asset, Amount Cover charge not paid
PayCover Asset, CoverCharge Must pay to enter
Forbidden Asset Token is forbidden
NotAdmitted Soul User not admitted

Contract Interactions

Depends On

Created By

  • MAP - Primary QING creation
  • GWAT - Derivative QING creation

Special Mechanisms

GWAT Detection

if(Luo % 476733977057179 == 0) GWAT = false;
else GWAT = true;

Bouncer Logic

function bouncer(address cBouncer) public view returns (bool) {
    // Staff always authorized
    if(_staff[cBouncer]) return true;

    // CROWS holders (25+) if enabled
    if(NoCROWS == false && CROWS.balanceOf(cBouncer) >= 25 * 10 ** 18)
        return true;

    // Large holders of wrapped asset
    if(Asset.balanceOf(cBouncer) >= Asset.totalSupply() / BouncerDivisor)
        return true;

    // Asset owner
    if(Map.hasOwner(address(Asset)))
        return Asset.owner(cBouncer);

    return false;
}

Cover Charge System

function Join(address UserToken) public {
    if(CoverCharge > 0 && _list[UserToken] < block.timestamp) {
        Asset.transferFrom(msg.sender, address(this), CoverCharge);
    }
    _list[UserToken] = block.timestamp + 1 days;
}

Chat Authorization

function Chat(LAU UserToken, string memory MSG) public {
    if(Map.Forbidden(address(Asset))) revert Forbidden(address(Asset));
    Cho.VerifyUserTokenPermissions(address(UserToken));
    if(!Admitted(address(UserToken))) revert NotAdmitted(_soul);
    if(CoverCharge != 0 && !(_list[address(UserToken)] > block.timestamp))
        revert PayCover(address(Asset), CoverCharge);
    emit LogEvent(UserToken.Username(), _soul, aura, MSG);
}

Contract Verification

Property Value
Keccak256 Hash 0x8baee5f38fe2494460f92c8b085a971c797db64ab4c744b504c37153882d20cc
Source URL https://raw.githubusercontent.com/busytoby/atropa_pulsechain/main/solidity/dysnomia/domain/dan/03_qing.sol
Hash Generated 2026-02-08T00:29:08Z