On-chain layer for Thooon on Celo — built for the Celo Proof of Ship program.
Thooon is a free-to-play creature game (battles, expeditions, crafting). Play it on MiniPay: dsv.thooon.com/mini. This repo contains the Celo Mainnet smart contract that powers the in-game daily on-chain check-in — players inside MiniPay check in once per day, paying the network fee in stablecoins (USDm via fee abstraction), and earn in-game gold and streak bonuses — plus a mirror of the full game-side integration (MiniPay detection, EIP-712 sign-in, check-in API, UI). The game itself is a private Next.js 14 codebase; all Celo-facing code is mirrored here.
Immutable, ownerless, zero-dependency contract:
checkIn(bytes32 nonce)— one check-in per address per UTC day (AlreadyCheckedInTodayguard). EmitsCheckIn(account, nonce, day, streak).hasCheckedInToday(address)— free view used by the game client to avoid guaranteed-revert transactions.- The
nonceis a server-issued challenge that binds the transaction to a Thooon account. Because MiniPay does not support message signing, the check-in transaction itself doubles as proof of wallet ownership: the game backend verifies the receipt + event on Celo RPC and links the wallet to the player profile.
| Network | Chain ID | Address |
|---|---|---|
| Celo Mainnet | 42220 | 0xC1f51A310170A8f2a5D641db876f6239868D244f |
Verified on Sourcify (exact match).
event CheckIn(address indexed account, bytes32 indexed nonce, uint256 day, uint32 streak)
function checkIn(bytes32 nonce)
function hasCheckedInToday(address account) view returns (bool)
function lastCheckInDay(address) view returns (uint256)
function streakOf(address) view returns (uint32)
error AlreadyCheckedInToday()
Requires Foundry.
forge build
forge test -vvvexport PRIVATE_KEY=0x... # deployer EOA funded with ~0.5 CELO
forge script script/Deploy.s.sol --rpc-url https://forno.celo.org --broadcast
# Verification — Sourcify (no API key):
forge verify-contract <ADDRESS> src/ThooonCheckIn.sol:ThooonCheckIn --chain 42220 --verifier sourcify
# Or Celoscan:
export CELOSCAN_API_KEY=...
forge verify-contract <ADDRESS> src/ThooonCheckIn.sol:ThooonCheckIn --chain 42220 \
--verifier-url https://api.celoscan.io/api --etherscan-api-key $CELOSCAN_API_KEYThe integration is live in production. First on-chain check-in: 0x7e900d…879e — verified by the backend, wallet linked, gold credited.
Two client paths share the same challenge → checkIn(nonce) → verify backend:
| Path | Wallet | Gas | Status |
|---|---|---|---|
| Desktop browser (primary — the player base is desktop-first) | MetaMask / Rabby via thirdweb, auto-reconnect | Native CELO; zero-balance wallets get a one-time 0.2 CELO gas drop from a small-float hot wallet (0xE790…D5dD) |
✅ live |
| MiniPay (dsv.thooon.com/mini) | Injected MiniPay provider, EIP-712 sign-in | Stablecoin via fee abstraction | Blocked by MiniPay's -32604 contract-tx restriction for unlisted mini apps; Stage 1 intake pending |
The first production check-in cost 0.0276 CELO at 402 gwei: thirdweb's sendTransaction helper doubled the network's eth_gasPrice (~200 gwei that day) and tripped MetaMask's "high site fee" warning. Two consequences baked into the code:
- The desktop card sends raw calldata (
to+data+chainIdonly) so the wallet estimates fees itself — no inflated suggestion, roughly half the cost (~0.014 CELO/check-in). - The gas drop is sized to the measured ~200 gwei reality (0.2 CELO ≈ two weeks of daily check-ins), not the historical 25 gwei from docs.
- Deploy
ThooonCheckInto Celo Mainnet; record address above - Verify contract (Sourcify exact match)
- Set Vercel env:
NEXT_PUBLIC_CELO_CHECKIN_CONTRACT_ADDRESS,FEATURE_CELO_CHECKIN=true,NEXT_PUBLIC_FEATURE_CELO_CHECKIN=true,NEXT_PUBLIC_FEATURE_MINIPAY=true - Apply the
celo_checkinSupabase migration - Desktop check-in (primary player base):
CeloCheckInCardDesktop+ gas drop ported fromfrontend-integration/,celo_gas_dropsmigration applied, hot wallet funded (40 CELO),CELO_GAS_DROP_PRIVATE_KEY+FEATURE_CELO_GAS_DROP=trueset - First real on-chain check-in verified end-to-end (tx above)
- Register builder profile + project on talent.app (public repo URL, contract address, live URL
https://dsv.thooon.com/mini, path to theisMiniPayhook in Data Sources) - Join t.me/proofofship + weekly Office Hours
- MiniPay Stage 1 intake at minipay.to/mini-apps — unblocks contract txs inside MiniPay + leaderboard booster
- In-game announcement driving players to the daily check-in