Gas Optimizations #6
Labels
bug
Something isn't working
G (Gas Optimization)
resolved
Finding has been patched by sponsor (sponsor pls link to PR containing fix)
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
-- 1
All functions that receive uints which are not uint256 could be changed to uint256 and only casted to the intended size when storing it.
More info at: ourzora/v3#125 (comment)
Just swapped the
lend()
function and consequent related tests resulting in:(...) Overall gas change: -11839 (-0.041%)
But there are many other functions (eg.
createLoan
) which could use such change, so the gas saving should be way more than that.-- 2
cache
borrowTicketContract
atcreateLoan
to save one SLOAD on a successful transaction.-- 3
use cached
previousInterestRate
on calling_interestOwed
Overall gas change: -60 (-0.000%)
-- 4
cache
loan.loanAmount
onrepayAndCloseLoan
The text was updated successfully, but these errors were encountered: