flip-economy
Installation
SKILL.md
Flip: Economy
Money on Flip is server-authoritative. Private drafts use Demo USDC (two decimals) in synthetic test pools. Enabled devnet releases use Test USDC and the game's token. There is no real money.
Establish the creator's controls and core loop first (gameplay intent). An economy model is a design assumption, not permission to replace agreed gameplay. Explain constraints and alternatives, and ask before changing a mechanic or genre. Flip does not require a 96% return target; state and justify any proposed target. Preserve all server authority and money/security requirements.
- Choose
fundingMode.sessionis temporary funded play (fundSession/unfundSession).progressis persistent progress (vaultFunds/unvaultFunds,updateGameState, the progress block).nonemeans no money. - Funding opens Flip's own approval. Call it only from an explicit player action, with the missing amount and one stable requestId.
FUNDING_CANCELLEDmoved nothing. ATIMEOUTafter submission is unknown: keep the requestId and retry it. - In
handleAction, read the stake from your own rules, never frompayload. Callctx.sdk.debitBalance({asset:'USDC', amount}), decide withctx.sdk.requestRandomness({min,max}), and pay withctx.sdk.creditBalance. A failed write throws (INSUFFICIENT_BALANCE,INSUFFICIENT_TREASURY) and the whole action rolls back. Never catch and continue. - Never keep a balance in your own state. Read
getBalances()andgetTreasury(); credits only come from available treasury funds. - Declare
rngwhen you use randomness. Payouts, burn and swapping need their blocks and an enabled devnet release, and they returnpendinguntil Flip signs and confirms. - Paytable games: add
game-economy.json, with integer atomic amounts, probabilities that sum to 1,000,000 ppm,houseEdgePpmandmaxMultiplierPpm. Review checks the arithmetic exactly. It does not prove the code follows the table, so keep the server constants identical. - Money-game scenarios must signal start and a settlement matching a confirmed server action. Game over and the browser replay bridge (
registerTestHook({snapshot, reset, setSeed, step})) are optional; missing or nondeterministic browser replay only warns. Themoneystarter (flip init --template money) shows these optional hooks too. - Test empty balances, cancelled funding, retries with the same requestId,
STATE_CHANGED, and an empty treasury (flip smokeand hosted checks accepttreasuryUSDC).