// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.6;
/**
* @title IRegistry
* @author solace.fi
* @notice Tracks the contracts of the Solaverse.
*
* [**Governance**](/docs/protocol/governance) can set the contract addresses and anyone can look them up.
*
* A key is a unique identifier for each contract. Use [`get(key)`](#get) or [`tryGet(key)`](#tryget) to get the address of the contract. Enumerate the keys with [`length()`](#length) and [`getKey(index)`](#getkey).
*/
interface IRegistry {
/***************************************
EVENTS
***************************************/
/// @notice Emitted when a record is set.
event RecordSet(string indexed key, address indexed value);
/***************************************
VIEW FUNCTIONS
***************************************/
/// @notice The number of unique keys.
function length() external view returns (uint256);
/**
* @notice Gets the `value` of a given `key`.
* Reverts if the key is not in the mapping.
* @param key The key to query.
* @param value The value of the key.
*/
function get(string calldata key) external view returns (address value);
/**
* @notice Gets the `value` of a given `key`.
* Fails gracefully if the key is not in the mapping.
* @param key The key to query.
* @param success True if the key was found, false otherwise.
* @param value The value of the key or zero if it was not found.
*/
function tryGet(string calldata key) external view returns (bool success, address value);
/**
* @notice Gets the `key` of a given `index`.
* @dev Iterable [1,length].
* @param index The index to query.
* @return key The key at that index.
*/
function getKey(uint256 index) external view returns (string memory key);
/***************************************
GOVERNANCE FUNCTIONS
***************************************/
/**
* @notice Sets keys and values.
* Can only be called by the current [**governor**](/docs/protocol/governance).
* @param keys The keys to set.
* @param values The values to set.
*/
function set(string[] calldata keys, address[] calldata values) external;
}
|