build_liquidation_tx
Build agent-ready calldata for a liquidation transaction. Returns the target protocol contract address, ABI-encoded calldata, suggested gas limit, value, and chain — everything an agent needs to sign and submit via submit_bundle. Supports Aave V3 (L1 + Base), Spark (L1), and Morpho Blue (L1). Returns calldata only — the agent signs and submits separately. This tool does NOT touch funds and does NOT submit anything; it is a calldata builder.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chain | Yes | Chain to build calldata for. base only supported for aave-v3. | |
| borrower | Yes | 0x-prefixed address of the borrower being liquidated. | |
| protocol | Yes | Lending protocol. aave-v3 supported on ethereum + base. spark and morpho on ethereum only. | |
| debt_asset | Yes | 0x-prefixed address of the debt token to repay. For Morpho, this field is ignored. | |
| debt_to_cover | Yes | Amount of debt token to repay in wei (string to avoid precision loss). Use "max" or the uint256 max value 0xff..ff to liquidate as much as possible (Aave V3 close factor applies). | |
| receive_a_token | No | Aave V3 only. If true, receive collateral as aToken (saves gas, no unwrap). If false, receive underlying. Default false. | |
| collateral_asset | Yes | 0x-prefixed address of the collateral token to seize. For Morpho, this field is ignored (market ID supplies it). | |
| morpho_market_id | No | Morpho Blue market id (bytes32). Required when protocol=morpho. | |
| morpho_repaid_shares | No | Morpho Blue only. Amount of debt shares to repay. Mutually exclusive with morpho_seized_assets. | |
| morpho_seized_assets | No | Morpho Blue only. Amount of collateral to seize in wei. Mutually exclusive with morpho_repaid_shares. |