Skip to content

adhurjaty/prediction-app

Repository files navigation

Delphai

Summary

Delphai is a person-to-person betting app. Users belong to groups and users can create bets where anyone/everyone in the group can make a wagered bet. Once the bet is closed, the participants in the bet set the resolution (did the predicted outcome happen or not?). Once a resolution is reached, the participants can withdraw their winnings.

Diagrams

Architecture

This application consists of 4 components:

  • UI
    • Written in Nextjs (Typescript)
    • Comes with a Node backend (used for OAuth and passing API calls along to the REST API)
  • REST API
    • Written in ASP.NET Core C#
    • Authentication using JWT tokens
  • Flow contracts
    • Written in Cadence
    • Handles all the monetary transactions
  • Postgres Database

Architecture

Use cases

Registration

Note: We are only handling the case where the user already has a Flow address for now

Create group

Note: the plan for adding members will include the member to consent to being added, but we are not implementing that now for the sake of simplicity

Bet lifecycle

Database

Database

Screens

  • Registration
  • Login
  • Home
  • Profile
  • Group
  • Search proposition
  • Create proposition
  • View proposition
  • Resolve proposition

If you want to edit the Figma diagram, open your own instance of Figma and import the PredictApp.fig file, make edits, save over it and commit.

figma screenshot

Domain Definitions

Global Domain

  • Bet
    • Item up for making a wager on. A bet resolves to yes or no (for now) outcome upon some resolution condition
    • A User's wagered amount on a predicted Outcome (also called a wagered bet)
  • Resolution: The point when the bet has an outcome
  • Resolution Event: The real world event that should trigger a resolution of the bet
  • App Outcome: The status of the resolved bet
  • True Outcome: The real world status of the resolution event
  • Prediction: A user's prediction of the app outcome
  • Wager: The amount of ether, USD, or prestige points in a bet per person

Database

  • User: user of the application. Is able to log in and interact with the application
  • Group: Group of users that share bets and statistics. Bets are all scoped to groups

Smart Contract

  • Member: A User with membership in the Group that is participating in a given Bet. A Member may participate in that Bets through wagers and, depending on the Resolver, may vote to resolve the Bet. A member is a user in the database sense
  • Commissioner: The administrator for a given Bet, typically handled by the API backend service. A Commissioner creates Bets, adds/removes Members, and sets the Resolver. The Commissioner may not bet in the Bet or vote on its resolution.
  • Bet: The smart contract for the bet in the global domain sense
  • Resolver: The smart contract that handles resolution conditions for the proposition smart contract
  • Resolution Vote: A vote that reflects the event outcome (should trigger a proposition resolution under some condition)
  • Defection?: A vote that a true outcome has not occurred

Links

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •