maxpetretta / rafflebot.xyz

A smart contract based raffle, secured by WorldID

Home Page:https://rafflebot.xyz

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rafflebot.xyz

This repo contains the source code for rafflebot.xyz, a smart contract based daily raffle platform. Rafflebot is secured by WorldID, which ensures that participants can only enter each raffle once. Deployed to the Goerli testnet.

A screenshot of rafflebot.xyz

Tech Stack

Built with the following technologies:

  • WorldID: Privacy preserving, proof-of-personhood protocol
  • Hardhat: Smart contract development and testing
  • wagmi.sh: React hooks for Ethereum
  • ConnectKit: React components for connecting wallets
  • Next.js: Static site builds and routing
  • Tailwind: Adaptive CSS page styling
  • Vercel: Web hosting and automatic deployments

TODOs

Rafflebot is currently in MVP stage. There are a number of features to be added before the app could be considered complete:

  1. Fully integrate with WorldID at the smart contract level. The current implementation could be gamed by a malicious user, which would violate the one-person, one-entry rule
  2. Morph the smart contract into a NFT dispenser, giving the raffle winner a token for their prize
    • It might also be worth considering an integration with POAP, in lieu of custom NFTs
  3. Notify winners using Push Protocol, in case they are not chain-savvy
  4. Make the raffle reusable and user-contributable, allowing users to add their own tokens/NFTs/etc. to a shared pot
  5. Add a full suite of tests covering all smart contract functions

Installation

Prereqs

To build your own copy of rafflebot, you will first need:

Clone the repo locally with the following commands:

git clone https://github.com/maxpetretta/rafflebot.xyz
cd rafflebot.xyz/hardhat
npm install

Place all of the above secrets in the .env file

Smart Contract

You can deploy the contract with the included script file, use these commands:

npx hardhat run scripts/deploy.js --network <NETWORK_NAME>
npx hardhat verify --network <NETWORK_NAME> <CONTRACT_ADDRESS>

If running locally, you may skip the verify step. A local testnet can be started with npx hardhat node.

Frontend

The website UI needs the contract to exist before it will function correctly. After you've completed the above, you should update the contract details in contract.ts. Make sure the address and ABI are in-sync with the live deployment. To start the frontend, run:

cd ../react
npm install
npm run dev
open http://localhost:3000

Tests

As mentioned above, Rafflebot is currently a MVP. Basic scaffolding for contract tests can be found in tests.ts. Before a mainnet deployment, a comprehensive suite of tests should be written.

Running tests is done by:

cd ./hardhat
npx hardhat test

About

A smart contract based raffle, secured by WorldID

https://rafflebot.xyz

License:MIT License


Languages

Language:TypeScript 77.9%Language:Solidity 14.0%Language:JavaScript 5.0%Language:CSS 1.7%Language:Shell 1.4%