A Solana-based focus timer application that incentivizes productivity through staking. Users stake SOL tokens before starting a focus session and get 99% back if they complete it, or lose their stake to the failure pool if they fail.
- Stake-based Focus Sessions: Users stake SOL before starting a timer
- 99% Return on Success: Complete your session and get 99% of your stake back
- Failure Pool: Failed sessions contribute to a community failure pool
- Real-time Balance: See your SOL balance in the navbar
- Session Status: Track active sessions and stake amounts
- Pool Statistics: View focus pool, failure pool, and total sessions
- Connect Wallet: Connect your Solana wallet (Phantom recommended)
- Set Timer: Click the timer to set your focus duration (1-480 minutes)
- Set Stake: Choose how much SOL to stake (minimum 0.01 SOL)
- Start Session: Click "Start Focus Session" to begin
- Complete or Fail:
- Complete: Get 99% of your stake back
- Fail: Lose your stake to the failure pool
- Frontend: Next.js 15, React 19, TypeScript
- Blockchain: Solana (Devnet)
- Program: Anchor Framework
- Wallet: Phantom Wallet integration
deepwork-dapp/
├── anchor-program/ # Solana program (Anchor)
│ ├── programs/
│ │ └── anchor-program/
│ │ └── src/lib.rs # Main program logic
│ └── target/idl/ # Generated IDL
├── frontend/ # Next.js frontend
│ ├── app/
│ │ ├── components/ # React components
│ │ ├── dashboard/ # Main app page
│ │ └── page.tsx # Landing page
│ ├── hooks/ # Custom React hooks
│ └── lib/ # Utilities and program client
- Node.js 18+
- Rust (for Anchor program)
- Solana CLI
- Phantom Wallet (or compatible Solana wallet)
-
Install dependencies:
# Frontend cd frontend npm install # Anchor program cd ../anchor-program npm install
-
Build the program:
cd anchor-program anchor build -
Deploy the program (to devnet):
anchor deploy
-
Start the frontend:
cd frontend npm run dev
The app is configured to use Solana Devnet by default. To change networks, update the connection URL in frontend/lib/program.ts.
initialize: Initialize the global state and vaultsstart_focus_session: Start a new focus session with stakecomplete_focus_session: Complete an active session (get stake back)fail_focus_session: Fail an active session (lose stake)expire_focus_session: Automatically expire overdue sessionswithdraw_focus_pool: Withdraw from focus pool (authority only)withdraw_failure_pool: Withdraw from failure pool (authority only)
- Staking: 99% goes to main vault, 1% to focus pool
- Success: 99% returned from main vault to user
- Failure: 99% moved from main vault to failure pool
- Expiry: Automatic failure after grace period
cd frontend
npm run devcd anchor-program
anchor test- Always test on devnet before mainnet
- Verify program ID matches your deployment
- Check wallet permissions before staking
- Monitor for failed transactions
MIT License