20,000 USDC
View results
Submission Details
Severity: low
Valid

ZeroCollateral check from borrow function can be moved to optimize gas

Summary

This check if (collateral == 0) revert ZeroCollateral(); should be moved above the Pool memory pool = pools[poolId]; line. In case the collateral is 0, the function will revert before initializing the pool variable and performing other checks on pool components.

This is especially important given that this happens within a for loop.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!