Open
Conversation
Comment on lines
+375
to
+391
| assert not self.is_killed | ||
|
|
||
| if block.timestamp >= self.time_cursor: | ||
| self._checkpoint_total_supply() | ||
|
|
||
| last_token_time: uint256 = self.last_token_time | ||
|
|
||
| if self.can_checkpoint_token and (block.timestamp > last_token_time + TOKEN_CHECKPOINT_DEADLINE): | ||
| self._checkpoint_token() | ||
| last_token_time = block.timestamp | ||
|
|
||
| last_token_time = last_token_time / WEEK * WEEK | ||
|
|
||
| tokens_amount: uint256 = 0 | ||
| eth_amount: uint256 = 0 | ||
|
|
||
| tokens_amount, eth_amount = self._claim(_addr, self.voting_escrow, last_token_time, True) |
Contributor
There was a problem hiding this comment.
This entire block (plus up to the return statement), can be refactored into a common _checkpoint_and_claim and be invoked by claim and claim_all, the only difference being a flag argument which determines how the internal _claim is called. The return values of this helper function (tokens_amount, eth_amount) will be the returns of the parent.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.