Skip to content

Sports betting dapp | Built with Scaffold-eth 2 and ChakraUI

License

Notifications You must be signed in to change notification settings

luloxi/Sportsbook

Repository files navigation

⚽ Sportsbook 🏗️

Betting dapp using ChakraUI

How can I contribute to this build?

Dapp flow is:

  1. An address challenges another address and specifies a referee address and optionally a bet amount
  2. Challenged address accepts the challenge and bets the same amount as the proposer address
  3. Referee sets the game as started and challenge can't be canceled no more (suposedly, this coincides with a real life sports match)
  4. Referee sets the score and prize gets distributed accordingly (and then all to winner, or split if tie)
  5. (still not implemented) After results are in, a SVG NFT with the results of the match in the image can be claimed by all parts involved

Requirements

Before you begin, you need to install the following tools:

Quickstart

To get started with Sportsbook, follow the steps below:

  1. Open a terminal, clone this repo, and install dependencies
git clone https://github.com/luloxi/sportsbook.git
cd sportsbook
yarn install
  1. Run a local network in the first terminal:
yarn chain

This command starts a local Ethereum network using Hardhat. The network runs on your local machine and can be used for testing and development.

  1. On a second terminal, deploy the test contract:
yarn deploy

This command deploys a test smart contract to the local network.

  1. On a third terminal, start your NextJS app:
yarn start

Visit your app on: http://localhost:3000. You can interact with your smart contract using the Home or debug contracts in the frontend.

Relevant files

  • Smart contract Sportsbook.sol in packages/hardhat/contracts
  • Deployment scripts in packages/hardhat/deploy
  • Frontend files in packages/nextjs/pages
  • Types files in packages/nextjs/types

Completed product aims to

  • Offer multiple ways of betting
  • Have a social network that allows you to find and challenge other teams on the same geographic zone
  • Generate an income for verified referees that help keep the platform fair

Why is it useful

For everyone:

  • Showcase past matches on your profile as NFTs
  • Showcase stats and other information on profiles
  • Allow communication and coordination between users, teams and referees with the social part

For users:

  • Social media app to find a team for the sport you select
  • Find a team on your geographic zone

For teams:

  • Find and challenge other teams on the same geographic zone
  • Pay to location providers for matches against other teams (half each team)
  • Bet between teams on the outcome of a given match

For referees:

  • Act a trusted third party in exchange for payment
  • Get instant payment after setting the score of a match

Development notes

You can check current development notes here