MarketRegistry

The contract manages the registration and de-registration of markets, provides info about registered markets

MARKET_ROLE

bytes32 MARKET_ROLE

_markets

mapping(bytes32 => address) _markets

A mapping that relates a market name to its contract address.

_marketNames

bytes32[] _marketNames

A dynamic array that stores the names of all registered markets.

registerMarket

function registerMarket(address _marketAddress, bytes32 _marketName) public

Register a new market

The function assigns a market role to the market, adds the market to the markets mapping and stores the market name

Parameters

Name
Type
Description

_marketAddress

address

The address of the market contract

_marketName

bytes32

The name of the market

unregisterMarket

Unregister an existing market

The function removes a market role from the market, deletes the market from the markets mapping and removes the market name

Parameters

Name
Type
Description

_marketAddress

address

The address of the market contract

_marketName

bytes32

The name of the market

getMarket

Fetch the contract address of a registered market

Returns the contract address of a market given its name

Parameters

Name
Type
Description

_marketName

bytes32

The name of the market

Return Values

Name
Type
Description

[0]

address

The contract address of the market

getMarketNames

Fetch the names of all registered markets

Returns a dynamic array that includes the names of all registered markets

Return Values

Name
Type
Description

[0]

bytes32[]

An array of names of all registered markets

isMarket

Check whether a contract is a registered market

Checks whether a contract has been assigned a market role

Parameters

Name
Type
Description

_marketAddress

address

The address of the market contract

Return Values

Name
Type
Description

[0]

bool

A boolean value indicating whether the contract is a registered market

Last updated