Lender.sol
and Staking.sol
Public and external function names and public member variable names can be optimized to save gas: Solidity Gas Optimizations - Function Name
The Solidity compiler sorts the function selector in hexadecimal order.
If there is a function which is gas sensitive, it's function selector should be near the top.
When benchmarking a function to optimize its gas cost, you can't change the name, because you won't know that the changes are the result of the name of the function, and thus it's function selector, or if it's because of the changes made inside the function.
For example: if seizeLoan
is called more frequently than refinance
it should have a selector that is ordered higher. Conversely, if refinance is more frequently used, its selector should be higher. As of right now, I believe the refinance
function would be more frequent.
And in Staking.sol
based on (my assumption) of frequency, it could be something like:
deposit
withdraw
claim
So you could consider renaming them (by prefixing or appending characters) to move their selectors up in the list and save on gas.
Interfaces/abstract contracts can be optimized so the most frequently-called functions use the least amount of gas possible during method lookup. Method IDs that have two leading zero bytes can save 128 gas each during deployment, and renaming functions to have lower method IDs will save 22
gas per call, per sorted position shifted.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.