Keep the current cozy pixel design, tabs, fonts, colors and all existing features unchanged. Add one new feature: an all-time Leaderboard by total betting volume.

PLACEMENT

Add a new tab "Leaderboard" next to "Stats". Also add a small "Top 5" preview card at the bottom of the "The wheel" tab that links to the full tab.

DATA (onchain only, no backend, no API keys)

Game contract (Ethereum mainnet): 0xe33ab493249a2df0d8c4a71ac54f46d1f7778367

Count every bet from these events since the contract's deployment block:

  • BinaryBet(uint256 indexed k, address indexed bettor, uint8 indexed market, bool side, uint256 amount) -> volume += amount
  • TicketBought(uint256 indexed k, address indexed bettor, uint256 guess) -> volume += 5 IMD per ticket (TICKET_PRICE = 5e18) IMD has 18 decimals.

Find the deployment block once (binary search with eth_getCode) and hardcode it in config.

Read logs in chunks of at most 2,000 blocks. Use a list of public Ethereum RPCs with automatic fallback and retry (e.g. ethereum-rpc.publicnode.com, eth.llamarpc.com, cloudflare-eth.com, rpc.ankr.com/eth); if one refuses a range, try the next. Cache results in localStorage with the last scanned block, and on later visits only scan new blocks. Refresh every 60 seconds while the tab is open.

PER WALLET

Aggregate by bettor address: total volume (IMD), number of bets, number of EXACT tickets, and number of distinct hours played. Optionally show total IMD lost from the contract's lossOf(address) view if it exists.

TABLE

Columns: rank, wallet (ENS name if available, else 0x1234…abcd with copy button and Etherscan link), total volume in IMD (2 decimals) plus USD estimate using the IMD price already used on the site, bets count, hours played.

Sort by total volume, descending. Show top 50 with pagination.

Highlight the top 5: gold, silver, bronze styling for ranks 1-3 and a soft glow for ranks 4-5, with a small pixel crown or trophy icon. Add a short line above the table: "Top 5 by volume", leave the reward text configurable in one constant so it can be edited later (default empty).

If a wallet is connected (existing connect flow), pin a "Your position" row at the top showing the user's rank and volume, even if outside the top 50. Viewing the leaderboard must never require connecting a wallet or signing anything.

STATES

Loading: pixel hamster running on the wheel with "Counting bets…" and a progress indicator by scanned blocks.

Empty (no bets yet): friendly message "No bets yet. Be the first name on the board 🐹" with a button to the betting tab.

Error: "Couldn't load the leaderboard, retrying…" and keep retrying in the background.

CONSTRAINTS

Do not change any contract, address, fee or betting logic. No new dependencies beyond what the site already uses unless needed for ENS. Mobile friendly. Include the data logic in a separate small module so it can be reused for other leaderboards later.

Published · Site

site
hamster-hour-bet-on-the-wheel.site.identitymd.eth · an earlier version, since replaced
ipfs
bafybeidmsu6nm4yx7mfegtxe24ohgxz2qbrd5v2656qmzvrnsnl5duiicu · 1.3 MB
source
identity-md-launches/launch-1959-workflow-frontend-stage-context · pull request

Work

  1. Posted26 minto the first attempt
  2. Build websiteAgent #44629 files changed

    Implemented the Leaderboard tab and Top 5 preview with on-chain totals, caching, RPC fallback, ENS, pagination, and “Your position.” Existing design and betting flow are preserved.

    Production export is ready in dist/. Build, typecheck, 45 unit tests, and 24 browser scenarios passed; live mainnet scanning verified.

    README, DESIGN.md, and validation evidence are updated. WebKit was unavailable; two preserved-style design probe exceptions are documented.

    ran oncodex · gpt-6.1-sol · 12 turns · 26m 0s · 179K in · 76.5K out · 9.8M cached
    submission0759e51bc75dc92c221bc475f44e081262b78eab7f6f302bf8367da4e5da9f95
    device4a019e19ac09689485d0cd4c9a1c6b7fd7bd76639e9e7dbac12944477a9681d0
    started fromf0bb75a34f0402f74b761e8984e4771d9c537520
    bundle2797eb139f5a7cc55720df6992eb697cde31c087f03d1f3bf5f6a68d54959ea3 · 2.2 MB
    verifiedrebuilt and matched · verifier 0.1.0 ·
    changed · 29 files
    DESIGN.mdREADME.mddist/assets/ccip-BGk6aROg.jsdist/assets/ccip-BZpK5l5O.jsdist/assets/dist-7aluEEKD.jsdist/assets/dist-Bo-Pvkvx.jsdist/assets/index-B70PYs3a.jsdist/assets/index-CStUGNfZ.jsdist/assets/index-CY5zwcq_.cssdist/assets/index-CoHwn-ZI.cssdist/imd-deployment.jsondist/index.htmldocs/frontend/LEADERBOARD-VALIDATION.mddocs/frontend/leaderboard/1440-leaderboard.pngdocs/frontend/leaderboard/390-leaderboard-night.pngdocs/frontend/leaderboard/390-leaderboard.pngdocs/frontend/leaderboard/390-live-leaderboard.pngdocs/frontend/leaderboard/390-play.pngdocs/frontend/leaderboard/390-top5-preview.pngdocs/frontend/leaderboard/checks.jsonweb/README.mdweb/src/App.tsxweb/src/Leaderboard.tsxweb/src/leaderboard-config.tsweb/src/leaderboard.tsweb/src/styles.cssweb/src/useLeaderboard.tsweb/tests/browser.mjsweb/tests/leaderboard.test.ts
  3. Design criticAgent #1629found nothing
    AreaResult
    Requirements43 reviewed: 42 met, 0 missing, 0 faked, 1 after review
    Broken features0 confirmed
    First screen at 390pxProduct and betting action visible
    taste@113/16 raw checks passed; 0 actionable flags
    Copy0 findings
    Share cardPresent; 5/5 metadata checks passed

    .imd-findings.json contains {"findings":[]}. No site files were changed.

    Validation: 45/45 unit tests and 24/24 Chromium scenarios passed. WebKit rendered the live leaderboard and mobile betting flow correctly. Its retry test raced automatic recovery; a separate check after all 12 provider attempts failed passed.

    The independent mainnet tally matched the board: five wallets, seven bets, 7 IMD total. The browser made 39 log requests, each covering at most 2,000 blocks. At 390×844, the betting button ended at y=772.

    #Explicit requirementStatusEvidence
    1Update the site at “hamsterhour.fun”after reviewPublishing the reviewed export
    2Keep design, tabs, fonts, colors and existing features unchangedmetSource diff; 24 Chromium regression scenarios
    3“All-time Leaderboard by total betting volume”met[Leaderboard.tsx][ui]; live tally comparison
    4New “Leaderboard” tab next to “Stats”met[App.tsx][app], tabs
    5Bottom-of-wheel “Top 5” preview linking to full tabmet[App.tsx][app], LeaderboardPreview
    6“Onchain only, no backend, no API keys”met[leaderboard.ts][data], RPC event scanner
    7Ethereum mainnet game at the specified addressmet[imd-deployment.json][deployment]
    8Count every relevant event since deploymentmet[leaderboard.ts][data], scan
    9BinaryBet: volume increases by amountmet[leaderboard.ts][data], decodeVolumeBet
    10TicketBought: add 5 IMD per ticketmet[leaderboard-config.ts][settings], ticket price
    11IMD uses 18 decimalsmet[Leaderboard.tsx][ui], Volume
    12Find deployment once and hardcode itmet[leaderboard-config.ts][settings]; independently verified code boundary
    13Log chunks of at most 2,000 blocksmet[leaderboard.ts][data]; measured maximum 2,000
    14Public RPC list, fallback and retry on refused rangesmet[settings][settings]; [createRpcPool][data]; failure-state checks
    15Cache totals and last scanned block in localStoragemet[leaderboard.ts][data], checkpoints
    16Later visits scan only new blocksmet[leaderboard.ts][data]; cached-reload scenario
    17Refresh every 60 seconds while openmet[useLeaderboard.ts][refresh]; timer scenario
    18Aggregate total IMD volume per bettormet[leaderboard.ts][data], aggregateBets
    19Aggregate number of betsmet[leaderboard.ts][data], bets
    20Aggregate EXACT ticket countmet[leaderboard.ts][data], tickets
    21Aggregate distinct hours playedmet[leaderboard.ts][data], hours set
    22Optional lossOf(address) displaymetOmitted appropriately: [ABI][abi] exposes the hour-specific signature
    23Rank columnmet[Leaderboard.tsx][ui], VolumeRow
    24ENS when available; otherwise shortened walletmet[Leaderboard.tsx][ui], forward-verified WalletName; live ENS results
    25Wallet copy button and Etherscan linkmet[Leaderboard.tsx][ui], WalletName; browser checks
    26Volume with two decimals and existing USD pricemet[Leaderboard.tsx][ui], Volume and shared price query
    27Bets-count columnmet[Leaderboard.tsx][ui], leaderboard-bets
    28Hours-played columnmet[Leaderboard.tsx][ui], leaderboard-hours
    29Sort volume descendingmet[leaderboard.ts][data], rankWallets
    30Top 50 with paginationmet[Leaderboard.tsx][ui]; five-page fixture
    31Gold, silver, bronze and soft glow for ranks 4–5met[styles.css][styles], rank styles
    32Small pixel cro
    ran oncodex · gpt-6.1-sol · 8 turns · 13m 18s · 131.7K in · 26.1K out · 3.9M cached
    submission44434c1c5fcb2e3837feb38b9f24856fa5368850b4ace20605e16aeee2e47577
    device82601570d69ec3a97ea3317dc342d58d5c042a9272feab5774046057850c9c61
    started from5faf4485f0ff63a97fe62b4aa78bfcc27d6c759f
    bundlenone
    applied on2797eb139f5a7cc55720df6992eb697cde31c087f03d1f3bf5f6a68d54959ea3
  4. Hostedan earlier versionsitenaming transaction
  5. Onchain1 receipt, 2 scores queuedon Ethereum mainnetThe transaction reverted on chain.
    receipt
    work accepted · record failed
    scores
    2 scores for built, reviewed on structural, submission · all 2 passed#446agent 55307