Platform: Code4rena
Start Date: 12/08/2022
Pot Size: $50,000 USDC
Total HM: 15
Participants: 120
Period: 5 days
Judge: Justin Goro
Total Solo HM: 6
Id: 153
League: ETH
Rank: 71/120
Findings: 2
Award: $67.00
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: 0x1f8b
Also found by: 0x52, 0xA5DF, 0xDjango, 0xNazgul, 0xNineDec, 0xSmartContract, 0xmatt, 0xsolstars, Aymen0909, Bnke0x0, CertoraInc, Chom, CodingNameKiki, Deivitto, Dravee, ElKu, EthLedger, Funen, IllIllI, JC, Junnon, Lambda, LeoS, MiloTruck, Noah3o6, PaludoX0, ReyAdmirado, Rohan16, RoiEvenHaim, Rolezn, SaharAP, Sm4rty, SooYa, The_GUILD, TomJ, Waze, Yiko, _Adam, __141345__, a12jmx, ak1, asutorufos, auditor0517, ayeslick, ballx, beelzebufo, berndartmueller, bin2chen, brgltd, c3phas, cRat1st0s, cccz, cryptonue, cryptphi, d3e4, delfin454000, dipp, djxploit, durianSausage, dy, erictee, fatherOfBlocks, gogo, gzeon, hyh, ignacio, kyteg, ladboy233, medikko, mics, minhquanym, oyc_109, pfapostol, rbserver, reassor, ret2basic, robee, sach1r0, simon135, sryysryy, tabish, yac, yash90, zzzitron
45.8341 USDC - $45.83
Solidity integer division might truncate. As a result, performing multiplication before division can sometimes avoid loss of precision.
You can first multiply LTV_PRECISION
with the result of (_borrowerAmount * _exchangeRate)
and then divide the result by EXCHANGE_PRECISION
.
🌟 Selected for report: IllIllI
Also found by: 0x1f8b, 0xA5DF, 0xDjango, 0xNazgul, 0xSmartContract, 0xackermann, 0xbepresent, 0xc0ffEE, 0xkatana, 2997ms, Amithuddar, Aymen0909, Bnke0x0, Chinmay, Chom, CodingNameKiki, Deivitto, Diraco, Dravee, ElKu, EthLedger, Fitraldys, Funen, IgnacioB, JC, Junnon, Lambda, LeoS, Metatron, MiloTruck, Noah3o6, NoamYakov, PaludoX0, Randyyy, ReyAdmirado, Rohan16, Rolezn, Ruhum, SaharAP, Sm4rty, SooYa, TomJ, Tomio, Waze, Yiko, _Adam, __141345__, a12jmx, ajtra, ak1, asutorufos, ballx, brgltd, c3phas, cRat1st0s, carlitox477, chrisdior4, d3e4, delfin454000, dharma09, djxploit, durianSausage, erictee, fatherOfBlocks, find_a_bug, flyx, francoHacker, gerdusx, gogo, gzeon, hakerbaya, ignacio, jag, kyteg, ladboy233, ltyu, m_Rassska, medikko, mics, mrpathfindr, newfork01, nxrblsrpr, oyc_109, pfapostol, rbserver, reassor, ret2basic, robee, sach1r0, saian, simon135, sryysryy, zeesaw
21.1721 USDC - $21.17
constant
A state variable whose value has been assigned at the time of declaration should be defined as constant
to save gas.
FraxlendPairCore.sol
FraxlendPairDeployer.sol
Define version
, DEFAULT_MAX_LTV
, GLOBAL_MAX_LTV
, and DEFAULT_LIQ_FEE
as constant
.
Uint variable's default value is zero. So, you can save gas by just defining uint variables.
initialize()
getAllPairAddresses()
getCustomStatuses()
globalPause()
setRateContractWhitelist()
setFraxlendDeployerWhitelist()
You can just define uint256 i
in for
loops without initializing it to zero.
Use unchecked blocks for arithmetic operations that can't underflow/overflow.
initialize()
setRateContractWhitelist()
setFraxlendDeployerWhitelist()
You can put ++i
or i++
in for loops in an unchecked block.
!= 0 is a cheaper operation compared to > 0, when dealing with uint. > 0 can be replaced with != 0 for gas optimization.
borrowAsset()
requireValidInitData()
Replace > 0 with != 0 when comparing unsigned integer variables to save gas.
When a variable is just set once during deployment, it can be defined as immutable to save gas.
Define CIRCUIT_BREAKER_ADDRESS
, COMPTROLLER_ADDRESS
, and TIME_LOCK_ADDRESS
as immutable.
require()
statements with revert strings.Using custom errors can save gas instead of using string errors.
Use custom errors instead of require()
statements with revert strings.