Spelling errors that result in getAccountPrimeDebtBalance() Always return 0
Vulnerability Detail
getAccountPrimeDebtBalance() use for Show current debt
function getAccountPrimeDebtBalance(uint16 currencyId, address account) external view override returns (
int256 debtBalance
) {
mapping(address => mapping(uint256 => BalanceStorage)) storage store = LibStorage.getBalanceStorage();
BalanceStorage storage balanceStorage = store[account][currencyId];
int256 cashBalance = balanceStorage.cashBalance;
// Only return cash balances less than zero
debtBalance = cashBalance < 0 ? debtBalance : 0; //<------@audit wrong, Always return 0
}
In the above code we can see that due to a spelling error, debtBalance always ==0
should use debtBalance = cashBalance < 0 ? cashBalance : 0;
Impact
getAccountPrimeDebtBalance() is the external method to check the debt
If a third party integrates with notional protocol, this method will be used to determine whether the user has debt or not and handle it accordingly, which may lead to serious errors in the third party's business
bin2chen
medium
getAccountPrimeDebtBalance() always return 0
Summary
Spelling errors that result in
getAccountPrimeDebtBalance()
Always return 0Vulnerability Detail
getAccountPrimeDebtBalance()
use for Show current debtIn the above code we can see that due to a spelling error,
debtBalance
always ==0 should usedebtBalance = cashBalance < 0 ? cashBalance : 0;
Impact
getAccountPrimeDebtBalance()
is the external method to check the debt If a third party integrates with notional protocol, this method will be used to determine whether the user has debt or not and handle it accordingly, which may lead to serious errors in the third party's businessCode Snippet
https://github.com/sherlock-audit/2023-03-notional/blob/main/contracts-v2/contracts/external/Views.sol#L496
Tool used
Manual Review
Recommendation