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

Public Functions Can Be External

Summary

Several public functions can be made external

Vulnerability Details

The following functions can be made external as they are not called within the contracts they are defined
function sellProfits(address _profits) public {... // Fees.sol line 26
function borrow(Borrow[] calldata borrows) public { ... // Lender.sol line 232
function repay(uint256[] calldata loanIds) public {. ... // Lender.sol line 292
function startAuction(uint256[] calldata loanIds) public { .. // Lender.sol line 437
function seizeLoan(uint256[] calldata loanIds) public {... // Lender.sol line 548
function refinance(Refinance[] calldata refinances) public { ... // Lender.sol line 591

Impact

Informational + Gas: It is best practise as it represents functions are truly external to contract and never called in the contracts like public functions. It saves gas as external functions can read directly from calldata, there is no need to write arguments to memory first in the case of public functions. This saves gas of copying to memory computations. so external functions are cheaper than public functions. As can be seen all functions listed take in calldata arguments

Tools Used

Manual Analysis

Recommendations

It is recommended to make all public functions not called in the contracts they are defined as external functions

Support

FAQs

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