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

Remove unbounded calculation of gainPerSec and write to storage instead #50

Open
SCBuergel opened this issue Mar 29, 2022 · 0 comments
Open

Comments

@SCBuergel
Copy link
Member

The calculation of gainPerSec in the _getCumulatedRewardsIncrement function involves an unbounded for-loop. That might create hard to predict issues whenever the function is called, e.g. upon a massive NFT airdrop.

This issue can be mitigated by increasing the value of gainPerSec in storage in the onERC721Received hook and decreasing it in the reclaimErc721Tokens function and then only reading it from storage within _getCumulatedRewardsIncrement.

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

No branches or pull requests

1 participant