H2O¶
Overview¶
H2O is the water token created by WAR. It represents a game resource with controlled minting and overflow mechanics.
- Inherits: DYSNOMIA V2
- License: Sharia
- Solidity: ^0.8.21
- Name: 水 (Chinese for "water")
What This Means For Players¶
Plain English Summary: H2O is the water currency - earned through battle (WAR) and representing your resources. When you beat high scores at territory positions, you earn H2O tokens. Water represents your accumulated battle rewards.
Real-World Analogy: Think of H2O like experience points or loot in a battle game. Every time you win a fight (beat a position record in WAR), you collect water as your reward. The more battles you win, the more water you accumulate.
How It Affects Your Gameplay: - Battle rewards - Earn H2O by beating records in the WAR system - Overflow protection - If you hold too much, excess flows to WORLD or gets burned - Resource token - H2O represents one of the core game currencies
State Variables¶
| Variable | Type | Visibility | Description |
|---|---|---|---|
| Type | string | public constant | "H2O" |
| War | WARINTERFACE | public | Reference to WAR |
Read Functions¶
Balance¶
- Access:public view
- Returns:
- uint256: H2O token balance held by the caller's YUE bank
- Description: Retrieves the H2O balance of the caller's YUE via the WAR contract chain.
- Logic Flow:
1. Get YUE from WAR chain: Yue = War.World().Cheon().Sei().Chi()
2. Return H2O balance: H2O(address(this)).balanceOf(address(Yue))
- Side Effects: None (view function)
- In Plain English: Check how much water (H2O) you have in your game bank. This is your accumulated battle rewards from WAR.Faa operations.
Write Functions¶
Mint¶
- Access:onlyOwners
- Parameters:
- To (address): Recipient address for minted tokens
- Amount (uint256): Amount of H2O to mint
- Description: Mints H2O tokens with overflow protection using Meridian thresholds.
- Logic Flow:
1. Mint to recipient: _mint(To, Amount)
2. Check recipient balance: _flip = H2O(address(this)).balanceOf(To)
3. Get max threshold: _max = War.World().Map().Map().Meridians(13)
4. If _flip > _max:
- Check WORLD balance: _flip2 = H2O(address(this)).balanceOf(address(War.World()))
- Get WORLD max: _max2 = War.World().Map().Map().Meridians(20)
- If _flip2 < _max2: transfer excess to WORLD
- Else: transfer excess to address(0x0) (burn)
- Computation Details:
- Meridians(13) defines player maximum holding threshold
- Meridians(20) defines WORLD maximum holding threshold
- Excess = _flip - _max (amount over player's limit)
- Side Effects: Mints tokens; may transfer excess to WORLD or burn to zero address
- In Plain English: Create new water tokens and give them to a player. If they already have too much (over Meridian[13] limit), the excess flows to WORLD if it has room, otherwise gets burned. This prevents hoarding and maintains economic balance.
Contract Interactions¶
Depends On¶
- DYSNOMIA V2 - Base functionality
- WAR - Owner and creator
Created By¶
- WAR - Constructor deployment
Special Mechanisms¶
Overflow Protection¶
function Mint(address To, uint256 Amount) public onlyOwners {
_mint(To, Amount);
uint256 _flip = H2O(address(this)).balanceOf(To);
uint256 _max = War.World().Map().Map().Meridians(13);
if(_flip > _max) {
uint256 _flip2 = H2O(address(this)).balanceOf(address(War.World()));
uint256 _max2 = War.World().Map().Map().Meridians(20);
if(_flip2 < _max2)
_transfer(To, address(War.World()), _flip - _max);
else
_transfer(To, address(0x0), _flip - _max); // Burn excess
}
}
Overflow Logic¶
- Mint requested amount
- If recipient balance > Meridian[13], excess flows out
- If WORLD balance < Meridian[20], excess goes to WORLD
- Otherwise, excess is burned (sent to address(0))
Initial Supply¶
Constructor mints initial supply equal to Call token's total supply:
maxSupply¶
Set to 0 to disable automatic minting mechanics:
Contract Verification¶
| Property | Value |
|---|---|
| Keccak256 Hash | 0x81ab4af65ad462172f93b1b0402735f9cff185ec6cf8412027eeed714c4020b4 |
| Source URL | https://raw.githubusercontent.com/busytoby/atropa_pulsechain/main/solidity/dysnomia/domain/assets/h2o.sol |
| Hash Generated | 2026-02-08T00:29:08Z |