Platform: Code4rena
Start Date: 21/06/2022
Pot Size: $50,000 USDC
Total HM: 31
Participants: 99
Period: 5 days
Judges: moose-code, JasoonS, denhampreen
Total Solo HM: 17
Id: 139
League: ETH
Rank: 98/99
Findings: 1
Award: $26.57
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: BowTiedWardens
Also found by: 0v3rf10w, 0x1f8b, 0x29A, 0xKitsune, 0xNazgul, 0xf15ers, 0xkatana, 0xmint, 8olidity, ACai, Bnke0x0, Chom, ElKu, Fabble, Fitraldys, FudgyDRS, Funen, GalloDaSballo, GimelSec, IllIllI, JC, Kaiziron, Lambda, Limbooo, MiloTruck, Noah3o6, Nyamcil, Picodes, PwnedNoMore, Randyyy, RedOneN, Sm4rty, StErMi, TomJ, Tomio, TrungOre, UnusualTurtle, Waze, _Adam, aga7hokakological, ajtra, antonttc, asutorufos, bardamu, c3phas, defsec, delfin454000, exd0tpy, fatherOfBlocks, hansfriese, ignacio, joestakey, kenta, ladboy233, m_Rassska, mics, minhquanym, oyc_109, pashov, reassor, robee, s3cunda, sach1r0, saian, sashik_eth, scaraven, sikorico, simon135, slywaters
26.5707 USDC - $26.57
!= 0
costs 6 less GAS compared to > 0
for unsigned integers in conditional statements with the optimizer enabled.
Use != 0
instead of > 0
in the following statements:
if (amount > 0) IStaking(stakingContract).unstake(amount, false);
if (amountToRequest > 0) tokePoolContract.requestWithdrawal(_amount);
requestWithdrawalAmount > 0
if (requestWithdrawalAmount > 0) {
require(_amount > 0, "Must have valid amount");
if (yieldyTotalSupply > 0) {
if (info.credits > 0) {
if (warmUpBalance > 0) {
require(_amount > 0, "Invalid amount");
require(_amount > 0, "Invalid amount");
require(_totalSupply > 0, "Can't rebase if not circulating");
require(rebasingCreditsPerToken > 0, "Invalid change in supply");
++i
costs less gas compared to i++
or i += 1
for unsigned integers. This is because the pre-increment operation is cheaper (about 5 GAS per iteration).
epoch.number++;
Instead of using the &&
operator in a single require statement to check multiple conditions, using multiple require statements with 1 condition per require statement will save 3 GAS per &&
.
_stakingToken != address(0) && _rewardToken != address(0)
_oldContract != address(0) && _newContract != address(0)
_stakingToken != address(0) && _yieldyToken != address(0) && _tokeToken != address(0) && _tokePool != address(0) && _tokeManager != address(0) && _tokeReward != address(0) && _liquidityReserve != address(0)
!isUnstakingPaused && !isInstantUnstakingPaused
CURVE_POOL != address(0) && (curvePoolFrom == 1 || curvePoolTo == 1)
!isUnstakingPaused && !isInstantUnstakingPaused