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.rs — start_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.ts — getNativeTokenContract() 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
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,economyProblem: Wagers are
i128numbers only;mock-game-hubignores 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 newgame-hubcrate; updateVITE_MOCK_GAME_HUB_CONTRACT_ID.Integrate at:
contracts/mock-game-hub/src/lib.rs— replace no-opstart_game/end_gamewithTokenClienttransferscontracts/clash/src/lib.rs—start_game_after_auth(~688),resolve_battle(~899), optionally lock challenger onsend_challenge(~416)clash-frontend/.../ClashZkArena.tsx— balance check before wager;clashService.ts— surface insufficient-balance errorssmartAccountService.ts—getNativeTokenContract()for SAC idDone 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)
.envbun run setup(repo root)bun run build clashbun run bindings clashcargo test -p clashKey paths:
clash-frontend/src/games/clash/(arena UI),contracts/clash/,contracts/mock-game-hub/,clash-frontend/src/services/pointsService.ts