Skip to content

Comments

feat: added support for claim all#180

Open
UrAvgDeveloper wants to merge 1 commit intomasterfrom
feat/claim-all
Open

feat: added support for claim all#180
UrAvgDeveloper wants to merge 1 commit intomasterfrom
feat/claim-all

Conversation

@UrAvgDeveloper
Copy link
Contributor

No description provided.

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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

Successfully merging this pull request may close these issues.

2 participants