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

BorrowModule.sol: error calculating how many tokens can be withdrawn #1

Open
hra687261 opened this issue Mar 12, 2022 · 0 comments
Open

Comments

@hra687261
Copy link

In BorrowModule.sol:

fraction tmp = healthDelta.numFMul(tokenPrices[mi.token]);
uint256 possibleTokenWithdraw = tmp.toNum();

Should be replaced by:

fraction tmp = healthDelta.numFDiv(tokenPrices[mi.token]); 
uint256 possibleTokenWithdraw = tmp.toNum(); 

healthDelta is the value of the user's available collateral in USD, aka the value of their borrowing capacity in USD.
To determine how many tokens they can borrow, the price of the free collateral should be divided by the price of the token, not multiplied by it.

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

No branches or pull requests

1 participant