-
Notifications
You must be signed in to change notification settings - Fork 0
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
Write pseudo code for mellow-gearbox_wETH strategy to start discussions #6
Conversation
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.
Initial set of comments.
src/Strategy.sol
Outdated
function _withdrawSome(uint256 _amount) internal { | ||
uint256 _lptToBurn = Math.min(wantToMelloToken(_amount), balanceOfMellowToken()); // see dev comment above | ||
|
||
gearboxRootVault.registerWithdrawal(_lptToBurn); // queues up withdrawals for current epoch. Also closes out any hanging withdrawals from before, so may have more wantToken in the strategy then we wanted from 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 probably want to have a setter function here to manually request a withdrawal.
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.
Are you suggesting a function that simply calls registerWithdrawal()
whenever we want to manually do so? This would be in addition to this internal function _withdrawSome()
?
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.
The only reason I can think of for two functions atm, is permissions. withdrawSome()
seems to be an internal
function usually, and manualWithdraw()
sounds like a permissioned, onlyStrategist
function call
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.
Correct, we should have both the internal
function and a permissionned function that can be called by sms.
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 actually think I need to coordinate this with the harvest()
sequences that we decide are going to be used with this strategy. Will update this as we sort this out in issue #7
returns (address[] memory) | ||
// from angle strategy: wantToken is transferred by the base contract's migrate function | ||
|
||
// TODO - possibly transfer CRV |
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 was under the impression that all rewards were handled by Mellow, and we would only get the yield in term of want
token. Please clarify if there are cases where we could end up with CRV/CVX tokens.
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 have received clarification that all rewards are handled by Mellow. There may be moments where the rewards are still in their original form, CRV/CVX tokens, but that would only happen in circumstances where the Mellow bot hasn't swapped && reinvested the rewards tokens due to the adjustPosition
associated to the marginFactor
not being triggered.
TODO - I need to confirm this moment though with Mellow. If this is what happens, the estimatedTotalAssets()
function and any other querying
functions will need to keep this circumstance in mind.
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.
Would CRV
/ CVX
tokens be transferred to the strategy? If that's a possibility, we need the yswaps logic, else it can be removed completely.
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.
From a conversation with Mellow Protocol Team:
The CRV/CVX rewards are never given to the user in form of CRV/CVX, they exist in CRV/CVX only as a part of the internal workflow of the strategy. So, I think you could see it as a strategy fully operating with users in WETH only.
I think I am still trying to understand how one could carry out fairly accurate accounting at any point with this strategy. It may be down to just checking all possible locations for rewards tokens too & converting it to wantTokens
. @0xValJohn what do you think? Do we need to go that far?
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.
This thread basically hinges on my assumptions being right or wrong:
A common yearn workflow, IIRC, is to check accounting for strategies per vault. That said, there may come times when the strategy calls for an accounting
report from the strategy, and thus we will have to calculate estimatedTotalAssets
within the strategy. From the sounds of it, the Mellow credit account may have reward tokens at certain times until the Mellow bot rebalances (via swapping rewards for further wantTokens
). So we would simply have to ensure we check contracts for any value
when calculating ´estimatedTotallAssets´. Does this sound like overkill or fair?
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 think it's better to simplify things here and only account for rewards that are "claimable" and converted back to want
.
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.
Sounds good to me!
a331e0e
to
0c3dde6
Compare
8466b03
to
d329d42
Compare
Recent commits have been made as an initial attempt at resolving issue #7 and issue #15. The keys, previously stated #7, was used to help map out the sequence for harvest() sequences based on DR changing actions from the vault. Details of the changes are mainly in: valueOfMellowLPT() - LINK There are TODOs still within the |
Closing this PR as it is continued in PR #18. Val John had started this new PR since there were some issues with this one (minor), and it seemed easier to deal with in a new PR. Please take a look at this new PR for other discussion topics and use this one for the early development context. |
Primary Goals of PR
Write pseudo code to define scope of implementation details:
TODO:
NOTES:
Strategy.sol
. Also, note that I kept a couple of aspects from the Angle protocol strategy you had sent me as a reference with the anticipation to change it based on peer review discussions.