Backed Protocol contest - Funen's results

Protocol for peer to peer NFT-Backed Loans.

General Information

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

Backed Protocol

Findings Distribution

Researcher Performance

Rank: 46/47

Findings: 1

Award: $34.90

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

34.8992 USDC - $34.90

Labels

bug
G (Gas Optimization)
sponsor acknowledged

External Links

  1. Using short reason string can be used for saving more gas

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
  1. Using && operator can saving more gas

https://github.com/code-423n4/2022-04-backed/blob/e8015d7c4b295af131f017e646ba1b99c8f608f0/contracts/NFTLoanFacilitator.sol#L81-L86

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
AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter