Consensys Final Project: Bet with optimal fee, no chance of rugpull.
An interactive front-end at https://chrisckwong821.github.io/obp-frontend/, deployed using gh-pages at HERE
A Screencast - Introduction over Kovan Testnet
This project runs on ScaffoldETH. To set it up:
- Install ScaffoldETH following the instruction from ScaffoldETH
- Git clone this repo; replace the directory "package" which is the main project directory
Go into /package/
;
yarn chain
to start the local network;
yarn deploy
to deploy the contracts with additional workflow defined in /package/hardhat/deploy/*
;
yarn start
to bring up a local frontend at port 3000
Run yarn test
that runs the test scripts form /package/hardhat/test/myTest.js
OBP = Online Betting Protocol for everyone! There are billions of dollar being gambled on sport&Esport events every year. Yet people can hardly find a fair, decentralised and customized betting place for events they would like to bet. Result of sport events are exposed to everyone; rather than creating an oracle network when only whitelisted operator can run, OBP allows everyone to be a bettor, refereee, event operator, as well as a court member for keeping OBP as a fair place!
OBPToken
is an ERC20 token that serves 3 functions:
- Stake at court for getting 1% of all total fee generated in all events deployed in the protocol.
- Stakers are eligible to vote on cases where an refereee is sued for cheating/injecting wrong result for an event.
- OBPToken is accepted as a betting token.
OBPMain
is the hub of OBP protocols. It allows anyone to deploy a bettingOperator and a referee respectively.
This contracts:
- Records all official referee(s) and betting operator(s) that are deployed through the official deployers.
- Deploy Referee or Operator
- Add/remove supported tokens for betting
- Record the official court contract.
BettingOperatorDeployer
deploys a bettingOperator. It should be only called indirectly through the OBPMain contracts so the deployed operator is registered in the OBPMain contract.
A bettingOperator
contains a roothash when deployed, that is a hash of all its event logic and Pool Ids. A BettingOpeartor start to take bet once
it has received a bounding of OBP from a registered Referee. Then anyone can place bet on a Pool based on its Ids. Payout is claimable once the Referee closes the Pool and inject payout results. A betting operator takes 1% of total bet fee.
RefereeDeployer
deploys a referee. It should be only called indirectly through the OBPMain contracts so the deployed referee is registered in the OBPMain contract.
A Referee
takes the responsibility to bounds its staked OBP for betting Operator(s) to ensure it is injecting the precise payout result,
in return for 3% of the total betting fee received in the bettingOperator.
CourtProxy
is an upgradable proxy that performs the court duty. It allows
- staking for getting 1% of total bet fee.
- voting
- upgradeability
- consifacte staked OBP from a referee if its result is deemed corrupt.
CourtLib
is the logic library that handles the delegatd call from CourtProxy.