berndartmueller - The claimable collateral factor with the key `Keys.claimableCollateralFactorKey` remains unchanged and results in a claimable collateral amount of zero #196
The claimable collateral factor with the key Keys.claimableCollateralFactorKey remains unchanged and results in a claimable collateral amount of zero
Summary
The MarketUtils.claimCollateral() is unable to calculate the claimable collateral amount due to the claimable factor (claimableFactor) not being updated/initialized and hence remains always equal to zero, resulting in an adjusted claimable amount (adjustedClaimableAmount) of zero. This, in turn, leads to the inability of users to claim collateral.
Vulnerability Detail
To calculate the claimable collateral amount, the MarketUtils.claimCollateral() function multiplies the claimable amount (claimableAmount) with the claimable factor (claimableFactor). The claimable factor is retrieved from the DataStore using the Keys.claimableCollateralFactorKey key, which depends on dynamic arguments timeKey and account, indicating that the value is calculated dynamically (and not set by governance).
However, the claimable factor is never adapted, and its value remains unchanged, always equal to zero, as no code is in place to update it.
Consequently, the adjusted claimable amount (adjustedClaimableAmount) is always zero, resulting in an inability for users to claim collateral.
Impact
Users are unable to claim collateral even if there is available collateral.
Consider adjusting the implementation logic of the MarketUtils.claimCollateral function and add functionality to update the claimable collateral factor with the key Keys.claimableCollateralFactorKey.
berndartmueller
medium
The claimable collateral factor with the key
Keys.claimableCollateralFactorKey
remains unchanged and results in a claimable collateral amount of zeroSummary
The
MarketUtils.claimCollateral()
is unable to calculate the claimable collateral amount due to the claimable factor (claimableFactor
) not being updated/initialized and hence remains always equal to zero, resulting in an adjusted claimable amount (adjustedClaimableAmount
) of zero. This, in turn, leads to the inability of users to claim collateral.Vulnerability Detail
To calculate the claimable collateral amount, the
MarketUtils.claimCollateral()
function multiplies the claimable amount (claimableAmount
) with the claimable factor (claimableFactor
). The claimable factor is retrieved from theDataStore
using theKeys.claimableCollateralFactorKey
key, which depends on dynamic argumentstimeKey
andaccount
, indicating that the value is calculated dynamically (and not set by governance).However, the claimable factor is never adapted, and its value remains unchanged, always equal to zero, as no code is in place to update it.
Consequently, the adjusted claimable amount (
adjustedClaimableAmount
) is always zero, resulting in an inability for users to claim collateral.Impact
Users are unable to claim collateral even if there is available collateral.
Code Snippet
contracts/market/MarketUtils.sol#L631
Tool used
Manual Review
Recommendation
Consider adjusting the implementation logic of the
MarketUtils.claimCollateral
function and add functionality to update the claimable collateral factor with the keyKeys.claimableCollateralFactorKey
.Duplicate of #137