Open code423n4 opened 2 years ago
0xRajeev
Moving _checkBorrowEnabled and _checkDepositsEnabled checks to before the mint function call will save gas for invalid calls and is also a best practice to move validation checks closest to the interface.
https://github.com/code-423n4/2021-09-wildcredit/blob/c48235289a25b2134bb16530185483e8c85507f8/contracts/LendingPair.sol#L538-L542
https://github.com/code-423n4/2021-09-wildcredit/blob/c48235289a25b2134bb16530185483e8c85507f8/contracts/LendingPair.sol#L556-L559
Manual Analysis
Move _checkBorrowEnabled and _checkDepositsEnabled checks to before the mint function calls.
Handle
0xRajeev
Vulnerability details
Impact
Moving _checkBorrowEnabled and _checkDepositsEnabled checks to before the mint function call will save gas for invalid calls and is also a best practice to move validation checks closest to the interface.
Proof of Concept
https://github.com/code-423n4/2021-09-wildcredit/blob/c48235289a25b2134bb16530185483e8c85507f8/contracts/LendingPair.sol#L538-L542
https://github.com/code-423n4/2021-09-wildcredit/blob/c48235289a25b2134bb16530185483e8c85507f8/contracts/LendingPair.sol#L556-L559
Tools Used
Manual Analysis
Recommended Mitigation Steps
Move _checkBorrowEnabled and _checkDepositsEnabled checks to before the mint function calls.