-
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
Changes from 1 commit
2ca12e4
f668405
55de050
a907b89
3464f85
2285407
88dd12b
602b696
b147571
a28f0a4
d43a154
ba5aec9
c957df6
6c0d6b6
f5d2593
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -228,10 +228,15 @@ pub trait Farm: | |
); | ||
} | ||
|
||
let mut storage_cache = StorageCache::new(self); | ||
Wrapper::<Self>::generate_aggregated_rewards(self, &mut storage_cache); | ||
|
||
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 commentThe 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 commentThe 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 commentThe 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 commentThe 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 commentThe 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. |
||
|
||
self.send_payment_non_zero(user, &boosted_rewards_payment); | ||
|
||
boosted_rewards_payment | ||
|
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).