SIP-355: Add extra views to Spot Markets

Author
StatusImplemented
TypeGovernance
NetworkEthereum & Base
ImplementorNoisekit (@noisekit), Leonardo Massazza (@leomassazza)
ReleaseTBD
ProposalLoading status...
Created2024-01-18

Simple Summary

In order to facilitate access to markets data for integrators and developers, this proposal targets to expose configurations and internal calculations as views in Spot Markets.

Motivation

The primary motivation is to answer integrators and developers' needs for data access. The added views will simplify operations for integrators and developers by allowing them to access data directly from the contracts instead of having to query historical events or do manual calculations.

Specification

Overview

The new getter view functions proposed are:

  • getPriceData(marketId): that will return the configured price data for the market that was configured with updatePriceData
  • getWrapper(marketId): that will return the wrapper address and max wrappable amount for the market that was set with setWrapper
  • getMarketSkew(marketId): that will return the current market skew for the market
  • getNominatedMarketOwner(synthMarketId): that will return the nominated owner for the market

Technical Specification

Expose the following functions as views:

    function getPriceData(uint128 marketId) external view returns (bytes32 buyFeedId, bytes32 sellFeedId, uint256 strictPriceStalenessTolerance);

    function getWrapper(uint128 marketId) external view returns (address wrapCollateralType, uint256 maxWrappableAmount);

    function getMarketSkew(uint128 marketId) external view returns (int256 marketSkew);

    function getNominatedMarketOwner(uint128 synthMarketId) external view returns (address);

Test Cases

Add tests for all the new views.

Configurable Values (Via SCCP)

N/A

Copyright and related rights waived via CC0.