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

feat(perp): ClosePosition with bad debt #1493

Merged
merged 26 commits into from
Jul 8, 2023

Conversation

k-yang
Copy link
Member

@k-yang k-yang commented Jul 5, 2023

Description

Enables a user to close their position, even if it has bad debt. The thinking is that allowing a user to close a position with bad debt is better than waiting for the liquidator to get to it, because the bad debt could grow even more by then.

Also adds test cases for closing positions with bad debt.

Purpose

Helps with the safety of the perps exchange.

@k-yang k-yang self-assigned this Jul 5, 2023
@k-yang k-yang linked an issue Jul 5, 2023 that may be closed by this pull request
@k-yang k-yang marked this pull request as ready for review July 5, 2023 18:20
@k-yang k-yang requested a review from a team as a code owner July 5, 2023 18:20
@k-yang k-yang enabled auto-merge (squash) July 5, 2023 18:20
@k-yang k-yang disabled auto-merge July 5, 2023 18:25
@k-yang k-yang marked this pull request as draft July 5, 2023 18:36
@k-yang k-yang marked this pull request as ready for review July 5, 2023 21:38
@k-yang k-yang enabled auto-merge (squash) July 5, 2023 21:38
@k-yang k-yang merged commit 27c7503 into master Jul 8, 2023
13 checks passed
@k-yang k-yang deleted the fix/perp/close-position-with-bad-debt branch July 8, 2023 16:00
@k-yang k-yang linked an issue Jul 28, 2023 that may be closed by this pull request
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.

feat(perp)!: closing while underwater should liquidate Can't close underwater positions
2 participants