SIP-331: Adding view function to retrieve market address by market id

Author
Noisekit
StatusImplemented
TypeGovernance
NetworkEthereum & Optimism
ImplementorNoisekit
ReleaseTBD
ProposalLoading status...
Created2023-07-11

Simple Summary

This proposal suggests adding a getMarketAddress function to the MarketManagerModule in the Synthetix Protocol, which will allow devs to retrieve the address of a deployed market by using the market's ID.

Abstract

The getMarketAddress function is designed to return the address of the deployed market, given a market ID as input. This function would simplify the process of retrieving information about a market directly from the market contract.

Motivation

Currently, the only method available to find a deployed market's address is to check the market creation event. This approach poses a problem as it makes direct interaction with the market contract challenging without using services like a subgraph.

By providing a getMarketAddress function, we make the protocol more accessible and user-friendly, allowing users to easily interact with market contracts and retrieve information.

Specification

Overview

This feature's addition will involve the MarketManagerModule, which will need a new getMarketAddress function to return the address of a market given its ID.

Rationale

The proposed function will allow easier access to information regarding the Synthetix markets, improving the overall user experience and creating more interaction opportunities with the protocol.

Technical Specification

The getMarketAddress function could be implemented as follows:

function getMarketAddress(uint128 marketId) external view override returns (address) {
    return Market.load(marketId).marketAddress;
}

Test Case

N/A

Configurable Values (Via SCCP)

N/A

Copyright and related rights waived via CC0.