-
Notifications
You must be signed in to change notification settings - Fork 15
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
[amm] Prove construction safety for "hTokenOutForUnderlyingIn" and "underlyingOutForHTokenIn" #11
Comments
Note that since this hasn't been proved mathematically yet, I added a require statement right before the last operation of both "hTokenOutForUnderlyingIn" and "underlyingOutForHTokenIn". But I didn't write tests that cover this require branch because I don't know any inputs which can trigger it. |
Benson worked on this and came up with a beautiful explanation for why this construction is safe in the realm of pure mathematics. Now the question is to prove whether Solidity’s inevitable rounding errors don’t break the purely mathematical logic. |
Problem Statement
In the hTokenOutForUnderlyingIn and the underlyingOutForHTokenIn functions, the last operation is a subtraction:
And:
The task is to derive a mathematical proof that it is not possible for this subtraction to revert.
Suggestions
The text was updated successfully, but these errors were encountered: