If the minAmountToDepositInUsd is increased by the VaultAdmin, existing users can deposit amounts smaller than the minimum amount
Summary
The VaultAdmin can change the minAmountToDepositInEuro to a new value through the setMinAmountToDeposit function. When this value is increased, users that already have made deposits can make deposits which are smaller than the minAmountToDepositInEuro.
Vulnerability Detail
minAmountToDepositInEuro = 100k
Alice deposits 100k
totalDeposited[Alice]= 100k
VaultAdmin then increases the minAmountToDepositInEuro to 500k
Alice deposits another 100k.
The _validateAmountUsdIn function does not check the amount against the minimum amount since if (totalDeposited[user] != 0) return; resolves to true.
As a result, the increase of the minAmountToDepositInEuro by the VaultAdmin is completely ineffective for existing users.
Impact
Assuming the protocol intends to use minAmountToDepositInEuro as an invariant to enforce a minimum deposit amount, the current implementation makes this ineffective for existing users.
14si2o_Flint
medium
If the minAmountToDepositInUsd is increased by the VaultAdmin, existing users can deposit amounts smaller than the minimum amount
Summary
The VaultAdmin can change the
minAmountToDepositInEuro
to a new value through thesetMinAmountToDeposit
function. When this value is increased, users that already have made deposits can make deposits which are smaller than theminAmountToDepositInEuro
.Vulnerability Detail
minAmountToDepositInEuro
= 100k Alice deposits 100ktotalDeposited[Alice]
= 100kVaultAdmin then increases the
minAmountToDepositInEuro
to 500kAlice deposits another 100k. The
_validateAmountUsdIn
function does not check the amount against the minimum amount sinceif (totalDeposited[user] != 0) return;
resolves to true.As a result, the increase of the
minAmountToDepositInEuro
by the VaultAdmin is completely ineffective for existing users.Impact
Assuming the protocol intends to use
minAmountToDepositInEuro
as an invariant to enforce a minimum deposit amount, the current implementation makes this ineffective for existing users.Code Snippet
https://github.com/sherlock-audit/2024-05-midas/blob/main/midas-contracts/contracts/DepositVault.sol#L150-L164
Tool used
Manual Review
Recommendation
Change the
_validateAmountUsdIn
to:Duplicate of #22