Skip to content
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

feat: test small losses #440

Merged
merged 1 commit into from
Dec 14, 2021
Merged

feat: test small losses #440

merged 1 commit into from
Dec 14, 2021

Conversation

poolpitako
Copy link
Contributor

Here's an edge case of small loss not dropping the debt ratio.
The "root issue" is:

ratio_change: uint256 = min(
            loss * self.debtRatio / self.totalDebt,
            self.strategies[strategy].debtRatio,
        )

min there works like min(int(a), int(b)). if loss is small enough, loss * self.debtRatio / self.totalDebt will be greater than 0 but smaller than 1.

@poolpitako poolpitako requested a review from fubuloubu July 13, 2021 17:02
@pandadefi pandadefi force-pushed the poolpi/test_small_losses branch from 57cf96b to e612ef9 Compare July 20, 2021 06:47
@pandadefi pandadefi closed this Dec 14, 2021
@pandadefi pandadefi force-pushed the poolpi/test_small_losses branch from e612ef9 to 22a2345 Compare December 14, 2021 10:21
@pandadefi pandadefi reopened this Dec 14, 2021
@pandadefi pandadefi force-pushed the poolpi/test_small_losses branch from 4829e98 to 63cd782 Compare December 14, 2021 10:36
@pandadefi
Copy link
Contributor

pandadefi commented Dec 14, 2021

I have *** up the rebase so change were lost and the branch got closed.

I have updated the test so that the values used are more simple to read.

@pandadefi pandadefi force-pushed the poolpi/test_small_losses branch from 63cd782 to 879ec7f Compare December 14, 2021 10:39
@pandadefi pandadefi enabled auto-merge (squash) December 14, 2021 10:40
Co-authored-by:  poolpitako  <78830419+poolpitako@users.noreply.github.com>

># Please enter the commit message for your changes. Lines starting
@pandadefi pandadefi force-pushed the poolpi/test_small_losses branch from 879ec7f to e04c54e Compare December 14, 2021 11:51
@pandadefi pandadefi merged commit e80a628 into main Dec 14, 2021
@pandadefi pandadefi deleted the poolpi/test_small_losses branch December 14, 2021 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants