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

## [G-17] Before transfer of some functions, we should check some variables for possible gas save

Summary

[G-17] Before transfer of some functions, we should check some variables for possible gas save

Before transfer, we should check for amount being 0 so the function doesn't run when its not gonna do anything:

file: /src/Beedle.sol
19 super._afterTokenTransfer(from, to, amount);

https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Beedle.sol#L19

file: /src/Fees.sol
43 IERC20(WETH).transfer(staking, IERC20(WETH).balanceOf(address(this)));

https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Fees.sol#L43

file: /src/Lender.sol
271 IERC20(loan.collateralToken).transferFrom(

https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L271

file: /src/Lender.sol
317 IERC20(loan.loanToken).transferFrom(

https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L317

Support

FAQs

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