Liquidate
Last updated
Last updated
Liquidations are a crucial risk management mechanism in the Neptune Protocol that helps maintain the overall health and solvency of the lending markets. When a borrower's account health falls below 1.0, their collateral becomes eligible for liquidation, allowing other users to repay a portion of their debt in exchange for their collateral at a discount.
The liquidation process in Neptune follows these key steps:
Monitor Account Health: A margin account health must stay above 1.0 to avoid liquidation
Liquidation Trigger: When health drops below 1.0, the account becomes eligible for liquidation
Liquidation Calculation: Liquidators queries the market to verify debts to repay
Liquidator Action: Any user can act as a liquidator by repaying some of the borrower's debt
Collateral Transfer: The liquidator receives discounted collateral in exchange for debt repayment
The Neptune liquidation market is a first-come-first-serve implementation. Meaning when a liquidation opportunity becomes available, it is the liquidator who executes the transaction first who will capture the profits.
A liquidator can monitor the Neptune market for accounts with low Account Health values that may soon be subject to liquidation. They can query the market and calculate the various margin Account Health values.
Account health is calculated using the following formula:
Where:
Weighted Collateral Value
: Sum of all USD collateral values multiplied by their respective liquidation_LTV
Total Debt Value
: Total USD value of all borrowed assets plus accrued interest
A margin account can be either be fully or partially liquidated. A Partial liquidation means that only part of the accounts debt is repaid and collateral seized, where as a full liquidation pays back all the debt, seizes all of the collateral and closes the margin account.
If an account is to be fully or partially liquidated is determined by the partial_liquidation_threshold
parameter set in the market contract. This parameter is set as a USD value, and any account with net collateral values below this value will be fully liquidated.
When a margin account is subject to liquidation, its collateral is offered at a discount from the oracle price to incentivize third parties to participate in liquidations. Discounted collateral ensures a liquidator can capture a profitable trade in a timely manner.
Neptune innovates on the standard liquidation discounts by offering a dynamic discount range. This allows the protocol to set a min_discount and max_discount
on each available collateral asset. The min_discount
first becomes available when a margin account has an account health just below 1. As the account health grows further below 1, the applied discount grows until it reaches the max_discount
value. The rate at which the discount grows is set by the dynamic_discount_width
parameter set by the protocol.
In affect the dynamic discounts allow for reduced impact on a user's margin account position during a partial liquidation, and offers more opportunity for liquidators to make profitable trades when markets are more volatile, keeping Neptune markets solvent.
Where:
min_discount
is the minimum discount applied when account health is just below 1.0
max_discount
is the maximum possible discount that can be applied
Account Health
is the current health ratio of the margin account
dynamic_discount_width
is the protocol parameter that controls how quickly the discount scales (typically ~0.02)
The formula ensures the discount scales linearly from min to max as account health deteriorates, capped at the maximum discount.
During a partial liquidation, the market calculates the required debt to be repaid to bring the account back to a targeted Account Health Value. This target value is set the protocol parameter target_liquidation_health
. From this calculation the liquidator will be able to determine the amount of collateral that will be seized.
Where:
Total Debt Value
is the current total borrowed amount plus accrued interest
Weighted Collateral Value
is the sum of all collateral values multiplied by their respective liquidation_LTV
Target Liquidation Health
is the protocol parameter (typically > 1.0) representing the desired health ratio after liquidation
This formula calculates how much debt needs to be repaid to restore the account's health ratio to the target level.
Through the process of staking NEPT to the protocol in certain bonding pools, a user may allocate the value of their stake against one or multiple of their margin accounts. Doing this will award the margin account with a boosted Account Health value, providing the user with the benefit for greater risk management.
A liquidator may need to account for the a users stake positions when identifying at risk margin accounts. Read more about it in the NEPT Token doc.
When an account becomes eligible for liquidation:
Liquidation Request
System calculates repayable debt amounts
Identifies available collateral for liquidation
Determines collateral discounts
Collateral Pricing
Collateral value is determined by oracle prices
Liquidators receive a discount on the collateral
Discount varies by asset
Execution
Liquidator repays a portion of the borrower's debt
Receives discounted collateral in return
Transaction must complete atomically
In an unlikely event that a liquidation would occur where a margin accounts collateral value is less than the outstanding debt, a liquidator would only repay an amount of debt which is equivalent to the collateral value. This would create a bad debt balance in the Neptune market as the margin account now has no collateral value to cover the outstanding debt.
When a bad debt situation occurs, to avoid a run on the bank scenario, the protocol rebases the redemption rate for the nToken of the market the bad debt is related to. The rebasing of the redemption rate now accurately reflects the available underlying principle of the target market, making the market solvent again.
After a rebasing event occurs, protocol governance or third parties can elect to inject more capital into the target market to bring the nToken redemption rate back to its original value.
Where:
Total Available Assets
is the remaining assets after accounting for bad debt
Total Lending Principal
is the original amount of assets in the lending pool
Bad Debt
is the uncovered portion of defaulted loans
Total nToken Supply
is the total supply of nTokens in circulation
For borrowers to avoid liquidation:
Monitor Account Health: Regularly check account health metrics
Maintain Buffer: Keep health ratio well above 1.0
Risk Management: Use multiple collateral types to reduce volatility
Quick Action: Add collateral or repay debt if health approaches 1.0
For liquidators:
Monitor Opportunities: Watch for accounts near liquidation
Gas Optimization: Prepare efficient liquidation transactions
Price Impact: Consider market depth when liquidating large positions