-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SIP-342 Add extra fields to existing Market Events to track market de…
…bt changes (#1710)
- Loading branch information
Showing
1 changed file
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
--- | ||
sip: 343 | ||
network: Ethereum & Optimism | ||
title: Add extra fields to existing Market Events to track market debt changes | ||
author: Noisekit (@noisekit) | ||
status: Draft | ||
created: 2023-10-03 | ||
type: Governance | ||
--- | ||
|
||
## Simple Summary | ||
|
||
In order to facilitate market's debt tracking over time, this proposal targets to extend existing market events in the Synthetix core system. | ||
|
||
## Motivation | ||
|
||
The primary motivation behind this proposal is to provide a more comprehensive tracking system for changes in the market's debt. The added fields will enable analytics capabilities and in subgrapts to power UI, benefiting both developers and users. | ||
|
||
## Specification | ||
|
||
### Overview | ||
|
||
Under this proposal, `creditCapacity`, `netIssuance`, `depositedCollateralValue` and `reportedDebt` fields would be added to `MarketUsdDeposited`, `MarketUsdWithdrawn`, `MarketCollateralDeposited` and `MarketCollateralWithdrawn` events, which will store the market's debt-relaeted data at the time of each event. | ||
|
||
This will prevent the need to recalculate these values in the subgraph processor, thereby averting potential data discrepancies. | ||
|
||
### Technical Specification | ||
|
||
The proposal suggests additions to existing events by introducing new fields. The enhanced event signatures would appear as follows: | ||
|
||
```diff | ||
event MarketCollateralDeposited( | ||
uint128 indexed marketId | ||
address indexed collateralType | ||
uint256 tokenAmount | ||
address indexed sender | ||
+ int128 creditCapacity | ||
+ int128 netIssuance | ||
+ uint256 depositedCollateralValue | ||
+ uint256 reportedDebt | ||
); | ||
``` | ||
|
||
|
||
```diff | ||
event MarketCollateralWithdrawn( | ||
uint128 indexed marketId | ||
address indexed collateralType | ||
uint256 tokenAmount | ||
address indexed sender | ||
+ int128 creditCapacity | ||
+ int128 netIssuance | ||
+ uint256 depositedCollateralValue | ||
+ uint256 reportedDebt | ||
); | ||
``` | ||
|
||
```diff | ||
event MarketUsdDeposited( | ||
uint128 indexed marketId | ||
address indexed target | ||
uint256 amount | ||
address indexed market | ||
+ int128 creditCapacity | ||
+ int128 netIssuance | ||
+ uint256 depositedCollateralValue | ||
+ uint256 reportedDebt | ||
); | ||
``` | ||
|
||
|
||
```diff | ||
event MarketUsdWithdrawn( | ||
uint128 indexed marketId | ||
address indexed target | ||
uint256 amount | ||
address indexed market | ||
+ int128 creditCapacity | ||
+ int128 netIssuance | ||
+ uint256 depositedCollateralValue | ||
+ uint256 reportedDebt | ||
); | ||
``` | ||
|
||
## Test Case | ||
|
||
While this SIP doesn't necessitate additional test cases as it is non-breaking and just expands existing events with new fields, it's important that existing test cases receive updates to incorporate these extra properties. | ||
|
||
Moreover, it's crucial to note that the UI and subgraphs consuming these events must be modified to accommodate these changes. | ||
|
||
## Configurable Values (Via SCCP) | ||
|
||
N/A | ||
|
||
## Copyright | ||
|
||
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). |
fa38ee7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
sips – ./
sips-synthetixio.vercel.app
sips-git-master-synthetixio.vercel.app
sips.synthetix.io
synthetixio-github-io.vercel.app