-
Notifications
You must be signed in to change notification settings - Fork 4
[wip] Same Token Staking + Improved Features #2
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
base: feature/reflect-tokens
Are you sure you want to change the base?
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
contracts/ApeRewardPool.sol
Outdated
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; |
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.
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?
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.
Ahh nice call. That's a solid approach.
console.log({ amount: amount.toString(), rewardDebt: rewardDebt.toString() }); | ||
} | ||
|
||
async function getPoolSnapshot(rewardPoolContract) { |
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.
Super cool!
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.
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
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 feesrewardsLeftToPay
instead oftotalRewardDebt
to give a more robust way to find theavailableRewards
bonusEndBlock
which takes the currentrewardPerBlock
and finds how many blocks should be extended based on the deposit amount