[wip] Same Token Staking + Improved Features#2
Open
DeFiFoFum wants to merge 9 commits into
Open
Conversation
- fixed logic for update reward block with reflect tokens - allow pool creator to be the owner of the pool to change endblock and other features
Apegurus
reviewed
May 5, 2021
Comment on lines
+320
to
+323
| if(isSameTokenPool()) { | ||
| // TODO: Is there a way we can calculate this easier? | ||
| // NOTE: If both tokens are reflect tokens then this is difficult | ||
| return 0; |
Contributor
There was a problem hiding this comment.
Could we have only one of these made available for single token stake pools?
Would:
return totalRewardTokenBalance().add(totalStakeTokenBalance()).sub(rewardBalance).sub(totalStaked);
Work if we do this?
Contributor
Author
There was a problem hiding this comment.
Ahh nice call. That's a solid approach.
Apegurus
reviewed
May 5, 2021
| console.log({ amount: amount.toString(), rewardDebt: rewardDebt.toString() }); | ||
| } | ||
|
|
||
| async function getPoolSnapshot(rewardPoolContract) { |
Apegurus
approved these changes
May 5, 2021
Apegurus
left a comment
Contributor
There was a problem hiding this comment.
Outstanding work! Looking good. Some tests are missing but we can also deploy this into testnet and take a deeper look
Just a small comment that might help out
- Add OZ reeentrancy guard to protect against withdraw/deposit attacks - Calculate same token fee balance - rename functions to balanceOfStakeToken and balanceOfRewardToken for better readability
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.
NOTE: Based on this update, rewards MUST be deposited through the deposit function or they won't be counted towards rewards. This is to account for same token staking/reflect fees.
bonusEndBlock, emergencyWithdraw rewards, and skim stake and reward token feesrewardsLeftToPayinstead oftotalRewardDebtto give a more robust way to find theavailableRewardsbonusEndBlockwhich takes the currentrewardPerBlockand finds how many blocks should be extended based on the deposit amount