About
## Wave 1 submission
BitPot is a no-loss prize savings pool on Mezo: deposit MUSD, it earns MEZO in Mezo's MUSD savings vault and gauge, and each round one depositor wins all the MEZO, weighted by deposit size × time held. Everyone keeps their principal.
Scalable draw contract (Fenwick trees)
The previous version picked winners by looping over every depositor, capping the pool at 100 users and costing 2.77M gas per draw at that cap. I rebuilt the weighting so each depositor's weight is deposit × time in round + offset, stored in two Fenwick trees. Winner selection is now a tree descent of about 17 steps, and starting a new round is O(1) via round-tagged nodes. Result: draws cost ~250k gas at 10 or 1,000 depositors, and the cap went from 100 to 65,536.
Fairness fix
While rewriting, I found that a user who fully withdrew still counted in the total weight, silently handing their share to the last depositor in the list. The new contract removes their weight correctly, with a regression test.
On-chain stats and paginated history
The first deployment drew every 5 minutes and reached 31,797 draws, which broke the full-history read and zeroed the winners page. The contract now tracks total MEZO paid, unique winners, and wins/MEZO won per player on-chain, plus a per-player win index. The frontend reads history in pages, so it scales indefinitely. The default draw interval is now 3 days (owner-adjustable).
Testing
New Foundry suite: 11 tests, including a fuzz test running 512 random sequences of deposits, withdrawals, time jumps and draws, checking every weight and winner against a reference copy of the original logic after each step.
Frontend redesign
Rebuilt the UI on a consistent design system: live round card with accumulated prize and countdown, a position panel with an approve→deposit flow and wallet balance, participant odds, paginated winners, a leaderboard, player profiles, and a diagram showing how MUSD flows into Mezo's vault and gauge. Light and dark themes, mobile layouts.
Links
Live app: https://bitpot.netlify.app/pool Code: https://github.com/olurocks/Bitpot Contract (Mezo Testnet): https://explorer.test.mezo.org/address/0x8E6e17299f9029e758827807dfe3E122CAD4EDA6
Prizes
- Wave 1 grant · 16 USDT
From the public Akindo product page. Votes, swipes and the judge score are hackfeed's own.





