DeFi lottery with daily Pyth Entropy drawings and 10-year monthly vesting payouts.

Prize Pool
The Social Pot is a decentralized lottery on Base using Pyth Entropy V2 for daily provably fair drawings. Winners receive immediate payment plus 10-year monthly payouts via Aave integration. Tickets cost 1 USDC with 30% referral rewards. Interest from Aave deposits funds social projects for health, housing, and food crises. Includes Solidity contracts, Next.js frontend, and Foundry tests.
Built on Solidity 0.8.24 with Foundry for testing. The lottery uses Pyth Entropy V2's async callback pattern (IEntropyConsumer) for provable randomness - when a drawing is requested, we map sequenceNumber→day and Pyth calls entropyCallback() later with the random bytes. The contract deposits jackpot funds to Aave V3 immediately upon ticket purchase (using try-catch) so interest accrues from day one, even before winners are drawn. Winners receive 1/120th immediately, then 119 monthly payouts through MegaYieldVesting which also deposits to Aave. We use ERC20 permit for single-transaction ticket purchases. The frontend is Next.js 16 with Wagmi v3 and Viem for Web3, using React Server Components and Tailwind CSS. Notable hack: sequence-to-day mapping handles async randomness where Pyth callbacks arrive after multiple blocks, ensuring correct day attribution even if days roll over during the wait. We also use getFeeV2() with fallback for dynamic fee retrieval. All Aave operations wrapped in try-catch to allow operation without Aave configured during testing.

