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

issue #477: add coin decay #492

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

siumairice
Copy link
Collaborator

@siumairice siumairice commented Aug 15, 2023

Summary of Changes

  • Implemented a cron job to decay CodeyCoins.
  • On January 1st, May 1st, and September 1st, coins are divided by 3.

Related Issues

Resolves #477

Steps to Reproduce

In src/components/cron.ts change the cron job expression to '* * * * *' to have it run every minute, then wait one minute before checking if coin values have decayed.

Demonstration of Changes

coin decay demo

Copy link
Contributor

@Picowchew Picowchew left a comment

Choose a reason for hiding this comment

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

Nice start! You should look into calling updateCoinBalanceByUserId to record all changes in the user_coin_ledger table.

@siumairice
Copy link
Collaborator Author

Nice start! You should look into calling updateCoinBalanceByUserId to record all changes in the user_coin_ledger table.

alright! to get a user list of everyone in the server can i make a new function in roles.ts?

@Picowchew
Copy link
Contributor

Feel free to make new helper functions! However, in this case, you would want to obtain a list of everyone [with a non-zero balance] in the database, as opposed to everyone in the server.

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.

Coin decay suggestion
2 participants