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: 124/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
EthenaMinting contract
function transferToCustody(address wallet, address asset, uint256 amount) external nonReentrant onlyRole(MINTER_ROLE) { if (wallet == address(0) || !_custodianAddresses.contains(wallet)) revert InvalidAddress(); //@audit-issue => If EthenaMinting contract doesn't have enough native token, the tx will revert! if (asset == NATIVE_TOKEN) { (bool success,) = wallet.call{value: amount}(""); if (!success) revert TransferFailed(); } else { IERC20(asset).safeTransfer(wallet, amount); } emit CustodyTransfer(wallet, asset, amount); }
Fix:
EthenaMinting contract
//@audit-issue => Doesn't enforce a minimum amount of approved custodians, it only removes the given custodian's address function removeCustodianAddress(address custodian) external onlyRole(DEFAULT_ADMIN_ROLE) { if (!_custodianAddresses.remove(custodian)) revert InvalidCustodianAddress(); emit CustodianAddressRemoved(custodian); }
Fix:
EthenaMinting contract
//@audit-issue => Not setting boundaries to limit the upper and lower limits of the new values! function _setMaxMintPerBlock(uint256 _maxMintPerBlock) internal { uint256 oldMaxMintPerBlock = maxMintPerBlock; maxMintPerBlock = _maxMintPerBlock; emit MaxMintPerBlockChanged(oldMaxMintPerBlock, maxMintPerBlock); } //@audit-issue => Not setting boundaries to limit the upper and lower limits of the new values! /// @notice Sets the max redeemPerBlock limit function _setMaxRedeemPerBlock(uint256 _maxRedeemPerBlock) internal { uint256 oldMaxRedeemPerBlock = maxRedeemPerBlock; maxRedeemPerBlock = _maxRedeemPerBlock; emit MaxRedeemPerBlockChanged(oldMaxRedeemPerBlock, maxRedeemPerBlock); }
Fix:
newVestingAmount
variable, as a matter of fact, this variable is also not required, since the value will be the same as the value of the inputted amount
.Fix:
newVestingAmount
, it is not required.function transferInRewards(uint256 amount) external nonReentrant onlyRole(REWARDER_ROLE) notZero(amount) { //@audit-info => If the unvested amount is > 0, it means the previous vesting period is still active! if (getUnvestedAmount() > 0) revert StillVesting(); //@audit-info => If reaches here, the previous vestin period is over, thus, vested amount is 0! //@audit-info => The new vesting amount is just amount! - uint256 newVestingAmount = amount + getUnvestedAmount(); - vestingAmount = newVestingAmount; + vestingAmount = amount; lastDistributionTimestamp = block.timestamp; // transfer assets from rewarder to this contract IERC20(asset()).safeTransferFrom(msg.sender, address(this), amount); - emit RewardsReceived(amount, newVestingAmount); + emit RewardsReceived(amount); }
function removeCustodianAddress(address custodian) external onlyRole(DEFAULT_ADMIN_ROLE) { //@audit-issue => Not pulling the funds that were transfered to the custodian if (!_custodianAddresses.remove(custodian)) revert InvalidCustodianAddress(); emit CustodianAddressRemoved(custodian); }
Fix:
#0 - raymondfam
2023-11-02T03:00:32Z
L-03 from the bot.
#1 - c4-pre-sort
2023-11-02T03:00:38Z
raymondfam marked the issue as sufficient quality report
#2 - c4-judge
2023-11-14T16:44:34Z
fatherGoose1 marked the issue as grade-b