vires.finance
Search…
Liquidators' Guide
Liquidators make sure all borrows are always covered

What is liquidation?

Liquidation means transferring part of both debt and collateral(+premium) from the account with negative health to the caller.

Can a given account be liquidated?

Only users with negative health can be liquidated.
To find out if account fall under liquidation or not, one may query liquidator-entry-point(3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT)contract, specifically, getUserHealth(user) function.
The following snippet queries any waves node on the status of 3PMZCTZjdsVZe2hePquBpE4LCVuZ5JA2PvK (the argument of getUserHealth function):
1
curl -X 'POST' \
2
'https://nodes.wavesnodes.com/utils/script/evaluate/3PJ6iR5X1PT2rZcNmbqByKuh7k8mtj5wVGw' \
3
-H 'accept: application/json' \
4
-H 'Content-Type: application/json' \
5
-d '{
6
"expr": "getUserHealth(\"3PMZCTZjdsVZe2hePquBpE4LCVuZ5JA2PvK\")"
7
}'
Copied!
The output would be similar to:
1
{
2
"result": {
3
"type":"String",
4
"value":"bp:2105388966, bpu:1861495565"
5
},
6
"complexity":5354,
7
"expr":"getUserHealth(\"3PMZCTZjdsVZe2hePquBpE4LCVuZ5JA2PvK\")",
8
"address":"3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT"
9
}⏎
Copied!
The important line is #4: it returns bp and bpu where
- bp means "borrow power" - bpu means "borrow power used"
1
account_health = (bp - bpu) / bp
Copied!
If bp<bpu , the account falls under liquidation.

How to liquidate an account?

To liquidate, one need to call transferDebt function in liquidator-entry-point (3PJ6iR5X1PT2rZcNmbqByKuh7k8mtj5wVGw).
There're 4 parameters in tranfserDebt function:
  • borrowReserve: the reserve address with debt,
  • collateralReserve: the reserve address with collateral,
  • borrower: address of the borrower with negative health,
  • liquidateDebtAmount: an amount of debt to be liquidated;
Up to 50% of debt can be liquidated within 1 transaction.
The caller needs to maintain positive health after this operation.