Skip to Content
X404 Protocol docs
Official documentation/ X404 Social Games
X404 · Official documentation v1

Creating an independent game

Factory parameters, formal governance and instance isolation.

Create a game independently#

Game modes: Choose 1 / 3 / 9 (no elder), 1 / 3 / 9 / 27, or 1 / 2 / 4 / 8 (with elders) at creation. The mode cannot change afterward. Three-way modes require three recruits per warrior and split into three tribes; the two-way mode requires two recruits per warrior and splits into two tribes. Counts and rewards below illustrate the default 1 / 3 / 9 mode. Elder modes also award elder promotion mining power (900 by default), totaling 12,100 mining power from paid admission through retirement at default settings. Always check the selected game’s configuration.

During initialization the creator can save initial settings, but recruitment, wars and issuance stay closed. Completing initialization permanently removes the creator’s parameter-editing rights while preserving creator and LP principal-beneficiary identity. Afterwards, settings, recipients, issuance, buybacks and extension permissions require an operations proposal and reviewer approval.

Operations edits current values and submits a proposal without changing active settings. The reviewer checks targets, amounts and changes under Parameters and review, then approves the exact stored batch. Execution is atomic and failure rolls back the batch. Proposals expire after 7 days; each approval invalidates other proposals for the old configuration revision. Game approval requires no further platform multisig or additional timelock.

Replacing either account requires the current operations account to propose setReviewConfiguration and the current reviewer to approve. Old accounts lose their replaced authority immediately; all three addresses remain distinct. The creator cannot intervene, and transferOwnership cannot remove approval. Recipients and LP principal rights do not change with role rotation.

Future entry fees and mining power awards, recruitment, war rules, buybacks and payout addresses are adjustable. Allocation, ordinary trading rates and initial pool plans may change only before issuance. Creator identity, fixed entry splits, issued supply and decimals, and permanent game LP cannot change. Existing balances, paid amounts, started-war snapshots and executed locks are not recalculated.

Current first-version rules: recruit 100 (default admission mining power, configurable per game) → warrior 300 → chief 2,700 → retirement 8,100 mining power. Each milestone pays separately when reached, totaling 11,200 for a full cycle at the default. Paid re-entry can earn subsequent actual promotions again. Free seed warriors receive neither admission nor initial warrior rewards. Taking over a seat (paid takeover or accepted transfer) pays the admission and warrior amounts on that seat's first handover (after an accepted transfer, once the new holder fills the seat); later paid takeovers pay only admission and later transfers pay nothing. Replacement is not retirement.

mining power uses the game’s 6-decimal Honor.goldBalance ledger. Admission, promotion, retirement and the one-time profile reward also increase lifetime combat power; tasks, wars, sales and ordinary extensions increase mining power only. points represents non-spendable lifetime combat power, not another balance; spending mining power does not reduce it. Country creation/joining costs default to 10,000 / 20 mining power and may be changed by game governance. Initial prestige contributes to lifetime combat power; leaving removes the country contribution and rejoining adds it once.

Each game has its own mining power redemption pool. Availability, claim times and actual redemption results are determined by the game page and on-chain transactions.

Entry, Warrior, Chief and retirement rewards are editable during creation, defaulting to 100 / 300 / 2,700 / 8,100 whole mining power. Each must be 1–1,000,000. The factory promotionRewards tuple uses Warrior, Chief, retirement order. After creation, the game operation wallet changes those four with setPromotionRewards and entry rewards with setGameConfig. Changes affect future awards only; existing balances and combat power are not recalculated.

Game tokens default to 6 decimals. The creator may select an integer from 0–18, including 0; decimals cannot change after issuance. One token equals 10^decimals base units: at 6 decimals, 1 token = 1,000,000 base units. Calculations use exact base units and the UI formats actual precision. mining power uses 6 decimals and BNB keeps 18 decimals; rates use bps and lifetime combat power uses integers.

The factory creates independent X404 social fission game instances. One transaction deploys the game proxy and independent Honor, Treasury, Extensions, PvP and Characters modules, registers the game in GameRegistry and hands over governance. The X404LiveAirdrop mining power redemption pool is created later during token issuance. Teams can call the factory from their own websites or scripts.

Creation requires operations manager and reviewer addresses, both distinct from the creator and each other, and separate from the backend signer. The creator is the game administrator for creation and initialization only. The factory atomically deploys the game and X404GameAdministration; the game owner is this immutable approval contract.

SDK call#

ts
const factory = new ProtocolContract('X404GameFactory', FACTORY_ADDRESS, signer);
const request = factory.prepare('createGame', [creation]);
// 开关已开放且钱包有剩余白名单额度,才能由用户钱包发送。
const receipt = await (await signer.sendTransaction(request)).wait();
const registry = new PlatformClient(REGISTRY_ADDRESS, provider);
const entries = await registry.games(0n, 20);

createGame / createCustomGame are shared by local and public chains. The creator, operations and reviewer addresses must all differ; public-chain platform governance still requires a verified Safe multisig timelock.

The factory constructor takes (implementation, social, protocolFeeRecipient, platformAdmin, operationsAdmin, initialCreator). Deployment creates a platform with zero games; all games use the normal creation entry points subject to whitelisting and quotas.

Isolation and Sharing#

Different games share social protocols and factory implementations; mining power, honor, kingdom, war, treasury and management are independent. A wallet can have different mining power, levels in different games and a self-created kingdom.

The registry records the creator, module address, governance, deployment block, and creation name. Subsequent renaming uses game configuration and GameConfigUpdated to update the application display, and it cannot be assumed that the registry creation snapshot is automatically synchronized.

Customize the boundaries of gameplay#

The factory can configure existing parameters and does not accept any implementation, any ledger algorithm or any external token replacement. Custom membership applications, own token economies, and new games should combine a common social layer with their own business contracts.

User-defined themes and economic terms#

The creation page has no theme templates. createCustomGame(Creation, Settings, tokenName, tokenSymbol) saves themes, role titles, token name/symbol/supply/decimals, initial trading rates and buyback limits. Entry distribution is fixed and absent from Settings. entryFee must be a positive multiple of 200 wei. The Treasury's configuration() identifies the initial X404GameConfig; read its getTokenConfig() for effective trading rates. Operations may propose rate changes before issuance, subject to reviewer approval. First-LP activation fixes rates; activation also requires approval of a proposal using the latest configuration.

Platform Protocol Fee#

Normal entry payments are distributed as shares of the gross payment in every game: players always receive 85% (recruiting warrior 50%, chief 35%), which creators and administrators cannot change. The remaining 15% is configured through a platform operations proposal approved by the platform reviewer, defaulting to social protocol fee 1%, platform service fee 1%, game team 4%, game Treasury 2% and the inviter's kingdom 7%. The fees are included in the original payment and do not dilute player shares. Without a chief, the entire 35% chief share goes to the team, bringing the team share to 39% of the gross payment; when the inviter has no kingdom, the kingdom share goes to the project revenue wallets, bringing the default team total to 11% with a chief or 46% without one. The positive entry fee must be a multiple of 200 wei so every share is exact. Paid warrior replacement costs the current entry amount of the zone the seat is in (0.2 BNB by default in the entry zone); it first deducts the protocol and service fees (2% in total by default) and splits the remainder equally between the team and the Treasury (49% each by default). Gas, token trading taxes and DEX fees are separate.

X404GameFactory Must be specified when deploying protocolFeeRecipientand create a non-upgradeable X404ProtocolFees. All new games are atomically bound to the same collection contract before opening, and creators cannot choose the rate or change the collection contract. The fees are directly included in the platform collection contract and are independent of the game treasury, repurchase budget, and the game team’s unclaimed funds.

Admission does not call the platform wallet, so a rejecting recipient cannot block entry. Anyone may call withdraw(recipient) without recipient signatures, but the argument must equal the currently approved recipient. Only platform Safe multisig and a timelock of at least 1 hour may change that address. Unpaid fees then go to the new address; completed payments are not recovered. Receiving into a Safe requires no signatures; later spending follows the Safe rules. Failed withdrawal preserves the balance, and forced donations are excluded. gameFees(game) and totalCollected are cumulative; claimable is the unpaid balance across games. Index ProtocolFeeCollected, ProtocolFeesWithdrawn and ProtocolFeeRecipientChanged on the collector.

Game administrators cannot reset the binding. Core game UUPS upgrades can be executed only by the factory-fixed platform governance, not the creator's operating multisig. Malicious platform upgrades or separately deployed third-party factories remain governance and provenance trust boundaries. Local verification uses independent test wallets; formal deployment requires the real platform recipient.

Select repurchase destination when creating#

Settings.buybackMode: 0 buys tokens into the dead address (default); 1 buys tokens and adds liquidity. Buybacks can be enabled after initial liquidity. The creator cannot bypass approval. See Economic mechanism. Both minTokensPerBNB and minimumLPPerBNB default to 0. Zero disables the corresponding minimum quantity requirement, with no guaranteed minimum; positive values enforce that floor. After issuance, either value can still be changed by an operations proposal approved by the reviewer.

Unified transaction agreement and tax rate#

Settings.dexFamily Required: 0 is PancakeSwap V2, 1 is PancakeSwap Infinity CL, 2 is Uniswap V4; 3 is Uniswap V2. The creation page shows only the current chain's X404DexRegistry Configured protocol. Select Fixed after creation. Router, PoolManager, Vault and adapter factories are deployed and configured by the platform and are not filled in by each game.

Regular rates default to 2% and can be configured before issuance from 0–5% (0–500 bps), in steps of 0.01%. V2 token.buyTaxBps and token.sellTaxBps are independent; token.poolFeeBps must be 0. The token collects these taxes and the DEX native pool fee is additional. V4 / Infinity CL ordinary buy/sell taxes must be 0; token.poolFeeBps can be 0–500 and is the LP pool fee, collected directly by the DEX core.

Initial rates are selected during creation. After initialization, rate changes require operations proposals and reviewer approval; the creator cannot bypass approval. Rates may be reconfigured before issuance. A rate change increments launchNonce, invalidating old activation requests; an activation proposal must reference the latest approved version and be approved by the reviewer. Rates are immutable after issuance and both pools share the same set. X404GameConfig holds the initial creation terms; read the treasury’s getTokenConfig() for effective current rates.

V2 collects only its configured buy and sell taxes. Uniswap V4 / Infinity CL uses native static pool fees with a zero Hook address. There is no opening anti-sniping tax or waiting period.

CL pools allow permissionless initialization. Issuance accepts an existing pool only when its initial price exactly matches the approved budgets and current active liquidity is zero; otherwise the entire issuance reverts. Zero active liquidity does not prove there are no out-of-range positions. An attacker who predicts the token address can still initialize at a wrong price and block issuance. A pool without Hooks does not eliminate this denial-of-service risk.

Before issuance, use prepareFeeBeneficiaries to configure V4 fee wallets and shares; the default beneficiary is the game creator. The UI requires an explicit project income wallet for V2 trading taxes and V4 LP fees after the protocol share. Anyone may trigger claims, but cannot redirect payment or withdraw locked principal: first-launch LP is permanently locked by default (or time-locked for a term chosen before launch), and buyback-added LP is always permanently locked. Changing the payout wallet requires the game operation wallet.

adapter.liquidityLock() returns the permanent position vault for that pool. Buyback additions increase the same position without creating more NFTs. Use CLPositionLockClient to settle and claim fees, and watch CLPositionLocked. Personal deposits may still use term locks.

Admin Center Guide

Tokens and pools require separate explicit activation#

Before issuance, use prepareFeeBeneficiaries to configure V4 fee wallets and shares; the default beneficiary is the game creator. The UI requires an explicit project income wallet for V2 trading taxes and V4 LP fees after the protocol share. Anyone may trigger claims, but cannot redirect payment or withdraw locked principal: first-launch LP is permanently locked by default (or time-locked for a term chosen before launch), and buyback-added LP is always permanently locked. Changing the payout wallet requires the game operation wallet.

Protocol share of trading income and LP lock policy#

The protocol share of trading income defaults to 25% and may be changed only by platform governance through setTradingFeeShareBps. Each V2 tax conversion and V4/Infinity LP fee claim uses the current rate, including existing games and income accrued before the change but still unclaimed. Already paid income is not recalculated. The share is deducted from trading income, separately from the fixed 1% entry fee; locked principal is never charged. The protocol portion is paid directly to the currently approved Treasury.protocolFees().recipient. Platform Safe multisig and a timelock of at least 1 hour may change it through X404GameFactory.setProtocolFeeRecipient(expectedRecipient, newRecipient). All unpaid protocol BNB, subsequent trading-income payouts and future token tickets use the current address, including existing games. The game portion uses its approved tax or official project LP fee destination; completed payments are not recovered.

First-launch game LP is permanently locked by default. When the platform has enabled timed locks and the game chose a lock term before launch, that LP is time-locked instead: after the unlock time only the game creator wallet can claim it, and the public game page shows the unlock time. Buyback-added LP is always permanently locked. Test deployments (BSC testnet and local chains only) let the creator wallet reclaim LP and are labelled as test deployments on public pages. termLiquidityLocksEnabled only controls new term or installment locks for personally deposited LP and starts enabled. It cannot change game LP or existing locks. Ordinary and team-token vesting is unaffected.

Open Finance and follow the current on-chain state and approval steps. After initialization, operations proposes and the reviewer approves. Check the game, network and wallet before submitting, and wait for confirmation before continuing.