Parallel Liquidation

Overview

Parallel liquidation has three ways to process: auto liquidation by the off-chain worker, liquidated by the liquidation client, and flash liquidation by anyone.

Liquidation Architecture

View Data Storage

Liquidation pallet will query storage from Loans pallet, no data storage.

View Methods

Liquidate_borrow()

The sender liquidates the borrower's collateral.
This method mainly invoked by the off-chain worker.
1
pub fn liquidate_borrow(
2
origin: OriginFor<T>,
3
borrower: T::AccountId,
4
liquidate_token: CurrencyId,
5
repay_amount: Balance,
6
collateral_token: CurrencyId,
7
) -> DispatchResultWithPostInfo
Copied!
Name
Substrate Config
Runtime Type
Description
origin
T::Origin
RawOrigin
The account signed this transaction
borrower
T::AccountId
AccountId
The borrower to be liquidated
liquidate_token
-
CurrencyId
The asset to be liquidated
repay_amount
T::Balance
u128
The amount to be repaid borrow
collateral_token
-
CurrencyId
The collateral to seize from the borrower
RETURN: Returns Ok() when liquidate_borrow succeeds, otherwise return a substrate error type.
Tip: Refer to the liquidate_borrow method in Loans pallet for more info.

View Event

The liquidation can be traced according to LiquidatedBorrow event in Loans pallet.
​

View Error

Name
Description
NoCurrencies
There are no pre-configured currencies
GetLockFailed
Failed to get the lock to run off-chain worker
NoAvailableAccount
No signer available for liquidation, consider adding one via author_insertKey RPC.
​
​
​
Last modified 3mo ago