Liquidators
contracts/VarlaLiquidator.sol — simple, multi-collateral, and bad-debt liquidationcontracts/liquidators/VarlaLiquidatorBase.sol — shared abstract basecontracts/liquidators/VarlaMergeLiquidator.sol — binary merge-assisted liquidationcontracts/liquidators/VarlaConvertLiquidator.sol — NegRisk convert-assisted liquidation
Architecture
VarlaCore (AccessManager RBAC authorizes all three)
│
├── VarlaLiquidator
│ ├─ liquidate() — single-position seizure
│ ├─ liquidateMulti() — multi-collateral seizure
│ └─ liquidateBadDebt() — bad-debt resolution
│
├── VarlaMergeLiquidator
│ └─ calls IMarketAdapter.convert() to merge
│ YES+NO → collateral, repays debt from proceeds
│
└── VarlaConvertLiquidator
└─ calls NegRisk adapter to convert positions,
repays debt from converted collateral
All three inherit: VarlaLiquidatorBase (abstract)
└─ shared: health checks, bonus math, fee collection Each liquidator contract calls VarlaCore.seizeCollateral() and VarlaCore.repayOnBehalfFromLiquidation() — functions that are restricted via AccessManager RBAC to authorized liquidator contracts only.
VarlaLiquidator (Simple / Multi / Bad-Debt)
The primary liquidation contract. Handles three modes:
| Function | Description |
|---|---|
liquidate(user, positionId, debtToCover) | Permissionless — seize a single collateral position from an unhealthy borrower |
liquidateMulti(user, positionIds, debtToCover) | Permissionless — seize across multiple collateral positions in one transaction |
liquidateBadDebt(user, maxRepayAmount) | Permissionless — liquidate positions where debt exceeds collateral value (at a 5% discount) |
resolveBadDebtWithReserve(user, expectedScaledDebt) | Admin/keeper — seize collateral to treasury and write off remaining debt via pool reserve |
Liquidator Modes
VarlaMergeLiquidator
Binary merge-assisted liquidation — used when a borrower holds both YES and NO positions of a binary market. The liquidator calls a platform-specific market adapter (IMarketAdapter.convert()) to merge complementary position tokens back into the underlying collateral (e.g. USDC), then uses the proceeds to repay debt.
Platform adapters: PolymarketCtfAdapter (Polygon) and OpinionCtfExecutionEngineAdapter (BSC).
VarlaConvertLiquidator
NegRisk convert-assisted liquidation — used for NegRisk market positions on Polymarket. The liquidator calls the PolymarketNegRiskMergeAdapter to convert NegRisk positions back into collateral, then repays debt from the converted proceeds.
VarlaLiquidatorBase (Abstract)
Shared logic inherited by all three liquidator contracts:
| Responsibility | Description |
|---|---|
| Health factor validation | Confirms HF < 1.0 before proceeding |
| Bonus calculation | Computes liquidation bonus based on tier config and current HF |
| Dust checks | Ensures remaining debt/collateral don't fall below dust thresholds |
| Fee collection | Sends protocol liquidation fee to treasury |
| Staking rebate | Optional fee reduction for VRLA stakers via VarlaStaking integration |
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
- Three independent mode contracts: simple/multi/bad-debt, merge, and convert
- All authorized by VarlaCore via AccessManager RBAC (no router pattern)
- 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