Comment on page
㊙
Liquidator's Guide
All the contents of the contract can be found here :
MasterContract : 0xA01d276d9e8D356AdaBAda8b60916489BD4f51a8
Sample Code:
//
DegenBox.setMasterContractApproval(address(this), market.masterContract(), true, 0, 0, 0);
Depending on the amount of debt to be liquidated, it is necessary to fund lawUSD in DegenBox.
Sample Code:
//need to approve first
lawUSD.approve(address(box), num);
box.deposit(lawUSD, address(this), address(this), num, 0);
Current liquidation is only available to a limited number of addresses.
//
interface Market {
function onlyWhiteLiquidator() external view returns (bool);
//current is true, will open when the price of LAW stabilizes
function positionInfo(address user) external view
returns
(uint256 deposited,
uint256 depositedShare,
uint256 depositedValue,
uint256 borrowed,
uint256 borrowedPart,
uint256 borrowedShare
)
function liquidate(
address[] calldata users, // user need to be liquidated
uint256[] calldata maxBorrowParts, // user borrow part
address to, // move collateral to
ISwapper swapper // could be zero if not use swapper
) external;
}
In general, you can use positionInfo to determine whether the user's position is ready for liquidation and to obtain the user's borrowpart.
If the collateral allows, the entire borrowpart of the user can be liquidated.
Once the user to be liquidated has been identified, the liquidate method can be called to perform the liquidation.
Note: If a swapper is not used, the collateral will go to the DegenBox of the "to" address.
Swapper can convert collateral to lawUSD so that you can liquidate even if you don't have enough lawUSD.
An example of a Swapper: