Skip to content

Reject leverage and fee configs that would leave a position unliquidable - #644

Open
IMEF-FEMI wants to merge 8 commits into
liquidation-tagfrom
emode-leverage-fee-validation
Open

Reject leverage and fee configs that would leave a position unliquidable#644
IMEF-FEMI wants to merge 8 commits into
liquidation-tagfrom
emode-leverage-fee-validation

Conversation

@IMEF-FEMI

@IMEF-FEMI IMEF-FEMI commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR prevents the configuring of positions whose liquidator fee cannot be paid.

A liquidation only clears while the liquidatee's credit outweighs the seized collateral, which leaves 1 / leverage of room for fees. A bank whose liquidator fee exceeds that room has its realized fee is silently degraded below the configured rate: at a 0.99 collateral weight a bank configured for 2.5% pays the liquidator 1.0%, and the insurance cut reaches zero. Nothing errors and nothing is logged. This PR makes that config rejected at write time instead.

The relationship is checked whenever either side moves: when e-mode entries are set, when a bank's liquidator fee changes, and when a bank opts into same-asset e-mode, whose weights are synthesized from the group's leverage rather than stored as entries.

@IMEF-FEMI IMEF-FEMI changed the title Reject leverage and fee configs that would leave a position unliquida… Reject leverage and fee configs that would leave a position unliquidable Aug 8, 2026
@IMEF-FEMI
IMEF-FEMI marked this pull request as ready for review August 10, 2026 13:27
@IMEF-FEMI
IMEF-FEMI requested a review from jgur-psyops as a code owner August 10, 2026 13:27
Comment thread type-crate/src/types/interest_rate.rs Outdated
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

Successfully merging this pull request may close these issues.

2 participants