{"componentChunkName":"component---src-pages-sips-sip-markdown-remark-frontmatter-sip-tsx","path":"/sips/sip-279/","result":{"data":{"markdownRemark":{"fileAbsolutePath":"/vercel/path0/content/sips/sip-279.md","frontmatter":{"sip":279,"sccp":null,"title":"Perps v2","network":"Optimism","author":"Afif (@aband1)","type":"Governance","proposal":"https://snapshot.org/#/snxgov.eth/proposal/0xe6d655f1838a846c008341894d08a56c53a7298f46ed76302407acd1e03a18a3","implementor":"Leonardo Massazza (@leomassazza), MEB (@barrasso)","release":null,"created":"2022-09-27T00:00:00.000Z","updated":null,"status":"Implemented"},"html":"<h2 id=\"simple-summary\" style=\"position:relative;\"><a href=\"#simple-summary\" aria-label=\"simple summary permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Simple Summary</h2>\n<!--\"If you can't explain it simply, you don't understand it well enough.\" Simply describe the outcome the proposed changes intends to achieve. This should be non-technical and accessible to a casual community member.-->\n<p>This SIP proposes a redesign of the Synthetix perpetual futures mechanism to support (1) unconstrained open interest limits, (2) broader asset compatibility, and (3) efficient execution.</p>\n<h2 id=\"abstract\" style=\"position:relative;\"><a href=\"#abstract\" aria-label=\"abstract permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Abstract</h2>\n<!--A short (~200 word) description of the proposed change, the abstract should clearly describe the proposed change. This is what *will* be done if the SIP is implemented, not *why* it should be done or *how* it will be done. If the SIP proposes deploying a new contract, write, \"we propose to deploy a new contract that will do x\".-->\n<p>Core upgrades include a premium/discount pricing function that adiabatically collects and distributes premium along a path invariant curve in skew space, as well as a velocity-based funding rate model that is also zero-sum and path invariant in funding rate space. Challenges related to oracle latency are also putatively mitigated via price feeds with decentralized oracle networks that update off-chain with on-chain verification.</p>\n<h2 id=\"motivation\" style=\"position:relative;\"><a href=\"#motivation\" aria-label=\"motivation permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Motivation</h2>\n<!--This is the problem statement. This is the *why* of the SIP. It should clearly explain *why* the current state of the protocol is inadequate.  It is critical that you explain *why* the change is needed, if the SIP proposes changing how something is calculated, you must address *why* the current calculation is inaccurate or wrong. This is not the place to describe how the SIP will address the issue!-->\n<p>The current Synthetix perps market design is highly constrained in terms of scalability and efficiency. The most notable limitations pertain to capital inefficiency (restrictive open interest limits), weak risk management incentives, funding rate instability, and high fees / wide spreads.</p>\n<h2 id=\"specification\" style=\"position:relative;\"><a href=\"#specification\" aria-label=\"specification permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Specification</h2>\n<h3 id=\"overview\" style=\"position:relative;\"><a href=\"#overview\" aria-label=\"overview permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Overview</h3>\n<!--This is a high level overview of *how* the SIP will solve the problem. The overview should clearly describe how the new feature will be implemented.-->\n<p>There are three high level improvements proposed here: (1) premium/discount pricing function, (2) funding rate velocity model, and (3) on/off-chain hybrid oracle implementation. (1) can be implemented through a simple change to how exchanges are priced. Instead of quoting a pure oracle price, markets would instead quote <code>oracle_price + premium</code> where <code>premium</code> is directly proportional to fractionalized skew. (2) can be implemented via modification to funding rate calculations where fractionalized skew dictates the instantaneous funding rate <em>velocity</em> rather than instantaneous funding rate. (3) requires relatively minimal contract changes that will be outlined in a separate SIP but touched upon at a high level here.</p>\n<h3 id=\"rationale\" style=\"position:relative;\"><a href=\"#rationale\" aria-label=\"rationale permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rationale</h3>\n<!--This is where you explain the reasoning behind how you propose to solve the problem. Why did you propose to implement the change in this way, what were the considerations and trade-offs. The rationale fleshes out what motivated the design and why particular design decisions were made. It should describe alternate designs that were considered and related work. The rationale may also provide evidence of consensus within the community, and should discuss important objections or concerns raised during discussion.-->\n<p>Restrictive open interest limits are a symptom of inefficient risk management. While proportional skew funding provides a non-zero incentive to balance debt pool risk, it has proven generally ineffective. Notably, there are two primary limitations of this model. One is that while the intention is optimize for balanced open interest, there is no incentive to completely offset exposure as funding would instantaneously disappear without \"memory\" of prior imbalances. Additionally as Synthetix perps markets reach equilibrium with external markets, risk does not necessarily converge to zero (e.g. hard-to-borrow assets with perpetually negative funding for an extreme illustration). Lastly, funding rates that are instantaneously proportional to skew also present UX challenges in the form of volatile/unpredictable funding rates.</p>\n<p><em>Premium/discount function</em></p>\n<p>The architecture outlined in this SIP takes a layered approach to risk management. Rather than leaning exclusively on funding payments to limit LP risk, a skew-dependent premium is applied to prices quoted by the market (premium for long skew, discount for short skew). By storing premium from takers (expanding skew) to adiabatically distribute to makers (compressing skew), this mechanism creates a high frequency rebalancing incentive while also placing soft limits on maximum exposure held by the debt pool (without the need for explicit restrictive OI limit). Simulating price impact in this way also increases compatibility for assets with a wider range of liquidity profiles and protects LPs from market manipulation.</p>\n<p><em>Funding rate velocity</em></p>\n<p>This model represents a mathematically minor adjustment to the current system, but with significant implications to the overall mechanism. Put simply, instead of <code>r = c * skew</code>, instead we have <code>dr/dt = c * skew</code>. In practice, the effect of this change is that funding rates will continuously drift higher/lower in the presence of uncorrected position imbalances, creating a natural price discovery mechanism for funding rates while simultaneously smoothing out funding rate trajectories. Another notable change is that with this mechanism, LPs would no longer exclusively earn funding (e.g. short skew + positive funding, LPs pay funding). Instead, funding flows through LPs without gain or loss over time (i.e. can be mathematically shown that net funding earned by LPs over time is zero). See plots below illustrating debt pool earning funding when <code>dr/dt > 0</code> while paying equal and opposite funding when <code>dr/dt &#x3C; 0</code></p>\n<img width='690' alt='image' src='https://user-images.githubusercontent.com/83029531/192562574-2f42c7f9-2ac6-4d2c-94e4-f96be611d945.png'>\n<img width='690' alt='image' src='https://user-images.githubusercontent.com/83029531/192562639-ca83bc05-6c32-4910-8536-55af9365a1d8.png'>\n<img width='690' alt='image' src='https://user-images.githubusercontent.com/83029531/192562723-90a548a5-89f2-4ba2-b6a9-f4ae2a68d160.png'>\n<p><em>Hybrid oracle approach</em></p>\n<p>This approach creates multiple execution tiers: (1) traditional execution through purely on-chain oracle, (2) asynchronous execution through on-chain oracle, or (3) asynchronous execution using off-chain oracle network whose validity is verified on-chain. Tier (1) is superior in composability, while tier (3) is superior in performance and execution efficiency (tier (2) is somewhere in between). With signed price updates made available off-chain, on-chain costs are only incurred when an exchange is made thus improving cost sustainability while also improving liveliness.</p>\n<h3 id=\"technical-specification\" style=\"position:relative;\"><a href=\"#technical-specification\" aria-label=\"technical specification permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Technical Specification</h3>\n<!--The technical specification should outline the public API of the changes proposed. That is, changes to any of the interfaces Synthetix currently exposes or the creations of new ones.-->\n<p><em>Premium/discount function</em></p>\n<p>A single configurable variable, <code>skewScale</code>, is used to modulate market liquidity via a linear premium/discount curve represented as <code>premium = skew / skewScale</code>. When a trade is made, the price is pushed from point A to B along the linear curve. Thus, the actual execution price can be represented as the average price along the curve. For a linear function, the integral can be simply represented as <code>executionPrice = oraclePrice * (1 + 0.5 * (premium_before + premium_after))</code>.</p>\n<p><em>Funding rate velocity</em></p>\n<p>This function controls how quickly funding rates change when skew is uncorrected using the <code>skewScale</code> variable along with <code>maxFundingVelocity</code>, which represents the funding rate velocity when <code>skew = skewScale</code> (in practice, the premium/discount function limits skew to roughly &#x3C;1% of skewScale). In the context of funding rate calculations, <code>skewScale</code> fractionalizes skew which is then normalized to <code>maxFundingVelocity</code>. Every time a trade is made, the average funding rate since the last trade can be interpolated using the velocity after the last trade and the time elapsed in between. When positions on both sides of the market are balanced, funding rates are at rest wherever the neutralizing trade was made.</p>\n<p><em>Hybrid oracle orders</em></p>\n<p>The proposed implementation is highlighted more in SIPs 281 and 285, but a high level overview will be provided here. Due to the intrinsic latency of any external price source, the most practical option is to settle orders asynchronously; that is to say:</p>\n<ol>\n<li>user queues market order</li>\n<li>configurable minimum delay period elapses</li>\n<li>keeper retrieves most recent off-chain price update</li>\n<li>keeper updates on-chain price on-demand and confirms user’s order</li>\n</ol>\n<p>Note that Synthetix contracts would enforce that ΔT between (1) and (4) is sufficiently delayed. Delay thresholds can be configured via SCCP, but would likely be set to ~12 seconds initially (roughly equal to Ethereum L1 block time). In other words, the off-chain timestamp from the price update used to confirm the order must be during the L1 block epoch immediately after the order was queued, which would result in an average realized settlement delay of 6 seconds. In the future when L2 blocks are produced more regularly with native timestamps, this delay threshold can likely be shortened considerably.</p>\n<h3 id=\"test-cases\" style=\"position:relative;\"><a href=\"#test-cases\" aria-label=\"test cases permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Test Cases</h3>\n<p><em>Premium/discount function</em>\nETH/USD long order</p>\n<ul>\n<li><code>ETH/USD oracle price</code> = $2000</li>\n<li><code>longOI</code> = 500 ETH, <code>shortOI</code> = 400 ETH, <code>skew</code> = 100 ETH</li>\n<li><code>skewScale</code> = 10^6 ETH</li>\n<li>User longs 100 ETH</li>\n<li><code>premiumBefore</code> = 0.0001 , <code>skewAdjustedPrice</code> = $2000.2</li>\n<li><code>premiumAfter</code> = 0.0002 , <code>skewAdjustedPrice</code> = $2000.4</li>\n<li><code>executionPrice</code> = 2000 * (1 + 0.5 * (0.0001 + 0.0002)) = $2000.3</li>\n</ul>\n<p><em>Funding rate velocity</em>\nETH/USD long order</p>\n<ul>\n<li><code>ETH/USD oracle price</code> = $2000</li>\n<li><code>longOI</code> = 500 ETH, <code>shortOI</code> = 500 ETH, <code>skew</code> = 0 ETH</li>\n<li><code>fundingRate</code> = 0% / day, <code>fundingRateVelocity</code> = 0% / day^2</li>\n<li><code>skewScale</code> = 10^6 ETH , <code>maxFundingVelocity</code> = 300%</li>\n<li>User #1 longs 100 ETH (200,000 sUSD)</li>\n<li><code>longOI</code> = 600 ETH, <code>shortOI</code> = 500 ETH, <code>skew</code> = 100 ETH</li>\n<li><code>fundingRate</code> = 0% / day, <code>funidngRateVelocity</code> = 0.03% per day</li>\n<li>24 hours, user #2 shorts 100 ETH</li>\n<li><code>longOI</code> = 600 ETH, <code>shortOI</code> = 600 ETH, <code>skew</code> = 0 ETH</li>\n<li><code>fundingRate</code> = 0.03% / day , <code>fundingRateVelocity</code> = 0% / day^2</li>\n<li>User #1 accrued funding = 200000 * 0.5 * (0% + 0.03%) = 30 sUSD</li>\n</ul>\n<h3 id=\"configurable-values-via-sccp\" style=\"position:relative;\"><a href=\"#configurable-values-via-sccp\" aria-label=\"configurable values via sccp permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Configurable Values (Via SCCP)</h3>\n<p><code>skewScale</code>\n<code>maxFundingVelocity</code></p>\n<h2 id=\"copyright\" style=\"position:relative;\"><a href=\"#copyright\" aria-label=\"copyright permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Copyright</h2>\n<p>Copyright and related rights waived via <a href=\"https://creativecommons.org/publicdomain/zero/1.0/\">CC0</a>.</p>"}},"pageContext":{"id":"04f2ed2b-9083-5996-b5b3-b13a8c7f8945","frontmatter__sip":279,"__params":{"frontmatter__sip":"279"}}},"staticQueryHashes":[]}