Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Underwater positions have no incentive to be liquidated #177

Open
bsamuels453 opened this issue Feb 9, 2024 · 0 comments
Open

Underwater positions have no incentive to be liquidated #177

bsamuels453 opened this issue Feb 9, 2024 · 0 comments

Comments

@bsamuels453
Copy link

bsamuels453 commented Feb 9, 2024

Severity: Medium
Difficulty: Medium/High

Liquidations in Overlay are incentivized by paying a liquidation fee to the liquidator that is based on a percentage of the remaining value of the position:

// calculate the liquidation fee as % on remaining value
// sent as reward to liquidator
liquidationFee = value.mulDown(params.get(Risk.Parameters.LiquidationFeeRate));
marginRemaining = value - liquidationFee;

However, the value of a position may be "underwater," and its value clamped down to zero:

uint256 fraction,
uint256 oiTotalOnSide,
uint256 oiTotalSharesOnSide,
uint256 currentPrice,
uint256 capPayoff
) internal pure returns (uint256 val_) {
uint256 posOiInitial = oiInitial(self, fraction);
uint256 posNotionalInitial = notionalInitial(self, fraction);
uint256 posDebt = debtInitial(self, fraction);

This means underwater positions have no incentive to be liquidated, and bad positions may remain in the system. While the maintenance margin does provide a buffer on the positions value to prevent positions from going underwater before liquidation, it's possible for the maintenance margin to be fully consumed during a tail-risk event, such as a large price swing after the rollup sequencer has been offline for a duration.

Exploit Scenarios (most likely to least)

A rollup sequencer outage is followed by a large-swing oracle price update, instantly consuming the entire maintenance margin of weak positions.
A large spike in gas fees from an NFT mint leads to a liquidatable position not being liquidated while its maintenance margin decays.

Recommendation

Short term, Overlay should run its own liquidator bot that detects and liquidates underwater positions to prevent toxic debt from coalescing.

Long term, build an emergency liquidation fund mechanism that can pay out a minimum liquidation fee for underwater positions. This mechanism would have to be be relatively complex to avoid manipulation, so it should not be implemented as a short-term mitigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant