Skip to content

Commit

Permalink
Sip 390+header updates (#1996)
Browse files Browse the repository at this point in the history
* update headers

* Create sip-390.md

* Update sip-390.md

* Update sip-390.md

* Update sip-390.md

* Update sip-390.md

* Update sip-390.md

* Update sip-390.md
  • Loading branch information
kaleb-keny authored Jun 5, 2024
1 parent 737dd04 commit b074db5
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 3 deletions.
4 changes: 3 additions & 1 deletion content/sccp/sccp-2091.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Lower c-ratio to 400%
type: Governance
network: Ethereum & Optimism
author: Kain Warwick (@kaiynne)
status: Draft
status: Rejected
created: 2024-03-07
---

Expand All @@ -27,6 +27,8 @@ Lowering the c-ratio to 400% will increase the capital efficiency of the network

The c-ratio was raised during the bear market to prevent liquidations. Given the shift to a bull market, increasing capital efficiency is important to compete with other staking options.

Switched to rejected as sccp is inactive and not followed up by author.

## Copyright

Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
4 changes: 3 additions & 1 deletion content/sccp/sccp-2115.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ sccp: 2115
network: Ethereum & Optimism
title: Update Issuance Ratio
author: Kaleb (@kaleb-keny)
status: Vote_Pending
status: Implemented
proposal: >-
https://snapshot.org/#/snxgov.eth/proposal/0x107627900324a76e28997c4dfb81d1c5c8368fdc5d20c764645edaa4a38b06da
created: 2024-06-03
type: Governance
---
Expand Down
4 changes: 3 additions & 1 deletion content/sips/sip-386.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ network: Base
title: Bring perps v3 markets to parity with perps v2
author: Millie
status: Draft
created: 05/28/2024
created: 2024-05-28
type: Governance
proposal: >-
https://snapshot.org/#/snxgov.eth/proposal/0xa457601dd50a95c5773d350d31aa705c0c7dede433dd9f98ca56271a863f50ae
---

## Abstract
Expand Down
79 changes: 79 additions & 0 deletions content/sips/sip-390.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
sip: 390
title: Minimum Credit Patch - Perps V3
network: Base
status: Draft
type: Governance
author: 'Sunny Vempati (@sunnyvempati), kaleb (@kaleb-keny)'
created: 2024-06-05
---

<!--You can leave these HTML comments in your merged SIP and delete the visible duplicate text guides, they will not appear and may be helpful to refer to if you edit it again. This is the suggested template for new SIPs. Note that an SIP number will be assigned by an editor. When opening a pull request to submit your SIP, please use an abbreviated title in the filename, `sip-draft_title_abbrev.md`. The title should be 44 characters or less.-->

## Simple Summary

<!--"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.-->

This sip proposes to patch the minimum credit calculation by incorporating the escrowed snxUSD margin deposited by traders into a perp market.

## Abstract

<!--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".-->

Some concepts covering this SIP:
- Credit capacity represents the total amount of snxUSD that the market could withdraw if it were to immediately unwrap all its positions.
- Locked credit represents the minimum amount of delegated collateral that needs to be credited to a given market, in order to allows traders to withdraw from a given market.

The validation done in the [core of the system](https://github.com/Synthetixio/synthetix-v3/blob/cace699d1fb070042ca09a390c95548c31a5d025/protocol/synthetix/contracts/storage/Market.sol#L277) uses these concepts whereby `creditCapacityD18` is calculated by summing up the value of the delegated collateral of LP's **but also includes traders margin**. However, `lockedCredit` does not include the latter margin amount, hence this sip.
Currently, minimum credit is calculated by iterating on over active markets, getting the active open interest and multiplying that by a `lockedOiRatio`, this gives insight information on the expected credit that needs to be catered for by LP's.

## Motivation

<!--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!-->

The minimum credit calculation update ensures that markets are sufficiently covered by liquidity from LP's before allowing withdrawals / undelegation from a given market. This provides confidence to traders that markets are solvent and assurances on it's collateralization.

## Rationale

<!--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.-->

The original [validation](https://github.com/Synthetixio/synthetix-v3/blob/cace699d1fb070042ca09a390c95548c31a5d025/protocol/synthetix/contracts/storage/Market.sol#L278) did not take into account that traders' margin are included credit capacity. This patch only needs to be applied to snxUSD, while other spot synths, deposited by traders are **not** included into `creditCapacity` calculation by the core system.


## Technical Specification

<!--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.-->

The fix ensures that the `snxUSD` deposited by traders as margin is incorporated into the minimum credit calculation as done in [PR-2144](https://github.com/Synthetixio/synthetix-v3/pull/2144).

```solidity
function minimumCredit(
Data storage self
) internal view returns (uint256 accumulatedMinimumCredit) {
uint256 activeMarketsLength = self.activeMarkets.length();
for (uint256 i = 1; i <= activeMarketsLength; i++) {
uint128 marketId = self.activeMarkets.valueAt(i).to128();
accumulatedMinimumCredit += PerpsMarket.requiredCredit(marketId);
}
// add the sUSD collateral value to the minimum credit since it's used as escrow
accumulatedMinimumCredit += self.collateralAmounts[SNX_USD_MARKET_ID];
}
```

### Test Cases

<!--Test cases for an implementation are mandatory for SIPs but can be included with the implementation..-->

Relevant tests will be developed during implementation.

### Configurable Values (Via SCCP)

<!--Please list all values configurable via SCCP under this implementation.-->

N/A

## Copyright

Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).

0 comments on commit b074db5

Please sign in to comment.