Misaligned validation for initialPriceNativeAmount
The variable initialPriceNativeAmount
serves as the denominator in a ratio calculation involving divider
.
mintAmount = totalSupply() > 0 && preDepositTotalFarmsNativeInvestments > 0
? (amount * totalSupply()) / preDepositTotalFarmsNativeInvestments
: (amount * divider) / factory.vaultConfig().initialPriceNativeAmount;
However, the _updateVaultConfig
function validates initialPriceNativeAmount
by comparing it to MIN_VAULT_MANAGEMENT_AMOUNT
, a constant representing an absolute value threshold.
function _updateVaultConfig(VaultConfig memory config) private {
// [...]
if (config.initialPriceNativeAmount < MIN_VAULT_MANAGEMENT_AMOUNT) {
revert UpdateVaultConfigVaultInitialPriceNativeAmountUnderflow(
config.initialPriceNativeAmount,
MIN_VAULT_MANAGEMENT_AMOUNT
);
}
// [...]
}
This validation does not align with the variable’s intended use as part of a ratio.
Consider introducing a dedicated MIN_INITIAL_PRICE
variable and validating initialPriceNativeAmount
against it.
DexFi provided the following response to this issue:
Initially, when designing the contract, several constant variables were established, and when selecting the correct values for
initialPriceNativeAmount
andminSyntheticTransferAmount
, they were the same, so we eliminated one constant.