Platform: Code4rena
Start Date: 01/08/2022
Pot Size: $50,000 USDC
Total HM: 26
Participants: 133
Period: 5 days
Judge: Jack the Pug
Total Solo HM: 6
Id: 151
League: ETH
Rank: 115/133
Findings: 1
Award: $22.03
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: c3phas
Also found by: 0x040, 0x1f8b, 0xA5DF, 0xNazgul, 0xSmartContract, 0xSolus, 0xc0ffEE, 0xkatana, 0xsam, 8olidity, Aymen0909, Bnke0x0, CertoraInc, Chinmay, Chom, CodingNameKiki, Deivitto, Dravee, ElKu, Extropy, Fitraldys, Funen, GalloDaSballo, Guardian, IllIllI, JC, Lambda, MEP, Metatron, MiloTruck, Noah3o6, NoamYakov, PaludoX0, ReyAdmirado, Rohan16, Rolezn, Ruhum, Sm4rty, SooYa, TomJ, Tomio, Waze, _Adam, __141345__, a12jmx, ajtra, ak1, apostle0x01, asutorufos, ballx, benbaessler, bharg4v, bobirichman, brgltd, cryptonue, defsec, delfin454000, dharma09, djxploit, durianSausage, eierina, erictee, fatherOfBlocks, gerdusx, gogo, hake, hyh, ignacio, jag, kaden, kyteg, lucacez, mics, minhquanym, oyc_109, pfapostol, rbserver, ret2basic, robee, rokinot, sach1r0, saian, samruna, scaraven, sikorico, simon135, supernova, teddav, tofunmi, zeesaw
22.0296 USDC - $22.03
Hello, this is my first submission with Code4rena, please be patient as I compare my work with the upcoming report for this project.
Project.sol#inviteContractor emit ContractorInvited(contractor) can use local _contractor instead to spare from storage access
Project.sol#checkSignature can cache 'contractor' as it is always accessed form storage twice.
Project.sol#lendToProject can check _cost > 0 the very first line to save some gas to a honest fat finger.
Project.sol#updateProjectHash can safely increment hashChangeNonce earlier accessing storage only once, e.g. require(_nonce == hashChangeNonce++, "Project::!Nonce"); or cache. No side effects.
Project.sol#updateTaskHash can safely increment hashChangeNonce earlier accessing storage only once e.g. require(_nonce == hashChangeNonce++, "Project::!Nonce"); or cache. No side effects.
Project.sol#checkPrecision can use unchecked around (_amount / 1000) * 1000) == _amount.
Project.sol#allocateFunds can cache _changeOrderedTask.length as it is accessed from storage in four places including a for loop condition
Project.sol#allocateFunds can cache _changeOrderedTask[i] as it is accessed from storage either one or three times
Project.sol#allocateFunds can cache taskCount as it is accessed from storage either two or five places including a for loop condition.
Community.sol#publishProject can replace _community.publishNonce = ++_community.publishNonce; with _community.publishNonce = ++_publishNonce; to save storage access and redundant increment before assignment.
Community.sol#members can cache _communities[_communityID].memberCount as it is accessed in two places from storage including a for loop condition.
Community.sol#returnToLender can use unchecked when calculating uint256 _noOfDays as _communityProject.lastTimestamp is always updated/initialized with block.timestamp and there is no case where result would differ between checked vs unchecked.
HomeFi.sol#createProject can cache projectCount as it is accessed from storage three times.
HomeFi.sol#mintNFT can cache projectCount as it is accessed from storage five times.
All 'someVariable += 1' (Project.sol#addTask) can be replaced by ++someVariable.