* Liquidators receive a 10% bonus on the collateral they seize when liquidating unhealthy positions. The bonus is calculated based on the token amount derived from the debt to cover.
* The liquidation bonus is calculated using the token amount derived from USD debt value at the current price. If prices change between when the liquidator calculates the bonus and when the transaction executes, or due to rounding in the calculation, the bonus may not be exactly 10% of the debt value.
```vyper
@external
def liquidate(collateral: address, user: address, debt_to_cover: uint256):
assert debt_to_cover > 0, "DSCEngine__NeedsMoreThanZero"
starting_user_health_factor: uint256 = self._health_factor(user)
assert (
starting_user_health_factor < MIN_HEALTH_FACTOR
), "DSCEngine__HealthFactorOk"
token_amount_from_debt_covered: uint256 = self._get_token_amount_from_usd(
collateral, debt_to_cover // @> Price used here
)
bonus_collateral: uint256 = (
token_amount_from_debt_covered * LIQUIDATION_BONUS // @> Bonus calculated on token amount
) // LIQUIDATION_PRECISION
self._redeem_collateral(
collateral,
token_amount_from_debt_covered + bonus_collateral, // @> Bonus may not be exactly 10% of debt value
user,
msg.sender,
)
```
Likelihood:
* Price changes between calculation and execution can affect the actual bonus percentage
* Integer division rounding can cause the bonus to be slightly more or less than 10%
* Large debt amounts with small price movements can result in significant bonus discrepancies
Impact:
* Liquidators may receive more or less than the intended 10% bonus, affecting protocol economics
* Inconsistent bonus amounts could lead to arbitrage opportunities
* Protocol may pay more in bonuses than intended over time
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.