Skip to content

PatrionDigital/SendOneOrNGMI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

69 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Send $1 or NGMI πŸš€

A viral, gasless Mini-App for Base App and Farcaster that runs a game-theoretic experiment where the last 100 people to send $1 (0.001 ETH) split the entire pot when a 42-minute countdown expires. Every transaction resets the timer. Pure chaos, maximum virality.

🎯 How It Works

  1. Send $1 (0.001 ETH) to enter the game
  2. Every entry resets the 42-minute countdown
  3. Last 100 entries when timer expires split the entire pot
  4. Batch payout - all winners paid in a single transaction
  5. No gas fees - transactions sponsored by Base Paymaster

πŸ—οΈ Tech Stack

  • Frontend: Next.js 14 + TypeScript + Tailwind CSS
  • Blockchain: Base (Ethereum L2)
  • Smart Contract: Solidity 0.8.20 + OpenZeppelin
  • Wallet: OnchainKit MiniKit + Smart Wallet
  • Gas Sponsorship: Coinbase Developer Platform Paymaster

πŸ“ Project Structure

``` SendOneOrNGMI/ β”œβ”€β”€ contracts/ β”‚ └── SendOneOrNGMI.sol # Main game contract β”œβ”€β”€ src/ β”‚ β”œβ”€β”€ app/ β”‚ β”‚ β”œβ”€β”€ api/ β”‚ β”‚ β”‚ β”œβ”€β”€ paymaster/ # Paymaster proxy β”‚ β”‚ β”‚ └── webhook/ # Farcaster webhooks β”‚ β”‚ β”œβ”€β”€ .well-known/ # Farcaster manifest β”‚ β”‚ β”œβ”€β”€ layout.tsx # Root layout β”‚ β”‚ β”œβ”€β”€ page.tsx # Main game page β”‚ β”‚ └── globals.css # Global styles β”‚ β”œβ”€β”€ components/ β”‚ β”‚ β”œβ”€β”€ CountdownTimer.tsx # MM:SS countdown β”‚ β”‚ β”œβ”€β”€ PotStats.tsx # Pot value display β”‚ β”‚ β”œβ”€β”€ CTASection.tsx # Send $1 button β”‚ β”‚ β”œβ”€β”€ LiveQueue.tsx # Winner queue β”‚ β”‚ β”œβ”€β”€ BatchPayoutButton.tsx β”‚ β”‚ β”œβ”€β”€ EndGameButton.tsx β”‚ β”‚ └── GameEndedBanner.tsx β”‚ β”œβ”€β”€ lib/ β”‚ β”‚ └── contract.ts # Contract ABI & config β”‚ └── providers/ β”‚ └── MiniKitProvider.tsx β”œβ”€β”€ public/ # Static assets β”œβ”€β”€ .env.example # Environment template └── package.json ```

πŸš€ Quick Start

1. Install Dependencies

```bash npm install ```

2. Configure Environment

```bash cp .env.example .env.local ```

Edit `.env.local` with your values:

  • `NEXT_PUBLIC_ONCHAINKIT_API_KEY` - Get from Coinbase Developer Platform
  • `CDP_PAYMASTER_URL` - Paymaster endpoint from CDP
  • `NEXT_PUBLIC_CONTRACT_ADDRESS` - Your deployed contract address

3. Generate Farcaster Manifest

```bash npx create-onchain --manifest ```

4. Run Development Server

```bash npm run dev ```

Visit http://localhost:3000

πŸ“œ Smart Contract (Foundry)

Key Features

  • 42-minute countdown (resets on each entry)
  • Circular queue of 100 addresses
  • Batch payout - all winners paid in one transaction
  • ReentrancyGuard protection
  • Pausable for emergencies

Setup Foundry

```bash

Install Foundry (if not already installed)

curl -L https://foundry.paradigm.xyz | bash foundryup

Install dependencies

forge install foundry-rs/forge-std forge install OpenZeppelin/openzeppelin-contracts

Build contracts

forge build

Run tests

forge test -vvv ```

Deploy Contract

```bash

Copy environment template

cp .env.foundry.example .env

Edit .env with your values:

- PRIVATE_KEY

- BASE_SEPOLIA_RPC_URL

- BASESCAN_API_KEY

Load environment variables

source .env

Deploy to Base Sepolia (testnet)

forge script contracts/script/Deploy.s.sol:DeploySendOneOrNGMI \ --rpc-url $BASE_SEPOLIA_RPC_URL \ --private-key $PRIVATE_KEY \ --broadcast \ --verify

Deploy to Base Mainnet

forge script contracts/script/Deploy.s.sol:DeploySendOneOrNGMI \ --rpc-url $BASE_RPC_URL \ --private-key $PRIVATE_KEY \ --broadcast \ --verify ```

Run Tests

```bash

Run all tests

forge test

Run with verbosity

forge test -vvv

Run specific test

forge test --match-test test_SendOne_StartsGame

Gas report

forge test --gas-report ```

Verify Contract (if not auto-verified)

```bash forge verify-contract YOUR_CONTRACT_ADDRESS \ contracts/SendOneOrNGMI.sol:SendOneOrNGMI \ --chain base \ --etherscan-api-key $BASESCAN_API_KEY ```

β›½ Paymaster Setup

  1. Go to Coinbase Developer Platform
  2. Create a new project
  3. Enable Paymaster
  4. Add your contract address to the allowlist
  5. Add `sendOne()` function to allowed functions
  6. Set spending limits:
    • Per-user: $0.10/day
    • Global: $500/week

πŸ§ͺ Testing

Local Testing

```bash npm run dev

```

Farcaster Dev Tools

Test your Mini-App at: https://warpcast.com/~/developers/mini-apps

Run Tests

```bash npm run test ```

πŸš€ Deployment

Deploy to Vercel

```bash vercel ```

Environment Variables in Vercel

Add all variables from `.env.example` to your Vercel project settings.

πŸ“Š Key Metrics

Metric Value
Entry Fee 0.001 ETH (~$2.50)
Countdown 42 minutes
Winners Last 100 entries
Payout Batch (single tx)
Gas Sponsored (free)

πŸ” Security

  • βœ… ReentrancyGuard on all state-changing functions
  • βœ… Batch payout pattern (no individual withdrawals)
  • βœ… Paymaster proxy to hide URL
  • βœ… Contract allowlist in CDP
  • βœ… Per-user and global spending limits
  • βœ… Pause mechanism for emergencies

πŸ“± Platform Support

  • Base App (clientFid: 309857)
  • Warpcast (clientFid: 9152)
  • Farcaster (clientFid: 1)
  • Web (standalone)

🎨 Design System

Element Value
Background #000000 (black)
Primary #10B981 (green-500)
Accent #059669 (green-600)
Warning #EF4444 (red-500)
Text #FFFFFF, #9CA3AF

πŸ“„ License

MIT

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

Built with πŸ’š for Base App & Farcaster

LFG! πŸš€

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors