https://github.com/andrejrakic/chainlinkhackathon-eurobet
UEFA Euro Winner Decentralized Betting Platform, developed at Chainlink Hackathon
https://github.com/andrejrakic/chainlinkhackathon-eurobet
chainlink
Last synced: 5 months ago
JSON representation
UEFA Euro Winner Decentralized Betting Platform, developed at Chainlink Hackathon
- Host: GitHub
- URL: https://github.com/andrejrakic/chainlinkhackathon-eurobet
- Owner: andrejrakic
- Created: 2021-03-16T13:19:22.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-04-10T16:31:09.000Z (over 4 years ago)
- Last Synced: 2025-02-16T21:18:34.374Z (10 months ago)
- Topics: chainlink
- Language: Solidity
- Homepage:
- Size: 3.12 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Chainlink Hackathon - Euro Bet
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](/contracts/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.
## Live Demo

React Dapp _(make sure to have Metamask installed and connected to Kovan testnet)_ available at
```
ipfs://bafybeib33bkmmw772bdbnjr5j7iiyihxlb4gt73ufer77wrf33afuxblza/
```
or
http://andrejrakic.github.io/ChainlinkHackathon-EuroBet/
## Smart contracts

[EuroBet](/contracts/EuroBet.sol) core smart contract: https://kovan.etherscan.io/address/0xa530d2026341b720ec367cd52df49417aa861225
BetTicket NFT smart contract: https://kovan.etherscan.io/token/0x7e7ed52d6611d8ff4edfba838726ef200d18675a
## External Adapter

Since odds change during time, one can not write it on chain via mapping and therefore one need Chainlink oracles to get that info when placing bets. External adapter is available [here](./external-adapter)
## Subgraph

Subgraph for indexing data: https://thegraph.com/explorer/subgraph/andrejrakic/euro-bet
## Unit tests

_Make sure to install all necessary dependencies_
```
npm test
```