Open hats-bug-reporter[bot] opened 3 days ago
Github username: -- Twitter username: -- Submission hash (on-chain): 0xfe48c86ee5fde1eaae0770dab56021baee6c579c2aa94c61a309134d82982c86 Severity: low
Description: Description\ In the _deposit function of the EthMultiVault contract, there are two minor inefficiencies:
_deposit
totalAssetsDelta <= 0
totalSharesDelta
sharesForReceiver
While these issues don't pose security risks, they represent opportunities for gas optimization and code clarity.
Attack Scenario\ These issues don't present direct attack vectors, but they have the following implications:
Attachments
Proof of Concept (PoC) File
Revised Code File (Optional)
function _deposit(address receiver, uint256 id, uint256 value) internal returns (uint256) { if (previewDeposit(value, id) == 0) { revert Errors.MultiVault_DepositOrWithdrawZeroShares(); } (uint256 totalAssetsDelta, uint256 sharesForReceiver, uint256 userAssetsAfterTotalFees, uint256 entryFee) = getDepositSharesAndFees(value, id); // Corrected: Remove unnecessary comparison with zero if (totalAssetsDelta == 0) { revert Errors.MultiVault_InsufficientDepositAmountToCoverFees(); } // Corrected: Remove unnecessary variable // set vault totals (assets and shares) _setVaultTotals(id, vaults[id].totalAssets + totalAssetsDelta, vaults[id].totalShares + sharesForReceiver); // mint `sharesOwed` shares to sender factoring in fees _mint(receiver, id, sharesForReceiver); emit Deposited( msg.sender, receiver, vaults[id].balanceOf[receiver], userAssetsAfterTotalFees, sharesForReceiver, entryFee, id ); return sharesForReceiver; }
Github username: -- Twitter username: -- Submission hash (on-chain): 0xfe48c86ee5fde1eaae0770dab56021baee6c579c2aa94c61a309134d82982c86 Severity: low
Description: Description\ In the
_deposit
function of the EthMultiVault contract, there are two minor inefficiencies:totalAssetsDelta <= 0
, which is redundant for unsigned integers.totalSharesDelta
is created but is identical tosharesForReceiver
, making it unnecessary.While these issues don't pose security risks, they represent opportunities for gas optimization and code clarity.
Attack Scenario\ These issues don't present direct attack vectors, but they have the following implications:
Attachments
Proof of Concept (PoC) File
Revised Code File (Optional)