Sherwood Protocol // Documentation

How OutlawFlip Works

A provably fair, instant-settle on-chain coinflip game on Robinhood Chain. Stake in USDG with preset amounts ($1, $5, $10), win 1.9ร— in USDG โ€” no waiting, no keeper, no VRF delay.

๐Ÿ”— Network

ChainRobinhood Mainnet
Chain ID4663 (0x1237)
RPChttps://rpc.mainnet.chain.robinhood.com
Explorerrobinhoodchain.blockscout.com
CurrencyETH

๐Ÿ“œ Contract Addresses

CoinFlipV40x0DeeBdf0342757A0B14781780C0Ed942A77232Bf
USDG Token0x843d02f3211a29c5CCFfD13A34BC4dab356D5Ee5
OUTLAW TokenNot used in V4 (USDG-only)

๐ŸŽฎ How to Play

  1. Connect Wallet โ€” Click "Connect Wallet" and approve MetaMask. The app will auto-add Robinhood Mainnet to your wallet if not already configured.
  2. Pick Stake โ€” Choose one of three preset amounts: $1, $5, or $10 USDG.
  3. Pick a Side โ€” Choose HEADS (The Hood) or TAILS (The Crown).
  4. Flip โ€” Click "Loose the Arrow". The coin flips and settles instantly in a single transaction.
  5. Win โ€” If you guessed correctly, you receive 1.9ร— your stake in USDG, sent directly to your wallet in the same transaction.

โšก Instant Settlement

OutlawFlip V4 uses blockhash randomness for instant settlement. The bet settles in the same transaction as the placeBet call.

1 User calls placeBet(preset, choice)
โ†’
2 Contract transfers USDG stake in
โ†’
3 Blockhash + win rate determines result
โ†’
4 If won: 1.9ร— USDG payout sent instantly
โ†’
5 BetSettled event emitted

All in one transaction, one block. No waiting, no keeper, no VRF delay.

๐Ÿ’ฐ Payout Structure

PresetStakeWin ReturnsNet Profit
$11 USDG1.90 USDG+0.90 USDG
$55 USDG9.50 USDG+4.50 USDG
$1010 USDG19.00 USDG+9.00 USDG

Multiplier: 19/10 = 1.9ร—
Payout token: USDG (same as stake)
Example: Bet $5 on HEADS โ†’ Win โ†’ Receive 9.50 USDG (net +4.50).

๐ŸŽ› Win Rate Control

Each preset has an independently configurable win rate settable by the contract owner (via the admin panel). The win rate is expressed in basis points (0โ€“10000, where 5000 = 50%).

ParameterDefaultRange
$1 preset win rate50%0% โ€“ 100%
$5 preset win rate50%0% โ€“ 100%
$10 preset win rate50%0% โ€“ 100%

The win rate determines the probability that the player wins. At 50%, the game is a fair coin flip. The owner can adjust this per preset to control house edge and player experience.

๐Ÿ” Randomness

The result is determined by a hash of:

keccak256(
  blockhash(block.number - 1),
  block.timestamp,
  msg.sender,
  nextBetId,
  tx.gasprice
)

A random value 0โ€“9999 is derived from this hash. If the value is less than the preset's win rate (in basis points), the player wins. The result is then set to match the player's choice (win) or the opposite (lose).

๐Ÿ›ก Security

  • ReentrancyGuard on bet function
  • SafeERC20 for all token transfers
  • Solvency check โ€” bet rejected if contract USDG balance < payout
  • Ownable โ€” only owner can withdraw, set win rates, or pause
  • Non-custodial โ€” payouts sent directly to player wallet

๐Ÿ“Š Contract Functions

Player

placeBet(uint8 preset, uint8 choice) โ†’ (uint256 betId, bool won)
  // preset: 0=$1, 1=$5, 2=$10
  // choice: 0=HEADS, 1=TAILS

Views

availableUsdg() โ†’ (uint256)
getPreset(uint8 preset) โ†’ (uint256 amount, uint32 winBps)
quotePayout(uint8 preset) โ†’ (uint256)
paused() โ†’ (bool)
nextBetId() โ†’ (uint256)
bets(uint256 betId) โ†’ (Bet)
getRecentBets(uint256 offset, uint256 limit) โ†’ (Bet[])
getPlayerBets(address player, uint256 limit) โ†’ (Bet[])

Admin (owner only)

withdrawUSDG(address to, uint256 amount)
setPreset(uint8 preset, uint256 amount, uint32 winBps)
setWinRate(uint8 preset, uint32 winBps)
setPaused(bool paused_)