Inspiration

UEFA Euro Bet is a platform where one can bet which country is going to win European Championship in Football this summer

What it does

Project consists of:

  • Core Smart Contract - EuroBet.sol
  • Chainlink External Adapter for fetching Odds for winning
  • NFT which represents Betting Ticket
  • The Graph's Subgraph for indexing data
  • Unit tests (Hardhat, ethers.js & Waffle)
  • Truffle deployment scripts
  • Frontend app hosted on IPFS

User navigates to ipfs://bafybeib33bkmmw772bdbnjr5j7iiyihxlb4gt73ufer77wrf33afuxblza/ or http://andrejrakic.github.io/ChainlinkHackathon-EuroBet/ and connect its Metamask wallet to Kovan testnet

User places bet with some amount of ETH, for example placeBet("England", 0.5 ETH)

EuroBet.sol smart contract request odd for winning championship from Chainlink's oracle

And mints NFT as Betting Ticket to User's address with tokenUri in ETH amount + odd + teamName format.

Why we need Chainlink? We can't write odds in mapping of smart contract because that values are going to change during time and we need to fetch them from betting bookmaker's apis.

NFT tickets are now in User's wallet, so one can trade them, use as a collateral, sell at auction, or whatever one wants. The point is that if NFT becomes winning bet ticket, only way for cash out is with that particular NFT.

Once betting is finished and we finally find out which team is a champion, one can call Cash Out function from the core EuroBet.sol smart contract, providing its NFT Betting Ticket. If bet is won, NFT is going to be burn and initial ETH amount * odd is going to be send to the ones wallet.

How we built it

1) Create Chainlink External Adapter to fetch Odds

2) Develop, test and deploy BetTicket.sol NFT

3) Develop, test and deploy EuroBet.sol core smart contract

4) Develop Subgraph for indexing data and generate GraphQL schemas

5) Develop, build and deploy React front end app to IPFS

Challenges we ran into

How to make project more scalable

Accomplishments that we're proud of

Usage of Chainlink oracles, building own external adapter, indexing data using The Graph protocol and deploying subgraph, hosting front end on IPFS

What we learned

How to create Chainlink external adapters

What's next for UEFA Euro Bet

To scale it to support any type of sport bet (not just Euro), to give users ability to purchase bets in any erc20 token, not just native eth coin

Built With

Share this project:

Updates