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

LIT-2791 - Modify auto-top-up service to limit number of un-expired NFTs per recipient #3

Merged
merged 6 commits into from
Apr 3, 2024

Conversation

MaximusHaximus
Copy link
Contributor

@MaximusHaximus MaximusHaximus commented Apr 2, 2024

Adds new logic to avoid minting a new NFT to recipients every day, which would lead to a single recipient having many NFTs in cases where the NFT we mint for them expires many days in the future.

Logic is:

  • Only mint a new NFT if the target recipient will have no un-expired NFTs tomorrow. Otherwise, skip 'em and log the NFTs that won't be expired tomorrow (both their IDs and their expiredAt formatted string :)).

Props to @mmmmveggies for awesome .filter() prop-based predicate for discriminated unions.. That is fly stuff; I was struggling with how to do that for PromiseSettledResults last week but gave up :P

…imit number of un-expired NFTs per recipient

- Only top-up if a recipient will have 0 un-expired tokens tomorrow
@MaximusHaximus MaximusHaximus marked this pull request as ready for review April 2, 2024 22:29
…n cases

- Refactored getExistingTokenDetails() to be unit testable (pure)
- Fixed a bug where tokens expiring the same day weren't being counted property. Yay tests.
- Renamed a variable to avoid thinking in double-negatives :P
Copy link

@FedericoAmura FedericoAmura left a comment

Choose a reason for hiding this comment

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

LGTM

@MaximusHaximus MaximusHaximus merged commit c905d89 into main Apr 3, 2024
2 checks passed
@MaximusHaximus MaximusHaximus deleted the LIT-2791 branch April 3, 2024 21:26
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