Platform: Code4rena
Start Date: 06/01/2023
Pot Size: $210,500 USDC
Total HM: 27
Participants: 73
Period: 14 days
Judge: 0xean
Total Solo HM: 18
Id: 203
League: ETH
Rank: 62/73
Findings: 1
Award: $72.44
๐ Selected for report: 0
๐ Solo Findings: 0
๐ Selected for report: IllIllI
Also found by: 0xA5DF, 0xSmartContract, 0xhacksmithh, AkshaySrivastav, Awesome, Aymen0909, Bauer, Bnke0x0, Breeje, Budaghyan, Cyfrin, Madalad, NoamYakov, RHaO-sec, Rageur, RaymondFam, ReyAdmirado, Rolezn, SAAJ, SaharDevep, Sathish9098, __141345__, amshirif, arialblack14, c3phas, carlitox477, chaduke, delfin454000, descharre, nadin, oyc_109, pavankv, saneryee, shark
72.4433 USDC - $72.44
require()
Statements That Use &&
Saves Gas - (Saves ~3
Gas per &&
)Instead of using the &&
operator in a single require statement to check multiple conditions, using various require statements with 1 condition per require statement will save ~3 GAS per &&
.
Affected line of code:
Using standard addition or subtraction assignment (x = x + y
or x = x - y
) rather than the shorthand versions (x += y
or x -= y
) saves gas. This can save approximately 22 gas per occurrence.
Affected line of code:
Solidity version 0.8+ has an implicit overflow and underflow check on unsigned integers.
When an overflow or an underflow isnโt possible, some gas can be saved using an unchecked block.
For example, the code at RToken.sol#L270-L276 can be refactored to as:
File: /contracts/p1/RToken.sol for (uint256 i = 0; i < erc20s.length;) { IERC20Upgradeable(erc20s[i]).safeTransferFrom( issuer, address(backingManager), deposits[i] ); unchecked { ++i; } }
This is affected in multiple files:
#0 - c4-judge
2023-01-24T22:58:50Z
0xean marked the issue as grade-b