Open steve0xp opened 1 year ago
PR #6 is where commits related to this issue will be recorded, unless the PR is deemed out of scope for some reason.
For discussion: how does Tokemak strategy handles this? We would want to automate this as much as possible under normal operations (scale up, scale down, maintain DR).
Tokemak strategy that you shared for me to check out: https://github.com/charlesndalton/generic-tokemak-strat/blob/master/contracts/Strategy.sol
From looking through the Tokemak Strategy.sol
and test_accounting_edge_cases.py
I've gathered the following:
What does this all mean for this strategy?
@0xValJohn please comment when you have a chance
Moving forward to implement the flow of the Tokemak strategy. Just want clarification from Val John on whether my understanding is correct or not.
Spoke w/ Val John about this. Here's the summary tweaking my thoughts (full context below in toggle):
Two Main Points
estimatedTotalAssets
should only be a function of claimable wantToken
- That is the key here that I was missing! AKA, profitFromCurrentAndFutureHarvest
should not be included in the estimatedTotalAssets
calculationThat way, we have the
new profit
accounted for when we have theactual profits
realized. This is a key tweak from the regular setup ofestimatedTotalAssets
because most strategies are liquid and not illiquid like this one
My current thoughts on the trigger
question:
a. Cycle 1: I believe the amount we queue up to withdraw
(which includes the profits from that respective cycle) in one cycle, would eventually transfer from being 'active' in the mellow-gearbox credit account.
b. Cycle 2: At that point, we would have a harvestTrigger()
monitoring the amount waiting to be claimed,
or we'd have a harvestTrigger()
be triggered via a bot
from mellow (as per past conversations where they said they could automatically push the ready-to-go amounts to us.
I'd need to triple-check on the fact that the 'ready-to-claim' tokens are no longer active in the credit account and are thus claimable at any point (not some window).
Currently working on custom harvestTrigger()
and the details of estimatedTotalAssets()
. IMO it is going to involve the GearboxRootVault.epochToPriceForLpTokenD18(_currentEpoch);
and price for thelatestRequestEpoch[address yearnStrategy]
.
TODO - clean up this thread as it is confusing right now
See PR #6 - where recent commits have been made as an initial attempt at resolving this and issue #15.
The keys, previously stated here, 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](https://github.com/umphams/yearn_mellow-gearbox-strategy/blob/sp/draft-v1-strategy/src/Strategy.sol#:~:text=function%20valueOfMellowLPT()%20public%20view%20returns%20(uint256)%20%7B)liquidatePosition()
- LINKharvestTrigger()
- LINKPR #18 incorporates implementation code related to this issue. Leaving this issue open until we have tests and feel that this has been resolved fully alongside issue #15
Live Notes from Chats with Mellow Team && Val John
registerWithdraw()
when it comes to how theperiod
works within MellowStrategy. Thus no need to designharvest()
timing aroundperiods
really.registeredWithdraws
that Yearn already has. That logic matters. Empty out the withdraws before callingregisterWithdraw()
perhaps? Gotta think about it.Decide between:
harvestTriggers()
&& get possibly incorrect losses or not have them reported due to the async nature of this strategy, ORharvest()
from theSMS
(strategist multisig) --> 3/9 multisig of strategists. --> SMS callsharvestTrigger()
once && KEEP3Rsharvest()
when gas makes sense.