WAR¶
Overview¶
WAR is the game mechanics contract for territory warfare and resource generation. It manages H2O (water) token minting and CO2 accumulation based on player activities.
- Kind: Contract
- License: Sharia
- Solidity: ^0.8.21
- Source:
domain/dan/04_war.sol
Inheritance Chain (C3 Linearized)¶
- self — WAR
- DYSNOMIA
- MultiOwnable
Immediate Parents¶
What This Means For Players¶
Plain English Summary: WAR is the battle system - fight for territory and earn water (H2O). When you contest positions in the distribution queue, WAR calculates your power and rewards you with H2O tokens if you beat previous records. It's the competitive element of the game where actions lead to resource generation.
Real-World Analogy: Imagine a game show where contestants compete for prizes by setting high scores. WAR is like that scoreboard - when you beat a previous record at a position, you win water tokens as a reward. The game also tracks "pollution" (CO2) as a side effect of all this activity.
How It Affects Your Gameplay: - Earn H2O - Beat high scores at positions to receive water tokens - Territory power - Your Waat value determines your strength at each position - CO2 tracking - Global pollution accumulates from WAR activities - Strategy - Choose positions wisely to maximize your rewards
State Variables¶
| Variable | Type | Visibility | Mutability | Initial Value | NatSpec |
|---|---|---|---|---|---|
Type |
string |
public | constant | WAR |
|
World |
WORLDINTERFACE |
public | mutable | `` | |
Water |
H2O |
public | mutable | `` | |
CO2 |
uint256 |
public | mutable | `` | |
_taan |
mapping(address => mapping(uint256 => uint256)) |
private | mutable | `` |
Constructor¶
constructor¶
constructor(address WorldAddress) DYSNOMIA("Dysnomia War", "WAR", address(DYSNOMIA(WorldAddress).Xiao()))
- Modifiers:
DYSNOMIA("Dysnomia War", "WAR", address(DYSNOMIA(WorldAddress).Xiao())) - Parameters: address WorldAddress
Functions¶
External & Public¶
Faa¶
- Visibility: public
- Parameters: address Caude, uint256 Position
- Returns: uint256 Waat
Inherited Members¶
This contract inherits the members below from its parents. See each parent's dedicated MD for full signatures, NatSpec, and semantics.
From DYSNOMIA¶
External & Public Functions
| Function | Signature | State Mutability |
|---|---|---|
Rename |
function Rename(string memory newName, string memory newSymbol) public virtual onlyOwners |
nonpayable |
mintToCap |
function mintToCap() public onlyOwners |
nonpayable |
GetMarketRate |
function GetMarketRate(address _a) public view returns (uint256) |
view |
Purchase |
function Purchase(address _t, uint256 _a) public |
nonpayable |
Redeem |
function Redeem(address _t, uint256 _a) public |
nonpayable |
name |
function name() public view virtual returns (string memory) |
view |
symbol |
function symbol() public view virtual returns (string memory) |
view |
decimals |
function decimals() public view virtual returns (uint8) |
view |
totalSupply |
function totalSupply() public view virtual returns (uint256) |
view |
balanceOf |
function balanceOf(address account) public view virtual returns (uint256) |
view |
transfer |
function transfer(address to, uint256 value) public virtual returns (bool) |
nonpayable |
allowance |
function allowance(address owner, address spender) public view virtual returns (uint256) |
view |
approve |
function approve(address spender, uint256 value) public virtual returns (bool) |
nonpayable |
transferFrom |
function transferFrom(address from, address to, uint256 value) public virtual returns (bool) |
nonpayable |
Internal Functions
| Function | Signature |
|---|---|
_addLibraryOwner |
function _addLibraryOwner(VOID Void, string memory what) internal |
_mintToCap |
function _mintToCap() internal |
_addMarketRate |
function _addMarketRate(address _a, uint256 _r) internal |
_transfer |
function _transfer(address from, address to, uint256 value) internal |
_update |
function _update(address from, address to, uint256 value) internal virtual |
_mint |
function _mint(address account, uint256 value) internal |
_approve |
function _approve(address owner, address spender, uint256 value) internal |
_spendAllowance |
function _spendAllowance(address owner, address spender, uint256 value) internal virtual |
Events
| Event | Parameters |
|---|---|
Transfer |
address indexed from, address indexed to, uint256 value |
Approval |
address indexed owner, address indexed spender, uint256 value |
Errors
| Error | Parameters |
|---|---|
MarketRateNotFound |
address asset |
DysnomiaInsufficientBalance |
address origin, address sender, address from, address to, address what, uint256 balance, uint256 needed |
DysnomiaInsufficientAllowance |
address origin, address sender, address owner, address spender, address what, uint256 allowance, uint256 needed |
State Variables (private parent storage is not reachable and is omitted)
| Variable | Type | Visibility | Mutability |
|---|---|---|---|
__name |
string |
internal | mutable |
__symbol |
string |
internal | mutable |
MotzkinPrime |
uint64 |
public | constant |
Xiao |
atropaMath |
public | mutable |
maxSupply |
uint256 |
public | mutable |
From MultiOwnable¶
External & Public Functions
| Function | Signature | State Mutability |
|---|---|---|
owner |
function owner() external view virtual returns (address) |
view |
renounceOwnership |
function renounceOwnership(address toRemove) public virtual onlyOwners |
nonpayable |
addOwner |
function addOwner(address newOwner) public virtual onlyOwners |
nonpayable |
Internal Functions
| Function | Signature |
|---|---|
_checkOwner |
function _checkOwner() internal view virtual |
_changeOwnership |
function _changeOwnership(address cOwner, bool cState) internal virtual |
Events
| Event | Parameters |
|---|---|
OwnershipUpdate |
address indexed newOwner, bool indexed state |
Errors
| Error | Parameters |
|---|---|
OwnableUnauthorizedAccount |
address origin, address account, address what |
OwnableInvalidOwner |
address origin, address owner, address what |
Modifiers
| Modifier | Parameters |
|---|---|
onlyOwners |
(none) |
Contract Interactions¶
Depends On¶
- DYSNOMIA V2 - Base functionality
- WORLD - World state
- META - Ring calculations
Creates¶
- H2O - Water token
Depended On By¶
- GWAT - Uses Faa for spawning
Special Mechanisms¶
Faa Calculation¶
function Faa(address Caude, uint256 Position) public returns (uint256 Waat) {
uint256 Buzz = World.Tail(Caude, Position);
if(Buzz == 0) return 0;
// Get player YUE
(YUEINTERFACE Chi, ) = World.Cheon().Sei().Chi();
// Get Ring parameters
(uint256 Phoebe, uint256 Iota, uint256 Chao, uint256 Charge) = World.Meta().Ring().Eta();
// Calculate Waat
Waat = Xiao.modExp(Phoebe, Charge, World.Map().Map().Meridians(89));
// If new high, mint rewards
if(Waat > _taan[Caude][Position]) {
Water.Mint(address(Chi), Iota);
CO2 += Chao;
}
}
Resource Generation¶
- H2O: Minted to player's YUE when Waat exceeds previous
- CO2: Accumulated globally as side effect
Constructor¶
constructor(address WorldAddress) {
World = WORLDINTERFACE(WorldAddress);
World.Cheon().Sei().Chan().addOwner(address(this));
Water = new H2O(address(this));
}
Contract Verification¶
| Property | Value |
|---|---|
| Keccak256 Hash | 0x55bf6112d383d200c30d129c9fa6a82c3713105e757a5a0ef3656cf4092a9738 |
| Source URL | https://raw.githubusercontent.com/busytoby/atropa_pulsechain/main/solidity/dysnomia/domain/dan/04_war.sol |
| Hash Generated | 2026-04-17T20:48:11Z |