
SleepToEarn
Invest in Sleep Boost Your Health, Slow Your Aging
About
The problem it solves ## Problem SleepToEarn Solves Many people don’t get enough good sleep, which can hurt their health and energy. They also don’t have easy ways to stay motivated to sleep better. ### How SleepToEarn Helps - **Rewards You for Sleeping Well:** You earn money just by getting good sleep. - **Works with WHOOP Users:** Connects directly with WHOOP devices to track sleep automatically and accurately. - **Encourages Healthy Habits:** Motivates you to sleep better with real rewards. - **Safe and Easy:** No complicated steps, just sleep and earn. - **Protects Your Data:** Uses secure blockchain technology to keep your info safe. ### Who Can Use It - WHOOP users wanting better sleep. - People who want to earn money passively. - Those who enjoy simple healthy challenges. - Sleepers who want to track and improve their rest using WHOOP data. Smart Contract Address(es) ## Main Contract - SleepToEarn **Address:** `0x97c381648BF3a0344D4A3a3d6c7eAfD4Ad96996A` **[View on BaseScan](https://sepolia.basescan.org/address/0x97c381648BF3a0344D4A3a3d6c7eAfD4Ad96996A)** This is the core contract that powers the SleepToEarn application. It handles: - Sleep data submission and validation - Reward calculations based on sleep quality metrics - Oracle authorization system - User statistics and streak tracking - Token minting authorization ## Token Contract - SleepToken **Address:** `0x903B98944713d1d38Aed9Ea8C6A7743C6ad91240` **[View on BaseScan](https://sepolia.basescan.org/address/0x903B98944713d1d38Aed9Ea8C6A7743C6ad91240)** This is the ERC-20 token contract for SLEEP tokens that users earn as rewards. Features: - Standard ERC-20 functionality - Controlled minting (only SleepToEarn contract can mint) Other Onchain Proof ## Verifiable Onchain Activity ### Contract Interactions - **[SleepToEarn Contract Activity](https://sepolia.basescan.org/address/0x97c381648BF3a0344D4A3a3d6c7eAfD4Ad96996A#transactions)** - View all contract interactions - **[Token Contract Activity](https://sepolia.basescan.org/address/0x903B98944713d1d38Aed9Ea8C6A7743C6ad91240#transactions)** - SLEEP token minting and transfers
How it's made
Challenges we ran into ## Challenges I Ran Into ### WHOOP API Integration and Webhook Security 🔐 **Challenge:** Implementing secure WHOOP webhook signature verification while managing OAuth token refresh logic was complex. **Issues Encountered:** - WHOOP webhook signature verification required precise timestamp and raw body HMAC-SHA256 computation. - Managing OAuth token expiration and refresh token flow. - Handling different WHOOP API environments (production vs staging). ### Reward-Based System Challenges **Challenge:** Implementing fair reward calculations based on sleep quality metrics (duration, efficiency, cycles, deep sleep) while preventing gaming and ensuring sustainable tokenomics. **Solution:** - Developed a comprehensive scoring algorithm within the smart contract that accounts for multiple sleep factors. - Implemented daily caps of 10 SLEEP tokens to limit rewards. - Added streak bonuses to encourage consistent good sleep habits.