-
Notifications
You must be signed in to change notification settings - Fork 10
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
Prevent DIV/0 revert calculating MOMP on a pool with no loans #712
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ import { | |
_priceAt, | ||
_reserveAuctionPrice, | ||
MAX_FENWICK_INDEX, | ||
MAX_PRICE, | ||
MIN_PRICE | ||
} from './libraries/helpers/PoolHelper.sol'; | ||
|
||
|
@@ -318,9 +319,10 @@ contract PoolInfoUtils { | |
) external view returns (uint256) { | ||
IPool pool = IPool(ajnaPool_); | ||
|
||
(uint256 debt, , ) = pool.debtInfo(); | ||
( , , uint256 noOfLoans) = pool.loansInfo(); | ||
noOfLoans += pool.totalAuctionsInPool(); | ||
if (noOfLoans == 0) return MAX_PRICE; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about returning the price of the top bucket? Basically replace There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i mean top priced bucket with deposit > 0 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in e433d8cfba109191cdb67b74179836a7405d37d9; please re-review. |
||
(uint256 debt, , ) = pool.debtInfo(); | ||
return _priceAt(pool.depositIndex(Maths.wdiv(debt, noOfLoans * 1e18))); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was
MAX_PRICE
added? I don't see it used, suggest it is removed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in 111ce68.