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

Add bet payout hook #7

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Add bet payout hook #7

wants to merge 10 commits into from

Conversation

skoriop
Copy link
Member

@skoriop skoriop commented Jan 11, 2025

No description provided.

@skoriop skoriop requested review from Radian6405 and soemone January 11, 2025 00:52
also refactor code to remove unused bits
).at(0);

if (betPool) {
await pb.collection('betPool').update(betPool.id, { amount: betPool.amount + amount });
Copy link
Contributor

@Radian6405 Radian6405 Jan 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the amount is a string here the bets amount gets added as a string (amount is any rn not a number)
so consecutive bets of 10 lead betPool.amount + amount to become 1010

also same issue in line 38 for bet.amount + amount

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I've added validation middleware using zod.

@Radian6405
Copy link
Contributor

Radian6405 commented Jan 11, 2025

with how this is setup, everytime standingsUpdated becomes true the bets get distributed
so if i decide to continuously make it true then false then true the bets keep redistributing again and again

so maybe an isExpired boolean on bets and betPools can be added so already fulfilled bets cannot be distributed more than once

@Radian6405
Copy link
Contributor

also maybe a check to make sure the bets cannot be distributed before startTime?

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.

2 participants