-
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
allow setting first week epoch in farm #835
Conversation
Contract comparison - from cad0c11 to 2ed5386
|
fn claim_boosted_rewards(&self, opt_user: OptionalValue<ManagedAddress>) -> EsdtTokenPayment { | ||
let current_epoch = self.blockchain().get_block_epoch(); | ||
let first_week_start_epoch = self.first_week_start_epoch().get(); | ||
require!( |
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 need the extra check in place? We already have the check when computing the actual rewards. Maybe we accept that until the first_week_start_epoch is reached, we don't fail the endpoint, and just return 0. Then, after we pass that particular epoch, we avoid the 2 extra reads.
} | ||
|
||
storage_cache.reward_reserve += &total_reward; | ||
let split_rewards = sc.take_reward_slice(total_reward); |
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 would add a check in the startProduceRewards
endpoint, to not allow the rewards to start generating, if current_epoch < first_week_start_epoch. This way, we avoid getting to the point where we may call an endpoint (like enterFarm
) that calls the take_reward_slice
function, which then would throw a SC error.
The base branch was changed.
Added the possibility of setting first_week_start_epoch when deploying the farm contracts.
Also done some misc changes: