🤩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.

VaultV1.sol
  // 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 
  }
IVault.sol
// SPDX-License-Identifier: BUSL-1.1

struct LiquidationInfo {
  bool solvent;
  uint256 borrowChange;
  uint256 assetReward;
  uint256 protocolFee;
  uint256 rebate;
}
ILiquidator.sol
// SPDX-License-Identifier: BUSL-1.1

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

Last updated