The Standard

The Standard
DeFiHardhat
20,000 USDC
View results
Submission Details
Severity: medium
Valid

Calculation in canRemoveCollateral() function on smart vault contract is incorrect

Summary

canRemoveCollateral(ITokenManager.Token, uint256) function incorrectly calculates collateral eligible to remove. To be more specific, it calculates the amount to be smaller than really available to remove.

Vulnerability Details

Calculations in the function are done incorrectly.
Check on line 132 is incorrect:

minted <= currentMintable - eurValueToRemove;

currentMintable variable is old information in this check. To assess correct information should include the calculation of maxMintable() but without the eurValueToRemove

Impact

User is disincentivized to use platform and has to submit more transactions than he would like to in order to remove his collateral. Furthermore, the amount of collateral he can remove directs users' behavior with funds on platform and can lead to faulty decision being made based on wrong information that are retrieved from on-chain.

Tools Used

Manual review

Recommendations

Function and some other contract logic should be rewritten to check maxMintable() after the removal of the wanted amount. Then the contract would know how much the user can mint based on new information and can he really remove the wanted amount of collateral.
Line 132:

minted <= maxMintable() -> but without the eurValueToRemove
Updates

Lead Judging Commences

hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

informational/invalid

matejdb Submitter
over 1 year ago
hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

canRemoveCollateral

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.