{"componentChunkName":"component---src-pages-sips-sip-markdown-remark-frontmatter-sip-tsx","path":"/sips/sip-354/","result":{"data":{"markdownRemark":{"fileAbsolutePath":"/vercel/path0/content/sips/sip-354.md","frontmatter":{"sip":354,"sccp":null,"title":"Perps v3 Asymmetric Funding","network":"Base","author":"fifa, Sunny Vempati","type":"Governance","proposal":"https://snapshot.org/#/snxgov.eth/proposal/0xe32695658f9911c340eaca7083cbd392c38f43e6478c1207cfd3e82e62456719","implementor":null,"release":null,"created":null,"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>Introduces an asymmetric funding rate mechanism for Perps V3.</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>Based on the configured parameters, asymmetry can be introduced to funding rates to add a net cost to traders monopolizing open interest. When trade is closed, the interest accrued is realized by the LPs backing the Perps supermarket.</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>While Perps V2 was supported by a large pool of collateral (SNX stakers) from inception, isolated deployments of Perps V3 will need to bootstrap liquidity and markets. Scaling positions and liquidity in concert is crucial for bounding LP risk appropriately. Perps V3 also implements a locking of LP collateral to ensure that open positions are backed by underlying collateral. However, without economic incentives to discourage total utilization of LP collateral, it is possible to engineer costless locking of LP collateral. The introduction of asymmetric funding provides acts as both an incentive for additional LPs to enter the market while also encouraging closing of positions to liberate LP collateral in a timely manner.</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<!--The specification should describe the syntax and semantics of any new feature, there are five sections\n1. Overview\n2. Rationale\n3. Technical Specification\n4. Test Cases\n5. Configurable Values\n-->\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>This SIP proposes to upgrades the perps contracts to introduce 3 new parameters to enable asymmetric funding across any markets within the supermarket. For simplicity of accounting, this can be implemented as an interest rate that is only activated at very high levels of locked LP collateral; though in practice, it will be surfaced to end users as an asymmetric funding rate (e.g. 10% funding, 5% 'interest' = +5% for short, -15% for long)</p>\n<p>The parameters:</p>\n<pre><code>uint256 lowUtilizationInterestRateGradient\nuint256 interestRateGradientBreakpoint\nuint256 highUtilizationInterestRateGradient\n</code></pre>\n<p><img src=\"/static/interest-cefb467dc26abf54ac72d2a09c13afc1.png\" alt=\"interest-rate.png\"></p>\n<p>The interest accrued is based on which side of the <code>interestRateGradientBreakpoint</code> the utilization % is. Below the breakpoint means the interest rate grows at the rate defined by <code>lowUtilizationInterestRateGradient</code> and anything above means the interest rate grows at the rate defined by <code>highUtilizationInterestRateGradient</code>.</p>\n<p>The utilization rate is calculated as follows:</p>\n<pre><code>lockedOi / marketCreditCapacity\n</code></pre>\n<p>Note: <code>lockedOi</code> is the entire open interest of all markets in the supermarket multiplied by their respective <code>lockedOiRatio</code>.</p>\n<p>The interest is accrued by each trader based on their contribution to the locked open interest.</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>Setters/Getters</p>\n<pre><code>function setInterestRateParameters(\n  uint128 lowUtilizationInterestRateGradient,\n  uint128 interestRateGradientBreakpoint,\n  uint128 highUtilizationInterestRateGradient\n) external;\n\nfunction getInterestRateParameters()\n  external\n  view\n  returns (\n    uint128 lowUtilizationInterestRateGradient,\n    uint128 interestRateGradientBreakpoint,\n    uint128 highUtilizationInterestRateGradient\n  );\n</code></pre>\n<p>Because utilization rate is dependent on delegated collateral from the LP side, there is no hook that forces the rate on the perps supermarket to be updated when someone (un)delegates. For this reason, a convenience method to manually update the interest rate that could be called the LP app has been added:</p>\n<pre><code>function updateInterestRate() external;\n</code></pre>\n<p>New views have been added to surface the current utliziationRate or the computed interestRate of the supermarket:</p>\n<pre><code>/**\n  * @notice Returns the current market interest rate\n  * @return rate\n  */\nfunction interestRate() external view returns (uint128 rate);\n\n/**\n  * @notice Returns the super market utilization rate\n  * @dev The rate is the minimumCredit / delegatedCollateral available.\n  * @dev Locked credit is the sum of all markets open interest * configured lockedOiRatio\n  * @dev delegatedCollateral is the credit capacity available to the supermarket\n  * @return rate\n  * @return delegatedCollateral\n  * @return lockedCredit credit locked based on OI &#x26; lockedOiRatio\n  */\nfunction utilizationRate()\n    external\n    view\n    returns (uint256 rate, uint256 delegatedCollateral, uint256 lockedCredit);\n</code></pre>\n<p>The integrators can get a trader's owed interest by calling the previously available <code>getOpenPosition</code> which now returns that value:</p>\n<pre><code class=\"language-diff\">    function getOpenPosition(\n        uint128 accountId,\n        uint128 marketId\n    )\n        external\n        view\n        returns (\n          int256 totalPnl,\n          int256 accruedFunding,\n          int128 positionSize,\n+         uint256 owedInterest\n        );\n</code></pre>\n<p>New events added:</p>\n<pre><code>/**\n  * @notice Gets emitted when the interest rate is updated.\n  */\nevent InterestRateUpdated(uint128 indexed superMarketId, uint128 interestRate);\n\n/**\n  * @notice Emitted when interest rate parameters are set\n  */\nevent InterestRateParametersSet(\n    uint256 lowUtilizationInterestRateGradient,\n    uint256 interestRateGradientBreakpoint,\n    uint256 highUtilizationInterestRateGradient\n);\n\n/**\n  * @notice Gets emitted after any trade settles and includes interest charged to the trader on previous position\n  */\nevent InterestCharged(uint128 indexed accountId, uint256 interest);\n</code></pre>\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<!--Test cases for an implementation are mandatory for SIPs but can be included with the implementation..-->\n<p>New test scenarios have been added to <code>InterestRate.test.ts</code>.</p>\n<ul>\n<li>2 traders, each in different markets.</li>\n<li>1 trader opens a trade</li>\n<li>the other trader opens and closes trades on a separate market with differing times</li>\n</ul>\n<p>Check both trader1 and trader2 have accrued the proper interest based on configured interest rate parameters.</p>\n<p>Another test scenario added for when the interest rate parameters are turned off after being turned on: <code>InterestRate.reset.test.ts</code></p>\n<ul>\n<li>Assert functionality that interest stops accruing after interest rate parameters have been disabled but previous interest accrued is preserved.</li>\n</ul>\n<p>Added new tests to <code>GlobalPerpsMarket.test.ts</code>:</p>\n<ul>\n<li><code>setInterestRateParameters</code></li>\n<li><code>getInterestRateParameters</code></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<!--Please list all values configurable via SCCP under this implementation.-->\n<p>Please list all values configurable via SCCP under this implementation.</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":"3af3f853-0f23-5b25-8ec9-7fc6583b1774","frontmatter__sip":354,"__params":{"frontmatter__sip":"354"}}},"staticQueryHashes":[]}