Skip to content

Latest commit

 

History

History
154 lines (111 loc) · 6.57 KB

File metadata and controls

154 lines (111 loc) · 6.57 KB

😄 Happy Vote MiniApp

A standalone lightweight miniapp that lets users vote on how they feel — either "Happy" 😊 or "Sad" 😢 — once every 24 hours. Built for the Monad and other EVM blockchains using a Solidity smart contract.

📦 Features

  • Two voting buttons: "I'm Happy" and "I'm Sad"
  • Users can only vote once per 24 hours (on-chain enforcement)
  • Real-time stats: happy/sad percentages and totals
  • Leaderboard (where enabled)
  • Multi-network support + network selector (Monad + other EVM networks)
  • Wallet support: MetaMask + WalletConnect (Reown/AppKit)
  • Read-only mode (view stats/leaderboard without wallet connection)
  • Optional gas refund feature (owner-controlled)
  • Dark/Light theme toggle with persistence
  • Built with React + Vite + Ethers.js + Wagmi/Viem

🚀 Updates

Latest update (23-04-2026)

  • Security hardening pass (dependency audit + config)
    • Added .env.example and moved provider/RPC URLs out of source where possible
    • Added Vercel security headers (X-Content-Type-Options, Referrer-Policy, Permissions-Policy, X-Frame-Options)
    • Added dependency pinning via overrides to mitigate known advisories (e.g. form-data, axios)
  • Test stability
    • Added minimal Jest test and a TextEncoder/TextDecoder polyfill for CRA/JSDOM
  • Tooling
    • Migrated build tooling to Vite (npm run dev, npm run build, npm run preview)

Latest update (28-02-2026)

  • Added support for Arc test network
  • Contract verified

Latest update (24-12-2025)

  • Added support for Base network
  • Contract verified

Latest update (23-12-2025)

  • Added support for Ethereum and Sepolia networks
  • Contracts verified

Latest update (17-12-2025)

  • The updated contract for the testnet has been deployed after the Monad Testnet Re-Genesis.
  • The VotesInitialized function has been added to the contract to transfer the number of votes from the snapshot (the function can only be called over and only once).
  • Votes transferred to the new contract

Previous update (29-11-2025)

  • Gas Refund Feature: Optional gas fee reimbursement for voting transactions
    • Automatically enabled/disabled by contract owner
    • Visual badge indicator when refund is active
    • Tooltip with detailed explanation
    • Works for both Happy and Sad votes
  • Optimized Gas Limits: Improved transaction success rate for both MetaMask and WalletConnect
  • Enhanced Transaction Handling:
    • Better error handling for user-rejected transactions
    • Prevents duplicate transactions on cancellation
    • Improved logging for debugging
  • Wallet Type Detection: Fixed wallet type detection to correctly identify MetaMask vs WalletConnect connections

Security Updates (29-11-2025)

  • RPC Endpoint Protection:

    • Whitelist validation for RPC endpoints to prevent endpoint substitution attacks
    • Only allows HTTPS connections to authorized Monad RPC servers
    • Validates all RPC URLs before creating network clients
  • XSS Prevention:

    • All user-facing messages are sanitized to prevent cross-site scripting attacks
    • Removes HTML tags, JavaScript protocols, and event handlers from error messages
    • Message length limits to prevent DoS attacks
  • ABI Validation:

    • Validates ABI structure before contract interactions to prevent malicious ABI injection
    • Ensures only valid contract interfaces are used for read/write operations
    • Protects against corrupted or malicious ABI data
  • Timer Protection:

    • Validates and bounds timer values to prevent timer manipulation attacks
    • Limits timer duration to reasonable ranges (0 to 1 year)
    • Prevents negative or excessive timer values
  • DOM Security:

    • Validates all DOM selectors and elements before manipulation
    • Checks element types and node types to prevent DOM-based attacks
    • Validates querySelector results and element properties before use

Previous update (27-11-2025)

  • Network selector: Choose between Monad Mainnet and Testnet with visual network badges
  • Leaderboard: Top 10 happy voters leaderboard on mainnet with scrollable list
  • Read-only mode: View voting results and leaderboard without wallet connection
  • Redesigned controls: Compact floating control panel in top-right corner with:
    • Network selector with custom dropdown and network icons
    • Unified Connect Wallet button (opens WalletConnect modal)
    • Theme toggle button
    • All buttons in consistent style with equal height
  • Mobile optimization: Fully responsive design with optimized spacing and compact controls
  • App description: Added descriptive text under the main title
  • Improved UX: Voting buttons and statistics visible without wallet connection; connection required only for voting/donating

Previous updates (25-11-2025)

  • Monad mainnet & testnet support
  • Dark/Light theme toggle 🌙☀️
  • WalletConnect integration

🎨 Themes

  • Light Theme: Clean, modern design with light colors
  • Dark Theme: Dark background with high contrast for better night viewing
  • Auto-detection: Automatically detects system theme preference
  • Persistent: Theme choice is saved in localStorage

🔗 Wallet Integration

  • MetaMask: Direct browser extension connection
  • WalletConnect: Mobile wallet support via QR code (300+ wallets supported)
  • Network switching: Automatic Monad Testnet detection and switching
  • Multi-wallet support: Choose between MetaMask and WalletConnect
  • Mobile-friendly: WalletConnect enables mobile wallet connections

🧱 Smart Contract

Monad

Mainnet contracts/HappyVoteLeaderboard.sol, Verified

Testnet contracts/HappyVote-Re-Genesis.sol, Verified

Ethereum

Mainnet contracts/HappyVoteLeaderboard.sol, Verified

Sepolia contracts/HappyVoteLeaderboard.sol, Verified

Base

Mainnet contracts/HappyVoteLeaderboard.sol, Verified

Arc

Testnet contracts/HappyVoteLeaderboard.sol, Verified

✍️ Feedback

Any questions, bug report or feedback:

https://t.me/+DLsyG6ol3SFjM2Vk

https://x.com/pittpv