Platform: Code4rena
Start Date: 24/10/2023
Pot Size: $36,500 USDC
Total HM: 4
Participants: 147
Period: 6 days
Judge: 0xDjango
Id: 299
League: ETH
Rank: 108/147
Findings: 1
Award: $4.52
š Selected for report: 0
š Solo Findings: 0
š Selected for report: 0xmystery
Also found by: 0x11singh99, 0xAadi, 0xAlix2, 0xG0P1, 0xStalin, 0xWaitress, 0x_Scar, 0xhacksmithh, 0xhunter, 0xpiken, Al-Qa-qa, Arz, Avci, Bauchibred, BeliSesir, Breeje, Bughunter101, DarkTower, Eeyore, Fitro, HChang26, Imlazy0ne, J4X, JCK, Kaysoft, Kral01, Madalad, Mike_Bello90, Noro, PASCAL, PENGUN, Proxy, Rickard, Shubham, SovaSlava, Strausses, Team_Rocket, ThreeSigma, Topmark, Udsen, Walter, Yanchuan, Zach_166, ZanyBonzy, adam-idarrha, adeolu, almurhasan, arjun16, ast3ros, asui, ayden, btk, cartlex_, castle_chain, cccz, chainsnake, codynhat, critical-or-high, cryptonue, csanuragjain, deepkin, degensec, dirk_y, erebus, foxb868, ge6a, hunter_w3b, jasonxiale, kkkmmmsk, lanrebayode77, lsaudit, marchev, matrix_0wl, max10afternoon, nuthan2x, oakcobalt, oxchsyston, pavankv, peanuts, pep7siup, pipidu83, pontifex, ptsanev, qpzm, radev_sw, rokinot, rotcivegaf, rvierdiiev, sorrynotsorry, squeaky_cactus, supersizer0x, tnquanghuy0512, twcctop, twicek, young, zhaojie, ziyou-
4.5226 USDC - $4.52
Issue | number of Instances | |
---|---|---|
Nā01 | remove useless variable and line in function transferInRewards | 1 |
Nā02 | remove useless check in function _transferCollateral | 1 |
transferInRewards
the function transferInRewards
is used by the REWARDER_ROLE
to give rewards to usde stackers, it will only work if getUnvestedAmount
is 0, revert otherwise.
it assigns the value that the REWARDER_ROLE
is vesting , by adding the amount
of usde tokens vested plus getUnvestedAmount
which is always 0.
that's why we can eliminate a memory varaiable and a line to simplify and optimize code to be like this
vestingAmount = amount;
if (getUnvestedAmount() > 0) revert StillVesting(); uint256 newVestingAmount = amount + getUnvestedAmount(); vestingAmount = newVestingAmount;
_transferCollateral
in the function _transferCollateral
we transfer the collateral given by the user to the various custodians based on ratios, we already check that the sum of the ratios given to the function is 10_000, so there will be no remaining balance after transfering.
but in the function we check if there is some remaining amount, which will never be the case.
should delete the last two lines in the function as they are a branch that will never be visited.
if (remainingBalance > 0) { token.safeTransferFrom(benefactor, addresses[addresses.length - 1], remainingBalance); }
if (totalRatio != 10_000) { return false; }
#0 - c4-pre-sort
2023-11-02T01:12:18Z
raymondfam marked the issue as low quality report
#1 - raymondfam
2023-11-02T01:15:28Z
N-02 is a false positive.
#2 - c4-judge
2023-11-14T17:13:04Z
fatherGoose1 marked the issue as grade-b