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: 58/147
Findings: 2
Award: $93.25
🌟 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
No need to add getUnvestedAmount
to amount
since it's 0;
/// @notice The amount of the last asset distribution from the controller contract into this /// contract + any unvested remainder at that time uint256 public vestingAmount;
function transferInRewards(uint256 amount) external nonReentrant onlyRole(REWARDER_ROLE) notZero(amount) { if (getUnvestedAmount() > 0) revert StillVesting(); uint256 newVestingAmount = amount + getUnvestedAmount(); //@note, getUnvestedAmount == 0 vestingAmount = newVestingAmount; lastDistributionTimestamp = block.timestamp; // transfer assets from rewarder to this contract IERC20(asset()).safeTransferFrom(msg.sender, address(this), amount); emit RewardsReceived(amount, newVestingAmount); }
or it can be refactored, e.g
/// @notice The amount of the last asset distribution from the controller contract into this contract uint256 public vestingAmount;
function transferInRewards(uint256 amount) external nonReentrant onlyRole(REWARDER_ROLE) notZero(amount) { if (getUnvestedAmount() > 0) revert StillVesting(); vestingAmount = amount; lastDistributionTimestamp = block.timestamp; // transfer assets from rewarder to this contract IERC20(asset()).safeTransferFrom(msg.sender, address(this), amount); emit RewardsReceived(amount); }
/// @notice Event emitted when the rewards are received event RewardsReceived(uint256 indexed amount);
removeSupportedAsset
function to ensure that stEth cannot be removed from supported assets list, It's the base asset for the protocol, and its removal affects protocol yield generation.
e.gfunction removeSupportedAsset(address asset) external onlyRole(DEFAULT_ADMIN_ROLE) { if (!_supportedAssets.remove(asset)) revert InvalidAssetAddress(); if (asset == address(stETH) revert Error(); emit AssetRemoved(asset); }
constructor( ... { if (address(_usde) == address(0)) revert InvalidUSDeAddress(); if (_custodians.length == 0) revert NoCustodianProvided(); ... }
redistributeLockedAmount
function, consider checking that the address to
is not a zero address before burning. As the function stands, if address to
is 0, the entire balance will be burned without any token being redistributed. There's no revert or else
, so upon 0 address, the condition silently fails, the interaction continues and nothing is reallly distributed,function redistributeLockedAmount(address from, address to) external onlyRole(DEFAULT_ADMIN_ROLE) { if (hasRole(FULL_RESTRICTED_STAKER_ROLE, from) && !hasRole(FULL_RESTRICTED_STAKER_ROLE, to)) { uint256 amountToDistribute = balanceOf(from); _burn(from, amountToDistribute); // to address of address(0) enables burning if (to != address(0)) _mint(to, amountToDistribute); //@note, if 0, interaction continues emit LockedAmountRedistributed(from, to, amountToDistribute); } else { revert OperationNotAllowed(); } }
#0 - c4-pre-sort
2023-11-02T03:17:27Z
raymondfam marked the issue as sufficient quality report
#1 - c4-judge
2023-11-14T16:51:40Z
fatherGoose1 marked the issue as grade-b
🌟 Selected for report: radev_sw
Also found by: 0xSmartContract, 0xweb3boy, Al-Qa-qa, Bauchibred, Bulletprime, D_Auditor, J4X, JCK, K42, Kral01, Sathish9098, ZanyBonzy, albahaca, catellatech, clara, digitizeworx, fouzantanveer, hunter_w3b, invitedtea, jauvany, oakcobalt, pavankv, peanuts, xiao
88.7348 USDC - $88.73
USDe
in exchange for stUSDe, which increases in value relative to USDe as the protocol earns yield.USDe
tokens minted to the required account.USDe
during the stake cooldown process. USDe is withdrawn into the staking contracts to be passed on to the user.We approached the audit in 3 general steps after which we generated our report.
30 hours
#0 - c4-pre-sort
2023-11-01T14:50:47Z
raymondfam marked the issue as sufficient quality report
#1 - c4-judge
2023-11-10T19:13:52Z
fatherGoose1 marked the issue as grade-a