Platform: Code4rena
Start Date: 05/04/2022
Pot Size: $30,000 USDC
Total HM: 10
Participants: 47
Period: 3 days
Judge: gzeon
Total Solo HM: 4
Id: 106
League: ETH
Rank: 46/47
Findings: 1
Award: $34.90
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: Dravee
Also found by: 0v3rf10w, 0x1f8b, 0xkatana, CertoraInc, FSchmoede, Funen, IllIllI, Kenshin, Meta0xNull, TerrierLover, Tomio, csanuragjain, joshie, obront, rayn, rfa, robee, saian, securerodd, sorrynotsorry, t11s, z3s
34.8992 USDC - $34.90
Every reason string takes at least 32 bytes. Use short reason strings that fits in 32 bytes or it will become more expensive.
##Tool Used Manual Review
##Occurance :
NFTLoanFacilitator.sol#L121 NFTLoanFacilitator.sol#L178
Sometimes using mutiple require can save more gas, but in this case it was cost less gas than using mutiple require. So this implementation below can saving more gas
##Tool Used yarn test & remix
##Recommended Mitigation
require(minDurationSeconds != 0, 'NFTLoanFacilitator: 0 duration'); require(minLoanAmount != 0, 'NFTLoanFacilitator: 0 loan amount'); require(collateralContractAddress != lendTicketContract, 'NFTLoanFacilitator: cannot use tickets as collateral'); require(collateralContractAddress != borrowTicketContract, 'NFTLoanFacilitator: cannot use tickets as collateral'); // it cost 3203689 deployment -> yarn // it cost 4200578 deployment -> remix
change to
require(minDurationSeconds != 0, 'NFTLoanFacilitator: 0 duration'); require(minLoanAmount != 0, 'NFTLoanFacilitator: 0 loan amount'); require(collateralContractAddress != lendTicketContract && collateralContractAddress != borrowTicketContract, 'NFTLoanFacilitator: cannot use tickets as collateral'); // it cost 3191073 deployment -> yarn // it cost 4186030 deployment -> remix