Rari-Capital / rari-tank-contracts

Smart Contracts for the Rari "Tanks" (Yield Farming With Borrowed Funds)
7 stars 0 forks source link

QSP-4 Incorrect Max Borrow Amount Computation #10

Open JetJadeja opened 3 years ago

JetJadeja commented 3 years ago

MarketController.sol

The calculation of balanceUSDin MarketController.maxBorrowAmountUSDis incorrect since the balance is denominated in the underlying token unit and it is multiplied by TKN/USD which will return a TKN**2/USD unit value.

JetJadeja commented 3 years ago

Have tested the code, and I cannot seem to understand this issue. The oracle returns a price in TKN/ETH, which is then multiplied by ETH/USD, giving us the equation (token/ETH) * (eth/usd), which is equal to (token/usd).