Prepare a liquidation
prepare_liquidationBuild an unsigned transaction to liquidate an unhealthy position: repay part of someone else's debt and receive their collateral plus the liquidation bonus. Only viable while that position's health factor is below 1 (check get_user_summary for the target). v4 takes collateral and debt as reserveIds; v3 takes collateralToken and debtToken addresses plus chainId. Non-custodial: the liquidator signs and submits.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| max | No | Cover the maximum the protocol allows. | |
| debt | No | v4 only: reserveId of the debt to repay. | |
| user | Yes | The wallet being liquidated (0x, 40 hex). | |
| amount | No | Debt to cover, in main units. Omit only if max=true. | |
| market | No | v3 only: market pool address (from get_markets). | |
| chainId | No | v3 only: chain id (positive integer). | |
| version | Yes | Protocol version (v3 or v4; required, no 'all' for actions). | |
| debtToken | No | v3 only: debt token address. | |
| collateral | No | v4 only: reserveId of the collateral to seize. | |
| liquidator | No | v4 only: the wallet performing the liquidation (0x, 40 hex). On v3 the liquidator is whoever signs the returned transaction. | |
| collateralToken | No | v3 only: collateral token address. |