Skip to content

feat(economy): Real XLM staking via Game Hub escrow #2

Description

@Akinbola247

Do not break existing flows: passkey wallet, ZK commit/reveal/resolve, challenge-by-username, and leaderboard reads must keep working.

#1 Real XLM staking via Game Hub escrow

Labels: smart-contract, feature, economy
Problem: Wagers are i128 numbers only; mock-game-hub ignores stakes. UI shows “XLM” but nothing transfers.

Task: Implement escrow in Game Hub (native SAC transfers). Clash keeps calling start_game / end_game; hub locks on accept and pays winner (refund on draw).

Setup: bun run build mock-game-hub clash; deploy testnet hub or extend mock behind new game-hub crate; update VITE_MOCK_GAME_HUB_CONTRACT_ID.

Integrate at:

  • contracts/mock-game-hub/src/lib.rs — replace no-op start_game / end_game with TokenClient transfers
  • contracts/clash/src/lib.rsstart_game_after_auth (~688), resolve_battle (~899), optionally lock challenger on send_challenge (~416)
  • clash-frontend/.../ClashZkArena.tsx — balance check before wager; clashService.ts — surface insufficient-balance errors
  • smartAccountService.tsgetNativeTokenContract() for SAC id

Done when: Accepting a 0.1 XLM challenge moves XLM to hub; resolve pays 0.2 XLM to winner; draw refunds both; existing ZK duel still completes.



Contributor setup (all issues)

git clone <repo> && cd Stellar-Game-Studio
cp .env.example .env          # root .env — Vite reads from here
cd clash-frontend && npm install && npm run dev   # http://localhost:3000
Need Command
Local contracts + full .env bun run setup (repo root)
Rebuild clash WASM bun run build clash
Regenerate TS bindings bun run bindings clash
Contract tests cargo test -p clash

Key paths: clash-frontend/src/games/clash/ (arena UI), contracts/clash/, contracts/mock-game-hub/, clash-frontend/src/services/pointsService.ts

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions