Liquidators
contracts/VarlaLiquidator.sol — routercontracts/liquidators/VarlaLiquidatorBase.sol — shared abstractcontracts/liquidators/VarlaMergeLiquidator.sol — merge strategycontracts/liquidators/VarlaConvertLiquidator.sol — convert strategy
Architecture
VarlaLiquidator (router, AccessManaged)
│
├─→ VarlaMergeLiquidator
│ └─ calls IMarketAdapter.convert() to merge positions
│
└─→ VarlaConvertLiquidator
└─ converts collateral to repayment token
Both inherit: VarlaLiquidatorBase (abstract)
└─ shared: health checks, bonus calculation, position iteration VarlaLiquidator (Router)
The entry point for all liquidations. It validates that the user's health factor is below 1.0, then delegates to the appropriate liquidator variant.
| Function | Description |
|---|---|
liquidate(address user, ...) | Permissionless — anyone can liquidate an unhealthy position. Routes to the correct liquidator strategy. |
setMergeLiquidator(address) | Admin — set the merge liquidator contract |
setConvertLiquidator(address) | Admin — set the convert liquidator contract |
Liquidator Variants
VarlaMergeLiquidator
Merge liquidation — used when a prediction market position can be merged. The liquidator calls the market adapter's convert() function to merge complementary position tokens back into the underlying collateral.
This is the primary liquidation path for Polymarket NegRisk positions (where YES + NO tokens can be merged back into the conditional token).
// Inherits VarlaLiquidatorBase
contract VarlaMergeLiquidator is VarlaLiquidatorBase {
// Uses adapter.convert() to merge positions
// Repays debt from merged proceeds
// Sends bonus to liquidator
} VarlaConvertLiquidator
Convert liquidation — used when positions cannot be merged. The liquidator seizes the ERC1155 collateral directly and converts it through other means (e.g. selling on a DEX).
// Inherits VarlaLiquidatorBase
contract VarlaConvertLiquidator is VarlaLiquidatorBase {
// Seizes ERC1155 positions directly
// Converts to repayment token externally
// Sends bonus to liquidator
} VarlaLiquidatorBase (Abstract)
Shared logic inherited by both liquidator variants:
| Responsibility | Description |
|---|---|
| Health factor validation | Confirms HF < 1.0 before proceeding |
| Bonus calculation | Computes liquidation bonus based on tier config and current HF |
| Position iteration | Iterates over user's deposited positions to find liquidatable collateral |
| Dust checks | Ensures remaining debt/collateral don't fall below dust thresholds |
| Fee collection | Sends protocol liquidation fee to treasury |
Liquidation Bonus
The liquidation bonus is dynamic — it increases as the health factor drops further below 1.0, up to a per-tier maximum. This is configured in VarlaCore's TierLiquidationConfig.
| Parameter | Source |
|---|---|
maxLiquidationBonusBps | Per risk tier in VarlaCore |
liquidationFeeBps | Per risk tier — protocol fee on liquidations |
healthFactorForMaxBonus | HF threshold where max bonus kicks in |
targetHealthFactor | HF target after partial liquidation |
- Liquidations are permissionless — anyone can call liquidate() on an unhealthy position
- Two strategies: merge (via market adapter) and convert (direct seizure)
- Bonus scales dynamically with how far HF drops below 1.0
- Protocol takes a fee (liquidationFeeBps) on each liquidation
- Dust thresholds prevent tiny residual positions after liquidation