8000 Fix roundings · Issue #78 · morpho-org/morpho-blue · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix roundings #78

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

Closed
MathisGD opened this issue Jul 8, 2023 · 2 comments · Fixed by #109
Closed

Fix roundings #78

MathisGD opened this issue Jul 8, 2023 · 2 comments · Fixed by #109
Assignees

Comments

@MathisGD
Copy link
Contributor
MathisGD commented Jul 8, 2023

Noted by @pakim249CAL, we don't round correctly (meaning rounding in favor of the protocol) everywhere (borrow/withdraw).

@MathisGD MathisGD self-assigned this Jul 8, 2023
@QGarchery
Copy link
Contributor

Cool, I thought it would be a difficult problem as in morpho-v1, but we have a clear way of fixing rounding errors here ! In morpho-v1, you had the issue that you were sometimes starting from an amount in underlying (by using the main entry points), and sometimes starting from an scaled amount (by matching/unmatching users). This meant that it was unclear what rounding in favor of the protocol meant.

For liquidations, starting from the amount seized, I think we can round in the following way:

  • for the borrow shares computed, round down. We can interpret it as the liquidation incentive being a bit higher, so it should be fine
  • for the amount repaid, round up. It means that the liquidator is potentially repaying a bit more than the value in shares, so it's in favor of the protocol

@Rubilmax
Copy link
Collaborator

I'm fixing this via #71

@QGarchery QGarchery mentioned this issue Jul 10, 2023
Merged
@Rubilmax Rubilmax linked a pull request Jul 11, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants
0