Skip to main content

Smart Contracts

All GlobalPVP contracts are deployed on Base Sepolia (chain ID 84532) and verified on-chain.

Contract Addresses

ContractAddress
NukeGame0x9545336eC3128eC5F8a4c051701043000e8550fD
NukeGameHook0xA74382Be4D858cde87c654b2c80536Ce0ce29288
CountryTokenFactory0x55bac0c80Dba66C9BF63e3630Cf51077fdd38DA0
GovernanceVoting0xF5088E81B15C8a24966044572DadEf96cD9513cC
CountrySwapRouter0x7C74Cde8D52Ba107034C5b2123eF89bC1B9f1018
PSABoard0x1Bdfd312F4Ae1117F6Dc8c233bF2c8C567a66d3b
Uniswap V4 PoolManager0x05E73354cFDd6745C338b50BcFDfA3Aa6fA03408

Contract Overview

NukeGame

The main game controller. Manages the game lifecycle, country initialization, staircase liquidity distribution, vote triggering, nuke execution, and ETH redistribution via buyback swaps.

Key functions:

  • startGame() — Begins the first countdown (owner only)
  • triggerVote() — Opens voting when countdown expires (anyone)
  • executeNuke(roundId) — Finalizes the vote and executes the nuke (anyone)
  • initializeCountry(name, symbol, countryCode) — Deploys and initializes a country (owner only)
  • batchInitializeCountries(names, symbols, codes) — Batch version of the above

Events:

  • GameStarted(countdownEnd)
  • CountryInitialized(countryCode, token, poolId)
  • VoteTriggered(roundId, winnerCountryCode)
  • CountryNuked(countryCode, roundId)

NukeGameHook

A Uniswap V4 hook that implements the dynamic fee system, anti-snipe protection, nuke window fees, and liquidity removal restrictions.

Permissions:

  • beforeSwap — Collects fee on exact-input swaps
  • afterSwap — Collects fee on exact-output swaps, updates volatility tracking
  • beforeRemoveLiquidity — Only allows the NukeGame contract to remove liquidity
  • afterInitialize — Seeds initial volatility state

Key state:

  • Per-pool volatility tracking (reference tick, accumulator, timestamps)
  • Anti-snipe activation timestamps per pool
  • Global nuke window flag

GovernanceVoting

Manages the on-chain voting system. Each round, the winning country's token holders vote on which country to nuke.

Key functions:

  • vote(roundId, targetCountry) — Cast a vote (weight = your token balance)
  • finalize(roundId) — Count votes and determine the target
  • rounds(roundId) — View round data (winner, timing, finalized status)

CountrySwapRouter

User-facing trading interface. Simplifies buying and selling country tokens by wrapping Uniswap V4 pool operations.

Key functions:

  • buyTokens(countryCode, minTokensOut) — Buy tokens with ETH (payable)
  • sellTokens(countryCode, tokenAmount, minEthOut) — Sell tokens for ETH

CountryTokenFactory

Deploys and tracks all country token contracts. Maintains a mapping from country codes to token addresses.

Key functions:

  • countryTokens(bytes2 code) — Get token address for a country
  • totalTokens() — Total number of deployed country tokens

CountryToken

Standard ERC20 with a nuked flag and country code identifier. Each has a fixed supply of 1 billion tokens.

PSABoard

Pay-to-post announcement board with dutch auction pricing. Floor price 0.005 ETH, doubles on each purchase, decays back to floor over 6 hours.

Key functions:

  • getCurrentPrice() — Current posting price
  • postMessage(message) — Post a PSA (payable)
  • current() — View the active PSA
  • getRecent(count) — View recent PSA history

Technical Details

  • Solidity version: 0.8.26
  • EVM version: Cancun
  • Optimizer: Enabled, 200 runs, via-IR
  • Uniswap V4: Pools use dynamic fees (0x800000 flag) with tick spacing 60
  • All liquidity is protocol-owned — No external LPs. The NukeGame contract owns all positions.
  • LP fees are zero — All trading fees go to the protocol fee recipient via the hook