SIP-322: Spot Market View Functions

Author
StatusImplemented
TypeGovernance
NetworkEthereum & Optimism
ImplementorNoah Litvin (@noahlitvin)
ReleaseTBD
ProposalLoading status...
Created2023-05-08

Simple Summary

This SIP proposes adding various view functions to the spot market implementation and a minor alteration to eventing functionality in the oracle manager.

Motivation

To improve developer experience for integrating with the spot market, it would beneficial to allow smart contracts to return additional data from storage such that event indexing tools like subgraphs aren’t necessary. Also, the additional event in the oracle manager creates more idempotent behavior, such that developer tooling is able to more reliably retrieve the ID for a relevant node.

Technical Specification

  • Add function getMarketFees(uint128 synthMarketId) external returns (uint256 atomicFixedFee, uint256 asyncFixedFee, int256 wrapFee, int256 unwrapFee)
  • Add function getMarketSkewScale(uint128 synthMarketId) external returns (uint256 skewScale);
  • Add function getMarketUtilizationFees(uint128 synthMarketId) external returns (uint256 utilizationFeeRate);
  • Add function getCollateralLeverage(uint128 synthMarketId) external returns (uint256 collateralLeverage);
  • Add function getCustomTransactorFees(uint128 synthMarketId, address transactor) external returns (uint256 fixedFeeAmount);
  • Add function getFeeCollector(uint128 synthMarketId) external returns (address feeCollector);
  • Add function getReferrerShare(uint128 marketId, address referrer) external returns (uint256 sharePercentage);
  • Emit NodeRegistered in the _registerNode function, even if the node has already been registered.

Test Cases

Relevant tests will be developed during implementation.

Configurable Values (Via SCCP)

N/A

Copyright and related rights waived via CC0.

Spot Market View Functions emit NodeRegistered even if node is already registered