The LendingPool::getNFTPrice gets price from the HousePriceOracle and directly returns it.
The issue is, this price is not scaled for use in the protocol which uses WAD | RAY precision values throught the functions.
In the LendingPool.test.js, it's been stated the oracle price returned should be changed. The tests only work because
house prices have been hardcoded to a wad precision value. The real prices will not be in WAD or RAY precision and direct use of it
would lead to problems,
Meaning, it should be scaled appropriately for use. This would cause problems in the following functions that make use
of the price returned,
borrow():
It first calculates userTotalDebt in ray precision. Then it compares it against the collateralValue which calls getNFTPrice for the price. Both collateralValue & userTotalDebt are expected to be RAY precision. The borrow feature would be DOS-ed since initially, userTotalDebt (RAY) would always be > collateralValue (6 decimal | 8 decimal USD value). Initially, the user.scaledDebtBalance would be zero, but amount (should be coverted to RAY before it is summed with user.scaledDebtBalance which is another issue) added to it would make userTotalDebt go way beyond the unscaled collateralValue value resulting in DOS. As stated before,
2.withdrawNFT(): Uses it like this,
If price returned isn't in ray precision, any other precision value would result in revert, since
it would be less than the userDebt which is 27 decimal ray precision.
3.getHealthFactor():
Incorrect healthfactor returned resulting in a lower hf than necessary resulting in user liquidated easily and undeservedly.
Furthermore, in RAACNFT.sol, NFT purchase happens at the price returned by tokenToHousePrice,
If the price returned isn't properly scaled to be compared with underlyingToken amount decimals (usually 18), this would lead to
users minting NFTs at negligible price, and borrow RToken from LendingPool for a profits since their collateral that gets liquidated won't be worth much.
A DOS in all the functions stated, and negligible NFT prices break the core functionality of the protocol.
Manual Review
Either scale it to return wad precision value or RAY precision value since it's compared against userDebt which is a RAY-precision value.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.