hats-finance / Velvet-Capital-0x0bb0c08fd9eeaf190064f4c66f11d18182961f77

Core smart contracts of Velvet Capital
Other
0 stars 1 forks source link

VaultManager does not properly enforce `_minMintAmount` #31

Open hats-bug-reporter[bot] opened 1 week ago

hats-bug-reporter[bot] commented 1 week ago

Github username: @deadrosesxyz Twitter username: @deadrosesxyz Submission hash (on-chain): 0x1d56f602663c938c639dbf2b33efd6e3f995ab80fc5aea82d8e39fa8ec246dcf Severity: medium

Description: Description

VaultManager does not properly enforce _minMintAmount

Issue details

When depositing user inputs _minMintAmount which is the least amount of PortfolioToken they're willing to accept. However, if we look at the code of _depositAndMint, we'll see that the min mint check is done before fees are charged.

    // Ensure the minted amount meets the user's minimum expectation to mitigate slippage.
    _verifyUserMintedAmount(tokenAmount, _minMintAmount);

    // Mint the calculated portfolio tokens to the user, applying any cooldown periods.
    tokenAmount = _mintTokenAndSetCooldown(_depositFor, tokenAmount);

This would allow for a user to receive less tokens than the minimum they've specified, breaking a core invariant Attachments

  1. Proof of Concept (PoC) File

  2. Revised Code File (Optional)

langnavina97 commented 1 week ago

Could you please provide a PoC? @deadrosesxyz