KICKAIFM
← Play

Introduction

KICKAIFM — AI Football Manager on BASE

KICKAIFM is a fully on-chain competitive football manager where every player in your squad is powered by an AI brain. You build a team of 11 AI agents, train them, set tactics, upgrade your club's infrastructure, and compete in real $KICK-staked matches against other managers.

Unlike traditional football games, no outcomes are scripted. Matches are simulated deterministically server-side using each player's real trained stats, your tactical configuration, and a cryptographic seed — and the result is settled on-chain by the KICKAIFM oracle. Everything from player growth to prize distributions is governed by transparent smart contracts on BASE.

Core Loop: Train players → Upgrade Club → Set Tactics → Challenge & Win Matches → Earn $KICK → Reinvest

Key Numbers

MetricValue
Players per squad11
Skills per player7 (Pace, Shooting, Passing, Dribbling, Defense, Stamina, Decision)
Max skill value99
Upgrade asset types4 (Stadium, Merchandise, Advertising, Facilities)
Max upgrade tierT4 per asset (32 upgrade-points total)
Match duration (simulated)90 minutes / 5,400 ticks at 1 tick/sec
Match fee5% of prize pool → protocol treasury
$KICK emission modelProtocol emission rate split by each team emission score
Move library (bitmask)25 individual + team unlockable moves

Live on BASE

  • Network: BASE
  • Smart contracts: Solidity
  • Token standard: ERC-20
  • Wallet: any EVM wallet (MetaMask, Coinbase Wallet, WalletConnect…)
LabelAddressExplorer
KickToken (ERC-20)0x88d582BB02b893A2079913b4d7771AB99cf68d73To be updated
KickProtocol0xFb8E30b369D675E1EB41d96aC65C79C99673Fd96To be updated
KickMatch0xB636161b9DAa6D1AAb8d02365714853B29D463CTo be updated
KickOracle 0x1d92FD0114C6836cc2124108348c999ddd7bD06BTo be updated
Treasury0xaD781b5d1Acf8feEA41A4C6a9Dd8F71c0699aA6eTo be updated
Contract addresses are intentionally left blank until the next deployment is final. The app resolves live addresses through backend chain config; always verify addresses before interacting.

Architecture

KICKAIFM is split into three repositories that communicate through a strict trust boundary: the BASE smart contracts are the source of truth for all economic and match settlement; the backend runs the AI Agents engines that produce the match simulation and submits results via the oracle; the frontend is a read-mostly interface that never touches raw private keys except through the user's wallet adapter.

Request Flow

player trains → match happens
User Wallet
  │
  ├─▶ Next.js
  │     └─▶ REST API (Express)          — JWT auth via wallet signature
  │           ├─▶ Prisma DB             — read/write player/team state
  │           ├─▶ Training Engine       — XP calc, move unlocks, injury check
  │           └─▶ Oracle Service        — signs & submits contract transactions
  │
  └─▶ Solidity Contracts
        ├─ trainCollective()           — transfer $KICK + ETH, record stats
        ├─ resolveInjuryCheck()       — oracle-only, sets injuryUntil
        ├─ createMatchChallenge()     — escrow half prize pool
        ├─ acceptMatchChallenge()     — escrow opponent half, commit formation
        ├─ settleMatch()              — oracle-only, distribute winnings
        └─ claimRewards()             — distribute $KICK from emission share

Data Layers

LayerWhat lives here
Smart contractsKickToken (ERC-20), KickProtocol (core game), KickMatch (matches)
Postgres (Prisma)Off-chain mirror of on-chain state, match replay ticks, training history, revenue history
Redis (planned)Active WebSocket rooms, live match tick buffer, nonce store
Client store (Zustand)UI state, live match tick stream, squad & finance cache
The backend keeps an off-chain DB mirror of on-chain state so the frontend responds fast. The smart contracts are always the authoritative source — the DB is reconciled via event listeners on every oracle transaction confirmation.

Player Brain

Every one of your 11 players is an autonomous AI agent parameterised by a set of persistent on-chain stats. These stats directly influence every decision the match simulation engine makes on behalf of that player — from triggering a shot to winning a tackle. There is no hidden RNG bonus: better stats = higher probability of success.

Skill Attributes

SkillRangeWhat it controls in-match
Pace0–99Sprint speed, pressing effectiveness, chase-down tackles
Shooting0–99Shot trigger probability in the box, shot power vs defender
Passing0–99Pass accuracy, key-pass frequency, set-piece quality
Dribbling0–99Retention under pressure, 1v1 success, move execution probability
Defense0–99Tackle success rate, interception chance, block probability
Stamina0–99Rate at which fatigue builds, second-half performance drop
Decision0–99When to shoot vs pass, pressing triggers, position coverage

Player Roles

Each player has a PlayerRole that describes their behavioural archetype. Roles influence how stats are weighted during match decisions — a Poacher prioritises Shooting while a Playmaker leans on Passing and Decision.

RolePrimary statsBehaviour
BalancedAll equalStandard weighting; adapts to situation
PlaymakerPassing, DecisionSeeks to thread through-balls; holds ball under pressure
DestroyerDefense, StaminaHigh press intensity; prioritises disruption over attack
PoacherShooting, PaceMakes forward runs; has elevated shot-trigger probability
SweeperDefense, DecisionDrops into covering position; highest block/interception rate
WingBackPace, DribblingWide overlapping runs; contributes to both defence and attack
TargetManDefense, ShootingAerial duels; link-up play; holds up ball in box
DribblerDribbling, PaceCarries ball independently; higher chance of beating defender

Positions

Players are placed on the pitch according to their Position enum, mapped to normalised (x, z) coordinates defined per formation. Their initial coordinates are determined by formation and they drift toward goal or back into shape depending on possession and tactical settings.

PositionZone
GKGoalkeeper
CB, RB, LBDefensive line
CDM, CM, CAMMidfield (deep, central, advanced)
RM, LMWide midfield
CF, STAttacking line

XP & Diminishing Returns

Every training session grants XP. Raw XP is converted into skill points using a diminishing- returns formula: the more total XP a player has accumulated, the smaller the increment from each new session. This prevents pay-to-win scenarios where short-term grinding becomes exponentially effective — elite players require sustained investment.

The on-chain training instruction applies a diminishing-returns multiplier to raw XP: the multiplier starts at 1.0 for a fresh player and gradually floors at 10% as total accumulated XP grows. This ensures early gains are fast but elite players require sustained long-term investment — exact thresholds are not published.

Move Library (64-bit Bitmask)

Each player has a move_library: u64 — a 64-position bitmask where each bit represents an unlockable special move. Moves are unlocked automatically by the training engine when a player meets the required skill threshold and session count. Unlocked moves are factored into match simulation to trigger special animations and grant small probability bonuses.

CategoryMovesUnlock Skill / Min
DribbleRabona, Heel Flick, Elastico, Roulette, Step OverDribbling 60–75
ShootingFake Shot, Bicycle Kick, Trivela, Chip Shot, Low Driven, First-Time Volley, Knuckleball, Dipping FKShooting 55–85
PassingCorner InswingPassing 70
DefensiveSlide Tackle, Standing Block, Interception, Header ClearDefense 50–65
GK SpecialGK Rush, GK SweeperDecision 70–75
Team (collective)Team Press, Quick 1-2, Overlapping Run, Diagonal Ball, Wall Pass SetVarious + collective sessions
Team moves (bits 20–24) are only unlocked through collective training drillsand require the full team to have completed the minimum number of collective sessions.

Fatigue & Morale

fatigue accumulates with each training session — intensity × 10 points. Fatigue over a threshold blocks further training. It recovers passively at 5 + (facilities_tier × 3) points per hour. Higher Facilities tier dramatically accelerates recovery.

morale (0–100) is initialised at 80 and influenced by match outcomes and training consistency. High morale results in a slight up-tick to decision-making quality during matches.

Team Brain

Beyond individual skill, a football squad is more than the sum of its parts. KICKAIFM models collective intelligence via the chemistry stat (0–100) and a set of unlockable team behaviours called collective drills. Chemistry is the team's shared neural glue — it amplifies every player's effective stats during match simulation.

Chemistry (0–100)

Chemistry is stored per team on-chain. It is:

EventEffect on Chemistry
Collective training session+2 to +12 points (drill type × intensity)
Win a matchSmall passive boost (off-chain)
Player injury during matchSmall decrease (off-chain)
Maximum cap100

In match simulation, chemistry acts as a shared team modifier. It is mixed with each defender's defense stat when calculating defensive strength against shots:

During shot resolution, the engine combines the defender's defense stat with the team's chemistry score to produce a composite defensive strength value. Higher chemistry meaningfully raises the bar for attackers to score.

Collective Drills

Running a collective training session costs $KICK plus a small ETH fee, requires the on-chain cooldown window, and currently uses Fitness, Technical, or Chemistry drills. These sessions update selected players or team chemistry and feed the collective move unlock system in the move library bitmask.

Drill TypePrimary effectSession result
FitnessPACE / STAMINA / DEFENSE style growth3 / 4 / 5 selected players by intensity
TechnicalSHOOTING / PASSING / DRIBBLING / DECISION style growth3 / 4 / 5 selected players by intensity
ChemistryTeam cohesionChemistry gain, no individual stat gain
Chemistry training is the direct route to improving team cohesion. Technical and Fitness sessions spread stat growth across selected players and can trigger breakthrough gains.

Formation Commitment (Commit-Reveal)

When you create or accept a match challenge, you submit a hash of your formation using the match contract address, chain id, match id, wallet address, side flag, formation code, and a 32-byte salt. The actual formation is only revealed after both sides have committed, preventing opponents from counter-picking. The smart contract verifies the hash on-chain when you call revealFormation(matchId, formation, salt).

on-chain formation hash verification
bytes32 computed = keccak256(
  abi.encode(
    address(this),
    block.chainid,
    matchId,
    msg.sender,
    isChallenger,
    formation,
    salt
  )
);
require(computed == expectedHash, "Invalid formation reveal");

Training System

Training is the primary way to grow your squad. Players improve through individual sessions targeting a specific skill, collective squad sessions that raise stats or chemistry, and tactical scenario training that teaches decision patterns. Training spends $KICK and may include a small ETH fee depending on the on-chain action; upgrade payments are the main $KICK burn path.

Individual Training

IntensityCost$KICK flowXP WeightFatigue+
Soft (1)10 $KICK + 0.0002 ETHTransfer to protocol+10
Regular (2)20 $KICK + 0.0004 ETHTransfer to protocol+20
Intense (3)30 $KICK + 0.0006 ETHTransfer to protocol+30

You choose a SkillTarget (one of the 7 skills) and an intensity level. The training engine calculates:

training-engine.ts — XP pipeline
// 1. Base XP = session weight × facilities multiplier
const base_xp = BASE_SESSION_XP * session_intensity + (facilities_tier * FACILITIES_XP_BONUS);

// 2. Apply diminishing returns
const xp_gain = calculate_xp_gain(base_xp, player.total_xp);

// 3. Convert XP to skill points (capped at MAX_SKILL = 99)
const xp8 = Math.min(Math.floor(xp / 100), 255);
player[skillTarget] = Math.min(99, player[skillTarget] + xp8);

// 4. Accumulate total XP
player.total_xp += xp_gain;

// 5. Raise fatigue
player.fatigue = Math.min(MAX_FATIGUE, player.fatigue + intensity * 10);

Facilities Bonus

Upgrading your Facilities asset tier gives a multiplicative XP bonus per training session. Higher facilities also reduce injury risk and accelerate fatigue recovery. This makes Facilities the most direct multiplier on player development speed.

Facilities TierXP bonus per sessionFatigue recovery (pts/hr)Injury risk reduction
T0 (none)+0 bonus XP5 pts/hr0%
T1+1× FACILITIES_XP_BONUS8 pts/hr−15%
T2+2×11 pts/hr−30%
T3+3×14 pts/hr−45%
T4 (max)+4×17 pts/hr−60%

Collective Training

Any owner can run a collective training session once per cooldown window. All 11 players participate; the session raises team.chemistry and contributes toward unlocking team moves in every player's move library.

ParameterValue
Soft cost35 $KICK + 0.0006 ETH
Regular cost65 $KICK + 0.0012 ETH
Intensive cost100 $KICK + 0.002 ETH
Cooldown30 seconds (on-chain enforced)
Chemistry cap100
Team move sessions requirement1–5 sessions depending on the move

Tactical Scenario Training

Tactical scenarios are built in the Tactics view by placing players and the ball, adding action steps, then training the saved scenario. Scenario training transfers $KICK directly to treasury and can be amplified in one transaction.

AmplifierCostEffect
10 $KICKProcess the scenario once
50 $KICKReinforce the same pattern five times
10×100 $KICKStrongest reinforcement for the selected scenario

Injury System

After every individual training session, a pending injury check is flagged on the player account (pending_injury_check = true). The oracle resolves this server-side using a deterministic hash of a server-generated entropy value and the player ID.

Injury probability scales with the player's current fatigue and the session intensity; higher Facilities tier significantly reduces the chance. When an injury triggers, severity is classified as Minor (days), Moderate (up to ~10 days), or Severe (up to ~30 days) — determined deterministically by the oracle. Exact thresholds are internal to the oracle service.

An injured player (injury_until > block.timestamp) cannot be selected for training. They can still appear in match squads but with heavily reduced effective stats in the simulation engine.

Move Unlock Triggers

After every training session the backend runs checkMoveUnlocks() against the updated player snapshot. Any move whose skill threshold and session-count requirements are now met is automatically added to the player's move_library bitmask and persisted to the DB. Move unlocks are shown as real-time notifications in the UI.

Tactics & Player Decisions

The match simulation engine is a deterministic, seed-driven agent loop. Every tick (1 simulated second) each player acts according to their stats and the team's tactical configuration. There is no human intervention mid-match; formations are committed on-chain before the game, while trained tactical scenarios inform the backend AI engine.

Tactical Configuration

ParameterRangeEffect
pressingIntensity0–100How aggressively defenders close down the ball carrier
width0–100Horizontal spread of attacking runners
tempo0–100Speed of ball carrier movement toward goal; shot trigger modifier
defensiveLine0–100How high defenders position themselves (offside trap risk)
attackingMentality0–100Multiplied into shot trigger probability; higher = more attempts

Formations

FormationShapeBest for
F4334-3-3Balanced pressing and width; three active forwards
F4424-4-2Compact midfield block; dual striker threat
F3523-5-2Wide midfield control; overloads central zones
F4514-5-1Defensive discipline; counter-attack via lone striker
F5325-3-2Maximum defensive coverage; disciplined wing-backs
F42314-2-3-1Double pivot shield + attacking trident; control-heavy

Formation positions are mapped as normalised (x, z) coordinate pairs. The engine places all 11 players at their formation positions at kickoff and half-time, then each player drifts toward attack or defence based on possession and tick-level logic.

Tick-Level Decision Loop

Each of the 5,400 ticks runs the following decision pipeline: possession is tracked per-player, defenders close down the ball carrier, tackle and shot checks are resolved using each player's stats combined with the team's tactical configuration, and stamina decays gradually throughout the match. The exact coefficients and thresholds are internal to the simulation engine and not published to prevent exploitation.

How Stats Influence Decisions

StatDecision it influences
ShootingShot trigger probability and power in the box
DefenseTackle and interception success probability
Defense + ChemistryCombined shot-stop strength against incoming shots
StaminaPlayer effectiveness late-game; decays over match duration
PaceBall carrier movement speed and press recovery
DecisionGK special move triggers and situational awareness

Individual vs Team Intelligence

Individual stats determine micro-level outcomes: will this shoulder-barge succeed? Will this shot beat the keeper? Team chemistry and collective drills determine the macro shape: Does the midfield press as a unit? Do wingers time their overlapping runs? A squad of individually mediocre players with 100 chemistry can outperform disjointed superstars.

The match simulation seed is generated from a commit-reveal scheme: both teams commit formation hashes before the seed is finalised. This prevents either side from knowing the outcome in advance, making the result verifiable but unmanipulable.

Match System

Matches are peer-to-peer challenges backed by on-chain $KICK escrow. The full lifecycle — challenge creation, acceptance, simulation, oracle settlement, and prize distribution — is governed by the smart contracts. No third party can alter the outcome.

Single-match challenges are the active competitive mode. Season mode has been removed from the lobby. CPU matches are available for practice and do not use the same P2P escrow flow.

Full Match Lifecycle

match lifecycle
1. CHALLENGE CREATED
   Challenger calls createMatchChallenge(prizePool, formationHash)
   Minimum full prize pool: 10 $KICK (5 $KICK per side)
    └─ Half prize pool locked in contract escrow
    └─ formationHash = keccak256(abi.encode(matchContract, chainId, matchId, owner, side, formation, salt))

2. CHALLENGE ACCEPTED
    Opponent calls acceptMatchChallenge(matchId, formationHash)
   └─ Other half locked in escrow
   └─ Match status → InProgress
   └─ Backend detects event, queues simulation

3. FORMATIONS REVEALED
    Both managers call revealFormation(matchId, formation, salt)
   └─ On-chain hash verification
   └─ Formation stored in match state

4. SIMULATION (off-chain, backend)
   MatchEngine.simulate(homeTeam, awayTeam, seed)
   └─ seed derived from both team addresses and a recent block hash
   └─ 5,400 ticks computed deterministically by the backend engine
   └─ resultHash = cryptographic commitment to (seed, scores, events)

5. SETTLEMENT (oracle → on-chain)
   Oracle calls settleMatch(homeScore, awayScore, resultHash)
   └─ Match status → Settled
   └─ Winner gets prizePool − 5% fee
   └─ Draw → each team gets half back
   └─ W/D/L records updated on both teams
   └─ 5% fee → protocol treasury

Prize Distribution

ResultChallenger receivesOpponent receivesProtocol fee
Home win (challenger)prize_pool − 5%05% of prize_pool
Away win (opponent)0prize_pool − 5%5% of prize_pool
Drawprize_pool / 2prize_pool / 20 (no fee on draw)

Live Match Streaming

While the simulation runs server-side, every tick is streamed to connected clients via WebSocket. The frontend's Three.js renderer consumes these ticks in real time, smoothly interpolating 22 player positions and the ball on the 3D pitch. Clients can also request a replay of any past match using the REPLAY_REQUEST message type.

WS MessageDirectionPayload
SUBSCRIBEclient → server{ matchId }
MATCH_STARTserver → clientMatch metadata, team data
TICKserver → clientMatchTick: player positions, ball, events, score
EVENTserver → clientMatchEvent: GOAL, CARD, FOUL, etc.
MATCH_ENDserver → clientFinal score, resultHash
REPLAY_REQUESTclient → server{ matchId, fromTick }
REPLAY_CHUNKserver → clientArray of MatchTick[]

Match Events

Event TypeTrigger condition
KICKOFFTick 0 and after each goal
HALFTIMETick 2,700 (45 min)
FULLTIMETick 5,400 (90 min)
GOALShot succeeds: (shooting/99 × 0.65) > (defense + chem/2)/149
SHOT_SAVEDShot fails: 40% of near-miss cases
SHOT_BLOCKEDShot fails: 30% of near-miss cases
SHOT_WIDEShot fails: remaining cases
FOULTackle fails: 25% chance × (1 − defense/99)
YELLOW_CARDFoul: additional 30% chance
PENALTYFoul conceded inside penalty box
CORNERBall crosses goal-line by defending team
OFFSIDEAttacker ahead of last defender (future)

Finance & $KICK Token

$KICK is the native utility token of KICKAIFM. It is both the currency for all in-game actions and the source of protocol emissions for active teams. The current finance panel tracks wallet balance, live pending rewards, daily emissions, emission score, protocol share, and upgrade ROI.

$KICK Flows

Action$KICK directionNote
Create team1500 $KICK + 0.015 ETHOne-time team creation payment
Individual training10 / 20 / 30 $KICK + ETH feePlayer skill growth by intensity
Collective training35 / 65 / 100 $KICK + ETH feeSquad stat or chemistry training
Tactical training10 / 50 / 100 $KICKDirect transfer to treasury for 1x / 5x / 10x scenario training
Asset upgrade200 / 300 / 400 / 600 $KICK burned + ETH feeStarts a cooldown, then must be completed
Match challenge/acceptLocked in contract escrowReleased on settlement
Match winEscrow → winner walletPrize pool minus 5% fee
Claim revenueMinted → your wallet$KICK minted from protocol mint authority
Claim revenue ETH fee20% of reward value in ETH → treasuryQuoted before the wallet signs

Emission Score

Rewards accrue from the protocol emission rate according to your team's emission score. The frontend reads on-chain economy data and shows your score, total protocol score, protocol share, estimated daily emissions, and a smooth live pending counter between chain refreshes.

ComponentHow it affects finance
Emission scoreYour share weight in protocol emissions
Upgrade pointsPoints generated by infrastructure tiers
Stat pointsPoints generated by trained player strength and activity
Protocol shareYour score divided by all active team scores
Daily emissionsemissionRate × your protocol share × 86,400 seconds
finance panel — displayed daily emissions
protocolShare = myEmissionScore / totalEmissionScore
dailyEmission = emissionRateWeiPerSecond * protocolShare * 86400

// The UI snaps to on-chain pendingRewards every 2 seconds and interpolates
// between refreshes using the computed per-team emission rate.

Infrastructure Upgrades

Stadium, Merch Store, Ad Boards, and Facilities each have four paid tiers after the starting tier. Upgrading burns the listed $KICK amount, sends the listed ETH fee with the transaction, starts an on-chain cooldown, and then requires a separatecompleteUpgrade call once the timer is ready.

Next tier$KICK burnETH feeCooldown
T1200 $KICK0.003 ETH3 hours
T2300 $KICK0.005 ETH6 hours
T3400 $KICK0.008 ETH12 hours
T4600 $KICK0.012 ETH24 hours

Claiming Revenue

You claim accrued $KICK by calling claimRewards. Claims require at least1 $KICK pending on-chain. Before signing, the frontend requests a backend quote containing the pending $KICK and ETH fee. If the claim oracle is not configured, the claim button is disabled and rewards continue to accrue.

$KICK minted to your wallet100% of accrued tokens
ETH fee deducted20% of reward value in ETH → treasury
Backend confirmationClaim transaction hash is posted back for DB sync

Protocol Revenue Sources

SourceRateWhere it goes
Upgrade ETH fee0.003 / 0.005 / 0.008 / 0.012 ETHProtocol treasury wallet
Match settlement fee5% of prize poolProtocol treasury wallet
Revenue claim ETH fee20% of reward value in ETHProtocol treasury wallet
Team creation payment1500 $KICK + 0.015 ETHProtocol-defined team creation flow
Upgrade $KICK burnFull listed upgrade $KICK costBurned (deflationary)

Emission Score (Upgrade Points)

Upgrade tiers generate upgrade_points that contribute to your team's global emission score. The Finance panel also displays statPoints, so managers can see how much of their score comes from infrastructure versus squad development.

TierPoints per asset
T00
T11
T22
T34
T48

Max upgrade points = 4 assets × 8 points = 32 points. Combined with training stat points (max 16), total emission score ceiling is 48 per team.

Smart Contracts

The KICKAIFM Solidity contracts (KickToken, KickProtocol, KickMatch, and KickOracle) are the authoritative layer for economic decisions. They enforce access control, handle token transfers, manage match escrow, and store the canonical state of every team, player, economy account, and match on-chain.

Contract Functions

FunctionCallerWhat it does
initializeProtocolAdminBootstrap protocol state, set emission rate, fee bps, oracle authority
createTeamPlayerTransfer KICK + ETH and initialise the team record plus club economy state
initPlayerTeam ownerWrite each player slot's position and role on-chain after team creation
trainIndividualTeam ownerTransfer $KICK + ETH, apply XP, flag injury check
trainCollectiveTeam ownerTransfer $KICK + ETH, raise chemistry, enforce cooldown
initializeDefaultRosterTeam ownerInitialise the default 11-player on-chain roster when needed
resolveInjuryCheckOracleSet player injuryUntil from oracle-computed days
startUpgrade / completeUpgradeTeam ownerTransfer $KICK + ETH, increment tier, emit event
claimRewardsTeam ownerDistribute accrued $KICK, collect ETH claim fee
createMatchChallengeTeam ownerLock half prize pool in contract escrow, commit formation hash
acceptMatchChallengeAny team ownerLock other half, change status to InProgress
revealFormationBoth ownersVerify hash, store formation on-chain
settleMatchOracleVerify result, distribute winnings, update W/D/L records
cancelMatchChallengeChallengerRefund escrow if match still Open
timeoutMatch / claimRevealForfeitEligible callerResolve expired reveal or stale match states
updateProtocolAdminGovernance: update emission rate, fees, oracle key, treasury

Contract Storage

ContractKey MappingStores
KickProtocolteams[ownerAddress]Name, formation, W/D/L, chemistry, asset tiers, last claim ts
KickProtocoleconomies[ownerAddress]Emission score, upgrade points, stat points, pending rewards, reward debt
KickProtocolplayers[teamOwner][index]7 skills, fatigue, morale, XP, move library, injuryUntil
KickMatchmatches[matchId]Status, both team addresses, prize pool, hashes, scores
KickTokenERC-20 standardBalances, allowances, totalSupply, emission mint accounting

Token Operations

All token operations use the ERC-20 standard. The KickToken contract grants the KickProtocol contract minter privileges for distributing revenue. Match escrow is held directly by the KickMatch contract — no external key can unilaterally access it.

Oracle Service

The oracle is a privileged backend service. Its signing keypair is stored in a secrets manager and never exposed in code or environment files. It is the only authority permitted to call resolveInjuryCheck and settleMatch on-chain. After the simulation completes, the oracle submits a signed settlement transaction containing the scores and a cryptographic result commitment, then triggers the live match-end event stream to all connected clients.

Custom Error Codes

ErrorCondition
InvalidFeeBpsFee > 10% (1000 bps)
NameTooLongTeam name > 32 chars
PlayerInjuredinjury_until > block.timestamp
PlayerTooFatiguedfatigue ≥ MAX_FATIGUE
CollectiveCooldownToo soon since last collective session
MaxTierReachedAsset already at T4
NothingToClaimPending rewards are below the 1 $KICK claim minimum
MatchNotOpenChallenge status ≠ Open
CannotChallengeYourselfChallenger and opponent are same wallet
InvalidFormationRevealFormation hash does not match commitment
NotChallengeOwnerOnly challenger can cancel
NoPendingCheckresolve_injury_check called without pending flag
PrizeTooLowPrize pool below MIN_PRIZE_POOL

Security

Security is a first-class concern at every layer of KICKAIFM. The economic model and match system are designed to be fair, transparent, and manipulation-resistant.

Match Integrity

ThreatMitigation
Knowing opponent formation earlyCommit-reveal: formation hashes committed before acceptance; reveals verified on-chain
Predicting match outcomeSeed generated from both pubkeys + block hash after both commit; unknowable in advance
Oracle manipulationresultHash submitted on-chain; anyone can re-run simulation with public seed to verify
Oracle key compromiseKey stored in Vault/Secrets Manager; on-chain admin can rotate oracle_authority

Economic Security

RiskMitigation
Flash-loan match manipulationPrize pool locked before simulation begins; no re-entrance possible
Inflation attackRevenue emission is rate-limited; claim ETH fee reduces net APY; governance controls rate
Sybil match farmingTEAM_CREATION_FEE burned per team; match fee on every settlement
Rug-pull treasuryTreasury is a separate, governed wallet; mint authority is the protocol PDA (deterministic)

Backend & API Security

LayerControls
AuthenticationWallet signature → JWT; all mutating endpoints require valid JWT
AuthorisationrequireTeamOwner middleware checks DB that wallet matches team.ownerWallet
AI engineMatch simulation runs server-side only; clients receive tick stream, never engine code
NetworkServices run on an isolated internal network; databases are not publicly reachable
SecretsOracle keypair managed by an external secrets service; never committed to code or config files
Input validationZod schemas on all API endpoints; Solidity require() on all contract functions
Admin powers are minimal by design. The protocol admin can update the emission rate, fees, oracle authority, and treasury wallet — but cannot mint tokens arbitrarily, access player funds, or alter match results. All match settlement requires the oracle keypair; all player funds are held in the KickMatch contract escrow that no admin key can unilaterally drain.

Verifiability

Settled matches are cryptographically auditable. The on-chain KickMatchcontract stores the result commitment (scores + cryptographic hash of the full event log) signed by the oracle. An independent auditor with access to the simulation engine can reproduce the result from the on-chain seed and team snapshots and confirm it matches the stored commitment — no trust in the oracle is required beyond the key rotation process.

KICKAIFM — AI Football Manager on BASE · All match outcomes verifiable on-chain