-
Notifications
You must be signed in to change notification settings - Fork 44
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
ApeCoinStake Strategy #79
base: master
Are you sure you want to change the base?
Conversation
} | ||
|
||
function _liquidateReward() internal { | ||
uint256 rewardBalance = IERC20(rewardToken()).balanceOf(address(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.
We need additional logic to separate rewards from deposits, as underlying == rewardToken. See an example in the YEL strategy: https://github.com/harvest-finance/harvest-strategy/blob/master/contracts/strategies/yel/YelStrategy.sol#L136
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 noticed this problem and handled it differently in doHardWork
function. But this approach is more obvious.
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 will update it
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 noticed this problem and handled it differently in
doHardWork
function. But this approach is more obvious.
But the problem is not resolved that way. When we have a balance in the rewardPool, and someone deposits into the vault, on doHardWork
what happens is:
- Funds from the vault get transferred to the strategy (+APE balance)
- The strategy claims rewards from the rewardPool (+APE balance)
- At liquidation, the APE balance is queried and notified for profit share. This balance now includes the new deposit.
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.
Gotcha. Thanks for your clarification
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.
Looks good!
New strategy for ApeStake
APECOIN
pool.The workflow of this strategy is relatively simple. It just deposits
APE
to earnAPE
, and compounds theAPE
reward to the staking pool.Test outputs at blockNumber = 16233370: