-
Notifications
You must be signed in to change notification settings - Fork 46
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
farm supply for week fix #938
Conversation
Coverage SummaryTotals
FilesExpand
|
Contract comparison - from 6cd702c to f5d2593
|
let boosted_rewards = self.claim_only_boosted_payment(user); | ||
let boosted_rewards_payment = | ||
EsdtTokenPayment::new(self.reward_token_id().get(), 0, boosted_rewards); | ||
|
||
self.set_farm_supply_for_current_week(&storage_cache.farm_token_supply); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have to do this every single time ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also update all the claim endpoints to pass through an if statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to do this on claim, only when the storage is empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about adding it but I don't think it will bring any real improvement. An if statement would require a few extra storage reads (we would need to compute the current week), so in the end gas won't be saved, but at the same time it would add some extra logic with the if statement, which in turn would complicate the review/audit/testing parts.
let boosted_rewards = self.claim_only_boosted_payment(user); | ||
|
||
self.set_farm_supply_for_current_week(&storage_cache.farm_token_supply); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have to do this every single time ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented above. Also, this is how it already works for the other endpoints (enter, exit, claim).
…-supply-on-claim-fix
…-tests farm supply for week fix unit tests
No description provided.