Open
Conversation
| //This is because in Yearn Vaults line #1746 enforces a check that the balance must be greater than gain + debtpayment | ||
| //We must calculate the growth in staked LOOKS otherwise it isn't ever going to get claimed, and we must withdraw it to pass this revert check. | ||
| withdrawProfitOrFloor(finalProfit); | ||
| withdrawProfitOrFloor(finalProfit, _debtOutstanding); |
There was a problem hiding this comment.
isn't it better to call liquidatePosition(finalProfit) ?
Owner
Author
There was a problem hiding this comment.
We could, but the liquidatePosition(finalProfit) assumes the goal is to liquidate 'X' and that 'X' is already greater than the floor price.
It also means that if profit was 0, we wouldn't be attempting to withdraw debtOutstanding at all?
| debtOutstanding = debtOutstanding.mul(10 ** IDecimals(address(want)).decimals()).div(sharePrice); | ||
| } | ||
| (uint256 shares, , ) = looksRareContract.userInfo(address(this)); | ||
| uint256 upperlimit = Math.max(debtOutstanding,shares); |
There was a problem hiding this comment.
This can be more than what it is staked in the LOOKS contract. If debtOutstanding > shares you are going to do a withdraw on line 144 of looks that you don't have.
Owner
Author
There was a problem hiding this comment.
Yes this should min(). I need the largest number I have, which ironically is min. Good catch.
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.
No description provided.