SIP-330: Minimum credit capacity view function and event
Author | Noisekit |
---|---|
Status | Rejected |
Type | Governance |
Network | Ethereum & Optimism |
Implementor | TBD |
Release | TBD |
Created | 2023-06-28 |
Simple Summary
This proposal suggests the addition of a view function that provides the minimum credit capacity of a market, required to maintain market liquidity, and an event that is emitted when capacity changes.
Abstract
A getMinimumCreditCapacity(uint128 marketId)
function would return the minimum collateral needed for a given market to avoid getting locked due to insufficient collateral. In addition, a MinimumCreditCapacityChanged(uint128 marketId, uint128 oldCreditCapacity, uint128 newCreditCapacity)
event would be emitted whenever the minimum collateral capacity changes.
Motivation
The proposed additions will improve the user experience on the frontend by allowing users to understand how much collateral they can withdraw without causing a transaction revert due to a market getting into a locked collateral state.
For example, if a user wanted to decrease delegated collateral amount, the application could call getMinimumCreditCapacity
to calculate the maximum amount the user could withdraw without causing a revert (losing user's money for gas fees)
In addition, the event would enable the creation of a historical data chart or dashboard to track changes in market liquidity requirements over time.
Specification
Overview
These additions would use existing data structures in the Synthetix V3 core system and should not introduce substantial risk to the system.
Rationale
Providing visibility into minimum collateral requirements and changes to them helps users make informed decisions about their participation in the Synthetix Protocol.
Technical Specification
The getMinimumCreditCapacity
function could be implemented as follows:
function getMinimumCreditCapacity(
uint128 marketId
)
external
view
returns (uint128 minCreditCapacity)
{
// Implementation to calculate and return the minimum collateral requirement
}
The MinimumCreditCapacityChanged
event could be emitted as follows:
event MinimumCreditCapacityChanged(
uint128 indexed marketId,
uint128 oldCreditCapacity,
uint128 newCreditCapacity
);
// This could be emitted wherever the minimum collateral requirement for a market changes in the system
Test Case
Applications could call the getMinimumCreditCapacity
function to display the minimum collateral needed to maintain liquidity for a given market.
Application could listen for the MinimumCreditCapacityChanged
event being emitted when collateral delegation changes for a given market or market configuration changes.
Configurable Values (Via SCCP)
N/A
Copyright
Copyright and related rights waived via CC0.