SIP-378: Perps V3 - Integrator Requests & Improvements

Author
StatusImplemented
TypeGovernance
NetworkBase
ImplementorTBD
ReleaseTBD
ProposalLoading status...
Created2024-04-16

Simple Summary

This SIP proposes the following:

A) Drop the acceptablePrice check on order commitment

B) Use the on-chain price, without any staleness tolerance check, when settleOrder calls requiredCredit

C) Allow for 0 fee perp trading

Abstract

A) acceptablePriceExceeded is thrown whenever the limit price is worse than the users' fillPrice upon order commitment and settle. As per ERC-7421, integrators are required to push for a fresh price update when the staleness error is thrown (for write transactions). However, the concept of acceptablePrice might require a fresh price to be include on commitment, in order for the acceptablePrice value to be relevant during times of volatility. Hence removing this check, on commitment is necessary in order to simplify the order execution pattern for integrators and decrease the gas cost associated with order execution.

B) SIP-354 introduced a requirement that all markets, in a given supermarket, are not in a stale state, upon order settlement. This cause issues, given that keepers are compensated for updating 1 price per order. Furthermore, when a user commits to an order, staleness is only checked against the position being altered. This SIP proposes incorporate a new staleness check requirement INFINITE which uses the last pushed price when settleOrder calls requiredCredit. Note that all other calls to the requiredCredit function remain the same with respect to staleness tolerance.

C) Currently the perp markets do no support 0 fee in trading, because of a _checkZeroAddressOrAmount check done upon withdrawing collateral from core contracts. This is addressed in this PR which results in skipping over the fee distribution, in case the amount zero.

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

Pending

Test Cases

Included in the PR

Configurable Values (Via SCCP)

N/A

Copyright and related rights waived via CC0.