SIP-359: Perps v3 - Bypass Checks on Position Risk Reduction

Author
StatusImplemented
TypeGovernance
NetworkBase
ImplementorTBD
ReleaseTBD
ProposalLoading status...
Created2024-02-06

Simple Summary

This sip aims to improving the user experience by allowing users to reduce a position regardless of the margin requirements.

Abstract

The current perps v3 design allows users to decrease an existing open position size, as long as the users' available margin is above the required margin in the post state. This SIP proposes to alleviate this requirement when a user is performing a reduction in the size of an existing open position.

Motivation

The main reason is that the perps v3 design does not allow for simultaneous orders to be executed and therefore users could be required to increase their margin before being allowed to reduce their positions. Hence, the need a bypass when a user commits to a change that reduces the size of the open position.

Specification

The change done are included in this PR.

Test Cases

  • Setting an account with 100 sUSD worth of available margin and 2 longs position on ETH and BTC requiring 110$ and 30$ worth of margin respectively:
    • When the account passes a 10$ decrease in his BTC position
      • ✅ Then the transaction succeeds
    • When the account passes a 10$ decrease in his ETH position
      • ✅ Then the transaction succeeds
    • When the account attempts to fully close his BTC position
      • ✅ Then the transaction succeeds
    • When the account attempts to increase 10$ worth on his BTC position
      • ❌ The transaction reverts due to not having enough margin
    • When the account attempts to increase 10$ worth on his ETH position
      • ❌ The transaction reverts due to not having enough margin

Configurable Values (Via SCCP)

NA

Copyright and related rights waived via CC0.