# Become a Liquidator

There are no whitelists, applications, or KYC (know your customer) to become a liquidator for Phase. Liquidation is really easy to implement, and the liquidator must always be a contract implementing the `ILiquidator` interface.

A liquidation will only commence once the contract calls `liquidateUser(...)` and the user in question is insolvent. The contract will get called back with `receiveLiquidation(...)` and must contain enough CASH in its balance to pay off the debt change. The contract receives the collateral before having to pay back the debt and is allowed to do anything in order to provide enough CASH.

{% code title="VaultV1.sol" overflow="wrap" lineNumbers="true" %}

```solidity
  // SPDX-License-Identifier: BUSL-1.1

  function liquidateUser(uint256 user) external {
    // Get user liquidation info and check if user is solvent or not
  
    // Give user rebate
    // Change storage
    // Process fees
    
    // Send msg.sender funds and call receiveLiquidation();
    
    // Burn debtChange amount of CASH to veryify 
  }
```

{% endcode %}

{% code title="IVault.sol" overflow="wrap" lineNumbers="true" %}

```solidity
// SPDX-License-Identifier: BUSL-1.1

struct LiquidationInfo {
  bool solvent;
  uint256 borrowChange;
  uint256 assetReward;
  uint256 protocolFee;
  uint256 rebate;
}
```

{% endcode %}

{% code title="ILiquidator.sol" overflow="wrap" lineNumbers="true" %}

```solidity
// SPDX-License-Identifier: BUSL-1.1

interface ILiquidator {
  function receiveLiquidation(
    uint256 toLiquidate,
    IVault.LiquidationInfo memory liquidationInfo
  ) external returns (bytes4);
}
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.phase.cash/liquidation/become-a-liquidator.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
