Open code423n4 opened 1 year ago
https://github.com/code-423n4/2023-01-astaria/blob/1bfc58b42109b839528ab1c21dc9803d663df898/src/PublicVault.sol#L106
PublicVault.deposit() uses ERC4626-Cloned.deposit() to deposit funds into the vault.
PublicVault.deposit()
ERC4626-Cloned.deposit()
264: return super.deposit(amount, receiver)
which checks the number of shares minted is higher than minDepositAmount()
minDepositAmount()
27: require(shares > minDepositAmount(), "VALUE_TOO_SMALL");
For tokens with decimals != 18, PublicVault.minDepositAmount() returns the following:
PublicVault.minDepositAmount()
106: return 10**(ERC20(asset()).decimals() - 1)
This will revert with an underflow error for tokens with decimals() == 0, meaning the vaults will not work with such tokens
decimals() == 0
Medium
Manual Analysis
Consider using a minDepositAmount parameter in newPublicVault, to allow strategists to set the minimum deposit to a constant of their choice.
minDepositAmount
newPublicVault
Downgrading to QA in the absence of a credible example of such token
Duplicate of https://github.com/code-423n4/2023-01-astaria-findings/issues/591
Lines of code
https://github.com/code-423n4/2023-01-astaria/blob/1bfc58b42109b839528ab1c21dc9803d663df898/src/PublicVault.sol#L106
Vulnerability details
PublicVault.deposit()
usesERC4626-Cloned.deposit()
to deposit funds into the vault.which checks the number of shares minted is higher than
minDepositAmount()
For tokens with decimals != 18,
PublicVault.minDepositAmount()
returns the following:This will revert with an underflow error for tokens with
decimals() == 0
, meaning the vaults will not work with such tokensImpact
Medium
Tools Used
Manual Analysis
Mitigation
Consider using a
minDepositAmount
parameter innewPublicVault
, to allow strategists to set the minimum deposit to a constant of their choice.