Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CoinFlips & Database Fun 🎉 #8

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Conversation

chrislennon
Copy link
Owner

@chrislennon chrislennon commented Jul 26, 2021

To start implementing features state of events will need to be tracked.

This PR starts to implement a database model using sequelize. This should allow for on disk sqlite3 and any implementation chosen for the production systems - on disk or actual database.

Coin Flip: An event where many users can enter, staking x Satoshis, random number generator decides the winner which takes the pool.

CoinFlip event creation

  • User should be able to create a CoinFlip event using a /coinflip [number of players] [number of sats for entry] command
  • CoinFlip listing should hold the creators discord ID, interaction ID, entry fee, number of players
  • User should only have one active CoinFlip at a time - CoinFlips should have an status open/closed/completed field
  • Creator should be able to cancel a CoinFlip

CoinFlip event joining

  • User should be able to select the join button creating them a record of entry
  • This record should save the discord Id, interaction ID
  • User should not be able to join if balance is insufficient
  • User should not be able to join more than once
  • On addition of the last entrant disable further joiners

CoinFlip Execution

  • When number of entrants == max number of players execute the dice roll
  • Subtract balance from losers, credit to winner
  • Post winning text in the discord event body

Notes & edge cases

  • User may have balance at time of entry but no balance to pay winners at execution/completion time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant