Due to using the incorrect comparison operator in the MarketUtils.claimCollateral function, a user is unable to claim available collateral from a market.
Vulnerability Detail
In the MarketUtils.claimCollateral() function, the if statement in line 632 uses an inappropriate comparison operator. The used >= comparison operator asserts that the claimable amount (adjustedClaimableAmount) is greater than or equal to the claimed amount (claimedAmount) and reverts with the CollateralAlreadyClaimed custom error if this is the case.
For a user claiming collateral for the first time, the claimedAmount is zero, and any available claimable amount (adjustedClaimableAmount) is non-zero. As a result, the if statement in line 632 will always evaluate to true, reverting with the CollateralAlreadyClaimed error.
Impact
A user is unable to claim collateral from a market.
berndartmueller
high
Inability to claim collateral
Summary
Due to using the incorrect comparison operator in the
MarketUtils.claimCollateral
function, a user is unable to claim available collateral from a market.Vulnerability Detail
In the
MarketUtils.claimCollateral()
function, theif
statement in line 632 uses an inappropriate comparison operator. The used>=
comparison operator asserts that the claimable amount (adjustedClaimableAmount
) is greater than or equal to the claimed amount (claimedAmount
) and reverts with theCollateralAlreadyClaimed
custom error if this is the case.For a user claiming collateral for the first time, the
claimedAmount
is zero, and any available claimable amount (adjustedClaimableAmount
) is non-zero. As a result, theif
statement in line 632 will always evaluate totrue
, reverting with theCollateralAlreadyClaimed
error.Impact
A user is unable to claim collateral from a market.
Code Snippet
contracts/market/MarketUtils.sol#L632
Tool used
Manual Review
Recommendation
Consider adjusting the comparison operator in the
if
statement in line 632 to prevent claiming already claimed collateral:Duplicate of #136