SIP-361: Perps V3 - Integrator & CC Requests

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

Simple Summary

This SIP proposes the following:

A) Drop the getReportedDebt from the event emitted upon withdrawing sUSD from a given perp market.

B) Incorporate a getOpenPositionSize that returns the size of a open position given a market id and account number as input

C) Emit an event when an account is flagged for liquidation

D) Incorporate a view function that returns the settlement keeping costs plus the settlement reward

E) Require a strict staleness tolerance on margin withdrawal

F) Incorporate a required margin for order given a execution price

G) Incorporate a secondary cap on open interest denominated in USD

H) Remove the minimum keeping fees from getRequiredAccountMargins function

Abstract

A) The getReportedDebt function requires that all the market prices, in a given supermarket, be not stale. This can be problematic for large supermarkets, as the cost of updating the prices of many markets, that don't exhibit much trading activity, can be significant.

B) getOpenPositionSize would be a view function that reads on the storage slot that holds the keepers position information given a certain marektId as input as done here

C) A event emitted under right after an account is flagged for liquidation which includes the following information:

  1. availableMargin

  2. requiredMaintenanceMargin

  3. liquidationReward

  4. account id

D) Create a view functions that takes in the settlement strategy id and returns the keeping cost associated with an async order. The keeping costs includes the keeper reward as well as the relevant gas costs.

E) When a accounts withdraws margin from a market, requires a strict 1 minute staleness tolerance on the the associated position prices in order to mitigate the risk with stale oracles

F) Create a view function that provides integrators with the required margin given any execution price. This would allow estimation of required margin give a price impact from a potential trade that is yet to be executed.

G) Incorporate a secondary USD cap on margins allows to control the oi on a market regardless of the price of the listed asset. The cap applied would be the minimum between the size denominated the assets' native currency and a given USD cap

H) Remove the minimum keeper fee from getRequiredAccountMargins which allows users to withdraw all the margin when they close all their open positions

Motivation

The motivation of this sip, is to incorporate requests from CC's and integrators into Perps V3 in order to allow it to be integrated smoothly within the different frameworks.

Specification

Included in PR's 2016 and 2017

Test Cases

Included in the PR

Configurable Values (Via SCCP)

N/A

Copyright and related rights waived via CC0.