If statements can be customized like down below to save gas
The order of the checks should be like this in case of revert it traverse from low gas used to high gas used checks and revert early
p.lender != msg.sender
16 gas
p.minLoanSize == 0
12 gas
p.maxLoanRatio == 0
12 gas
p.auctionLength == 0
20 gas
p.auctionLength > MAX_AUCTION_LENGTH
40 gas
p.interestRate > MAX_INTEREST_RATE
60 gas
LenderTest:test_createPool() (gas: 240654)
LenderTest:test_createPool() (gas: 240638)
changing validation into this layout to save gas
if (p.lender != msg.sender) revert PoolConfig();
if (p.minLoanSize == 0 ) revert PoolConfig();
if (p.maxLoanRatio == 0 ) revert PoolConfig();
if (p.auctionLength == 0 ) revert PoolConfig();
if (p.auctionLength > MAX_AUCTION_LENGTH) revert PoolConfig();
if (p.interestRate > MAX_INTEREST_RATE) revert PoolConfig();
Foundry test suit- snapshot
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.