WORLD¶
Overview¶
WORLD is the world simulation contract that manages territory, creation tracking, and reward distribution. It coordinates between players, geographic locations, and the economic system.
- Inherits: DYSNOMIA V2
- License: Sharia
- Solidity: ^0.8.21
What This Means For Players¶
Plain English Summary: WORLD is the territory system - where you claim land and earn creator rewards. When you "Code" at a location, you're planting your flag there and earning VITUS tokens (creator credits). The more territory you control, the more rewards you receive when distributions happen.
Real-World Analogy: Think of WORLD like a virtual real estate system. You can stake claims on territory near venues (QINGs), and as the game economy grows, landowners receive dividends proportional to their holdings. It's like owning property that pays rent.
How It Affects Your Gameplay:
- Claim territory - Use Code() to register your presence at a location near a QING
- Earn VITUS - Successful coding earns you creator credits
- Receive distributions - Token owners can distribute rewards to territory holders
- Range limits - You can only code within a certain range of a QING's position
State Variables¶
| Variable | Type | Visibility | Description |
|---|---|---|---|
| Type | string | public constant | "WORLD" |
| Cheon | CHEON | public | Reference to player management |
| Meta | META | public | Reference to meta calculations |
| Vitus | VITUS | public | Creator reward token |
| Map | MAPINTERFACE | public | Reference to MAP contract |
| _world | mapping(int256 => mapping(int256 => mapping(address => uint256))) | private | Position/Token → amount |
| _cauda | mapping(address => int256[]) | private | Token → latitudes |
| _creation | mapping(int256 => address[]) | private | Latitude → creators |
| _creators | mapping(int256 => mapping(address => mapping(address => uint256))) | private | Creation tracking |
| _whitelist | mapping(address => mapping(address => bool)) | private | Distribution whitelist |
Read Functions¶
Bun¶
- Access:public view
- Parameters:
- Latitude (int256): Map latitude coordinate
- Longitude (int256): Map longitude coordinate
- Caude (address): Token/QING address to query
- Returns:
- uint256: Amount held at this position for the specified token
- Description: Queries the world mapping for territory amount at a specific coordinate.
- Computation Details:
- Returns _world[Latitude][Longitude][Caude]
- In Plain English: Check how much territory you own at a specific map coordinate for a given token. Like looking up your property holdings at a location. Returns 0 if no claims exist there.
Buzz¶
- Access:public view
- Parameters:
- Latitude (int256): Map latitude coordinate
- Coder (address): Creator's address (typically a YUE wallet)
- Caude (address): Token/QING address
- Returns:
- uint256: Creator's accumulated Deimos amount at this latitude
- Description: Queries the creators mapping for a specific creator's holdings at a latitude.
- Computation Details:
- Returns _creators[Latitude][Coder][Caude]
- In Plain English: Check how much a specific player has created at a latitude band. The returned value is the sum of all Deimos earned from Code() calls. Useful for seeing who owns what territory in a region.
Tail¶
- Access:public view
- Parameters:
- Caude (address): Token/QING address
- Position (uint256): 1-indexed position in the distribution queue
- Returns:
- Bid (uint256): Creator's holdings at that position
- Description: Navigates through latitude bands and creators to find the holdings at a specific queue position.
- Logic Flow:
1. Iterate through _cauda[Caude] (latitudes with activity)
2. For each latitude, check if Position > number of creators at that latitude
3. If yes, subtract creator count and continue to next latitude
4. If no, return _creators[latitude][creation[position-1]][Caude]
5. Return 0 if position exceeds total creators
- In Plain English: See the reward amount at a specific position in the distribution line. Position 1 is the first creator to receive distributions. Useful for estimating when you'll receive rewards.
Write Functions¶
Whitelist¶
- Access:public (but restricted by ownership check)
- Parameters:
- Caude (address): Token/QING address controlling the whitelist
- Distributive (address): Address to allow/deny distribution rights
- Allow (bool): True to allow, false to revoke
- Description: Token owner or WORLD owner can whitelist addresses for distribution.
- Logic Flow:
1. Check if caller is WORLD owner OR is owner of the QING at Caude address
2. If authorized: set _whitelist[Caude][Distributive] = Allow
- Side Effects: Updates _whitelist mapping
- In Plain English: Approve who can send rewards on behalf of a token. Only the token owner or WORLD admin can set this. Setting address(0x0) to true allows anyone to distribute for that token. Prevents unauthorized distributions.
Distribute¶
function Distribute(address Caude, address Distributive, uint256 Amount) public returns (uint256 Remaining)
public
- Parameters:
- Caude (address): Token/QING address whose creators receive distribution
- Distributive (address): Token address being distributed (must approve this contract)
- Amount (uint256): Total amount to distribute
- Returns:
- Remaining (uint256): Amount not distributed (due to minimum thresholds or no creators)
- Description: Distributes tokens to creators proportionally based on their holdings.
- Logic Flow:
1. Check whitelist: if _whitelist[Caude][0x0] and _whitelist[Caude][Distributive] are both false, return full Amount
2. For each latitude in _cauda[Caude]:
- If Amount <= 1111111111, stop (minimum threshold)
- Calculate _pdist = Amount / remaining_latitudes / creators_at_latitude
- If _pdist <= 1111111111, skip this latitude
- For each creator at this latitude:
- Calculate Charge = creator_holdings % _pdist
- If Charge > 0: transfer Charge from caller to creator
- Subtract Charge from Amount and from creator's holdings
3. Return remaining Amount
- Computation Details:
- Minimum distribution threshold: 1,111,111,111 wei
- Uses modulo to determine distribution amount per creator
- Reduces creator holdings as distributions occur
- Side Effects: Transfers Distributive tokens; reduces _creators values
- In Plain English: Send token rewards to all territory owners based on how much they own. Creators receive shares proportional to their holdings - like paying dividends to shareholders. Caller must have approved this contract to spend their Distributive tokens.
Code¶
- Access:public
- Parameters:
- Latitude (int256): Target latitude coordinate for claim
- Longitude (int256): Target longitude coordinate for claim
- Cause (address): QING address you're claiming territory for
- Description: Claims territory at a location near a QING, minting VITUS rewards.
- Logic Flow:
1. Get QING's Waat: QingWaat = QING(Cause).Waat()
2. Verify Cause matches registered QING: assert(Cause == Map.GetQing(QingWaat))
3. Get caller's YUE wallet: (Chi, ) = Cheon.Sei().Chi()
4. Get caller's Charge from CHEON: (Charge, Hypobar, ) = Cheon.Su(Cause)
5. Get META values: (Dione, , Deimos, Yeo) = Meta.Beat(QingWaat)
6. Get QING's position: (qlat, qlon) = Map.Map().Compliment(QingWaat)
7. Range check - revert OutOfRange if:
- Latitude > qlat + Yeo or Latitude < qlat - Yeo
- Longitude > qlon + Yeo or Longitude < qlon - Yeo
8. If Charge == 0, return (no reward)
9. If Charge >= current holdings at position:
- Add to world: _world[Latitude][Longitude][Cause] += Hypobar
- Mint VITUS: Vitus.Mint(address(Chi), Dione)
- Track creator: if new, push to _creation[Latitude]
- Add Deimos: _creators[Latitude][address(Chi)][Cause] += Deimos
- Computation Details:
- Yeo = range limit from META.Beat() (scaled by Chao)
- Dione = VITUS reward amount
- Deimos = creator tracking amount
- Hypobar = territory value added
- Side Effects: Updates _world, _creation, _creators mappings; mints VITUS to caller's YUE
- In Plain English: Claim territory at a map location near a venue! You must be within Yeo range of the QING's registered position. If you have enough Charge, you earn VITUS tokens (Dione amount) sent to your YUE wallet, and your creator holdings (Deimos) are tracked for future distributions.
Errors¶
| Error | Parameters | Description |
|---|---|---|
| OutOfRange | QingLatitude, QingLongitude, Range | Position too far from QING |
Contract Interactions¶
Depends On¶
- DYSNOMIA V2 - Base functionality
- CHEON - Player management
- META - Calculations
- MAP - Geographic registry
Creates¶
- VITUS - Creator reward token
Special Mechanisms¶
Range Validation¶
function Code(int256 Latitude, int256 Longitude, address Cause) public {
// Get QING position
(int256 qlat, int256 qlon) = Map.Map().Compliment(QingWaat);
// Yeo is the range from META
if(Latitude > qlat + int256(Yeo)) revert OutOfRange(...);
if(Latitude < qlat - int256(Yeo)) revert OutOfRange(...);
// Same for longitude...
}
Creator Tracking¶
if(_creators[Latitude][address(Chi)][Cause] == 0)
_creation[Latitude].push(address(Chi));
_creators[Latitude][address(Chi)][Cause] += Deimos;
Distribution Algorithm¶
for each latitude in _cauda[Caude]:
for each creator at latitude:
charge = creator_amount % per_distribution
transfer charge to creator
subtract from creator_amount
VITUS Minting¶
Successful Code() operations mint VITUS to the player's YUE:
Contract Verification¶
| Property | Value |
|---|---|
| Keccak256 Hash | 0x352f6bbc5542e916d30bd52a890f251241111389a034d177fe6a51d4c6011c7f |
| Source URL | https://raw.githubusercontent.com/busytoby/atropa_pulsechain/main/solidity/dysnomia/domain/world.sol |
| Hash Generated | 2026-02-08T00:29:08Z |