FtsoRegistry
#
Source | Inherits from IIFtsoRegistry, AddressUpdatable, GovernedBase
Handles registration of assets to the FTSO system.
Functions#
addFtso
#
function addFtso(
contract IIFtso _ftsoContract
) external returns (
uint256 _assetIndex);
Add a new FTSO contract to the registry.
Only the ftsoManager
can call this method.
Parameters | Type | Description |
---|---|---|
_ftsoContract |
contract IIFtso |
New target FTSO contract. |
Returns | Type | Description |
---|---|---|
_assetIndex |
uint256 |
The FTSO index assigned to the new asset. |
cancelGovernanceCall
#
function cancelGovernanceCall(
bytes4 _selector
) external;
Cancel a timelocked governance
call before it has been executed.
Only governance
can call this method.
Parameters | Type | Description |
---|---|---|
_selector |
bytes4 |
The method selector. |
executeGovernanceCall
#
function executeGovernanceCall(
bytes4 _selector
) external;
Execute the timelocked governance
calls once the timelock period expires.
Only executor can call this method.
Parameters | Type | Description |
---|---|---|
_selector |
bytes4 |
The method selector (only one timelocked call per method is stored). |
getAddressUpdater
#
function getAddressUpdater(
) public view returns (
address _addressUpdater);
Returns the configured address updater.
Returns | Type | Description |
---|---|---|
_addressUpdater |
address |
The AddresUpdater contract that can update our contract address list, as a response to a governance call. |
getAllCurrentPrices
#
function getAllCurrentPrices(
) external view returns (
struct IFtsoRegistry.PriceInfo[]);
Returns the current price of all supported assets.
Returns | Type | Description |
---|---|---|
[0] | struct IFtsoRegistry.PriceInfo[] |
Array of PriceInfo structures. |
getAllFtsos
#
function getAllFtsos(
) external view returns (
contract IIFtso[] _ftsos);
Return all currently supported FTSO contracts.
Returns | Type | Description |
---|---|---|
_ftsos |
contract IIFtso[] |
Array of FTSO contract addresses. |
getCurrentPrice
#
function getCurrentPrice(
uint256 _assetIndex
) external view returns (
uint256 _price,
uint256 _timestamp);
Public view function to get the current price of a given active FTSO index. Reverts if the index is not supported.
Parameters | Type | Description |
---|---|---|
_assetIndex |
uint256 |
Returns | Type | Description |
---|---|---|
_price |
uint256 |
Current price of the asset in USD multiplied by 10^ASSET_PRICE_USD_DECIMALS . |
_timestamp |
uint256 |
Timestamp for when this price was updated, in seconds since UNIX epoch. |
getCurrentPrice
#
function getCurrentPrice(
string _symbol
) external view returns (
uint256 _price,
uint256 _timestamp);
Public view function to get the current price of a given active asset symbol. Reverts if the symbol is not supported.
Parameters | Type | Description |
---|---|---|
_symbol |
string |
Symbol to query. |
Returns | Type | Description |
---|---|---|
_price |
uint256 |
Current price of the asset in USD multiplied by 10^ASSET_PRICE_USD_DECIMALS . |
_timestamp |
uint256 |
Timestamp for when this price was updated, in seconds since UNIX epoch. |
getCurrentPriceWithDecimals
#
function getCurrentPriceWithDecimals(
uint256 _assetIndex
) external view returns (
uint256 _price,
uint256 _timestamp,
uint256 _assetPriceUsdDecimals);
Public view function to get the current price and decimals of a given active FTSO index. Reverts if the index is not supported.
Parameters | Type | Description |
---|---|---|
_assetIndex |
uint256 |
Index to query. |
Returns | Type | Description |
---|---|---|
_price |
uint256 |
Current price of the asset in USD multiplied by 10^_assetPriceUsdDecimals . |
_timestamp |
uint256 |
Timestamp for when this price was updated, in seconds since UNIX epoch. |
_assetPriceUsdDecimals |
uint256 |
Number of decimals used to return the _price . |
getCurrentPriceWithDecimals
#
function getCurrentPriceWithDecimals(
string _symbol
) external view returns (
uint256 _price,
uint256 _timestamp,
uint256 _assetPriceUsdDecimals);
Public view function to get the current price and decimals of a given active asset symbol. Reverts if the symbol is not supported.
Parameters | Type | Description |
---|---|---|
_symbol |
string |
Symbol to query. |
Returns | Type | Description |
---|---|---|
_price |
uint256 |
Current price of the asset in USD multiplied by 10^_assetPriceUsdDecimals . |
_timestamp |
uint256 |
Timestamp for when this price was updated, in seconds since UNIX epoch. |
_assetPriceUsdDecimals |
uint256 |
Number of decimals used to return the _price . |
getCurrentPricesByIndices
#
function getCurrentPricesByIndices(
uint256[] _indices
) external view returns (
struct IFtsoRegistry.PriceInfo[]);
Returns the current price of a list of indices. Reverts if any of the indices is not supported.
Parameters | Type | Description |
---|---|---|
_indices |
uint256[] |
Array of indices to query. |
Returns | Type | Description |
---|---|---|
[0] | struct IFtsoRegistry.PriceInfo[] |
Array of PriceInfo structures. |
getCurrentPricesBySymbols
#
function getCurrentPricesBySymbols(
string[] _symbols
) external view returns (
struct IFtsoRegistry.PriceInfo[]);
Returns the current price of a list of asset symbols. Reverts if any of the symbols is not supported.
Parameters | Type | Description |
---|---|---|
_symbols |
string[] |
Array of symbols to query. |
Returns | Type | Description |
---|---|---|
[0] | struct IFtsoRegistry.PriceInfo[] |
Array of PriceInfo structures. |
getFtso
#
function getFtso(
uint256 _assetIndex
) external view returns (
contract IIFtso _activeFtso);
Returns the address of the FTSO contract for a given index. Reverts if unsupported index is passed.
Parameters | Type | Description |
---|---|---|
_assetIndex |
uint256 |
Returns | Type | Description |
---|---|---|
_activeFtso |
contract IIFtso |
getFtsoBySymbol
#
function getFtsoBySymbol(
string _symbol
) external view returns (
contract IIFtso _activeFtso);
Returns the address of the FTSO contract for a given symbol. Reverts if unsupported symbol is passed.
Parameters | Type | Description |
---|---|---|
_symbol |
string |
The queried symbol. |
Returns | Type | Description |
---|---|---|
_activeFtso |
contract IIFtso |
getFtsoHistory
#
function getFtsoHistory(
uint256 _assetIndex
) external view returns (
contract IIFtso[5] _ftsoAddressHistory);
Get the history of FTSOs for given index. If there are less then MAX_HISTORY_LENGTH the remaining addresses will be 0 addresses. Reverts if index is not supported.
Parameters | Type | Description |
---|---|---|
_assetIndex |
uint256 |
Asset index to query. |
Returns | Type | Description |
---|---|---|
_ftsoAddressHistory |
contract IIFtso[5] |
History of FTSOs contract for provided index. |
getFtsoIndex
#
function getFtsoIndex(
string _symbol
) external view returns (
uint256 _assetIndex);
Returns the FTSO index corresponding to a given asset symbol. Reverts if the symbol is not supported.
Parameters | Type | Description |
---|---|---|
_symbol |
string |
Symbol to query. |
Returns | Type | Description |
---|---|---|
_assetIndex |
uint256 |
The corresponding asset index. |
getFtsoSymbol
#
function getFtsoSymbol(
uint256 _assetIndex
) external view returns (
string _symbol);
Returns the asset symbol corresponding to a given FTSO index. Reverts if the index is not supported.
Parameters | Type | Description |
---|---|---|
_assetIndex |
uint256 |
Returns | Type | Description |
---|---|---|
_symbol |
string |
The corresponding asset symbol. |
getFtsos
#
function getFtsos(
uint256[] _assetIndices
) external view returns (
contract IFtsoGenesis[] _ftsos);
Get the addresses of the active FTSOs at the given indices. Reverts if any of the provided indices is non-existing or inactive.
Parameters | Type | Description |
---|---|---|
_assetIndices |
uint256[] |
Returns | Type | Description |
---|---|---|
_ftsos |
contract IFtsoGenesis[] |
The array of FTSO addresses. |
getSupportedFtsos
#
function getSupportedFtsos(
) external view returns (
contract IIFtso[] _ftsos);
Get array of all FTSO contracts for all supported asset indices. The index of FTSO in returned array does not necessarily correspond to the asset's index. Due to deletion, some indices might be unsupported.
Use getSupportedIndicesAndFtsos
to retrieve pairs of correct indices and FTSOs,
where possible "null" holes are readily apparent.
Returns | Type | Description |
---|---|---|
_ftsos |
contract IIFtso[] |
Array of all supported FTSOs. |
getSupportedIndices
#
function getSupportedIndices(
) external view returns (
uint256[] _supportedIndices);
Returns the indices of the currently supported FTSOs. Active FTSOs are ones that currently receive price feeds.
Returns | Type | Description |
---|---|---|
_supportedIndices |
uint256[] |
Array of all active FTSO indices in increasing order. |
getSupportedIndicesAndFtsos
#
function getSupportedIndicesAndFtsos(
) external view returns (
uint256[] _supportedIndices,
contract IIFtso[] _ftsos);
Get all supported indices and corresponding FTSO addresses. Active FTSOs are ones that currently receive price feeds.
Returns | Type | Description |
---|---|---|
_supportedIndices |
uint256[] |
Array of all supported indices. |
_ftsos |
contract IIFtso[] |
Array of all supported FTSO addresses. |
getSupportedIndicesAndSymbols
#
function getSupportedIndicesAndSymbols(
) external view returns (
uint256[] _supportedIndices,
string[] _supportedSymbols);
Get all supported indices and corresponding symbols. Active FTSOs are ones that currently receive price feeds.
Returns | Type | Description |
---|---|---|
_supportedIndices |
uint256[] |
Array of all supported indices. |
_supportedSymbols |
string[] |
Array of all supported symbols. |
getSupportedIndicesSymbolsAndFtsos
#
function getSupportedIndicesSymbolsAndFtsos(
) external view returns (
uint256[] _supportedIndices,
string[] _supportedSymbols,
contract IIFtso[] _ftsos);
Get all supported indices, symbols, and corresponding FTSO addresses. Active FTSOs are ones that currently receive price feeds.
Returns | Type | Description |
---|---|---|
_supportedIndices |
uint256[] |
Array of all supported indices. |
_supportedSymbols |
string[] |
Array of all supported symbols. |
_ftsos |
contract IIFtso[] |
Array of all supported FTSO addresses. |
getSupportedSymbols
#
function getSupportedSymbols(
) external view returns (
string[] _supportedSymbols);
Returns the symbols of the currently supported FTSOs. Active FTSOs are ones that currently receive price feeds.
Returns | Type | Description |
---|---|---|
_supportedSymbols |
string[] |
Array of all active FTSO symbols in increasing order. |
getSupportedSymbolsAndFtsos
#
function getSupportedSymbolsAndFtsos(
) external view returns (
string[] _supportedSymbols,
contract IIFtso[] _ftsos);
Get all supported symbols and corresponding FTSO addresses. Active FTSOs are ones that currently receive price feeds.
Returns | Type | Description |
---|---|---|
_supportedSymbols |
string[] |
Array of all supported symbols. |
_ftsos |
contract IIFtso[] |
Array of all supported FTSO addresses. |
governance
#
function governance(
) public view returns (
address);
Returns the current effective governance
address.
initialiseRegistry
#
function initialiseRegistry(
address _addressUpdater
) external;
removeFtso
#
function removeFtso(
contract IIFtso _ftso
) external;
Removes the FTSO and keeps part of the history. Reverts if the provided address is not supported.
From now on, the index this asset was using is "reserved" and cannot be used again. It will not be returned in any list of currently supported assets.
Only the ftsoManager
can call this method.
Parameters | Type | Description |
---|---|---|
_ftso |
contract IIFtso |
Address of the FTSO contract to remove. |
switchToProductionMode
#
function switchToProductionMode(
) external;
Enter the production mode after all the initial governance
settings have been set.
This enables timelocks and the governance
can be obtained afterward by calling
governanceSettings
.getGovernanceAddress().
Emits GovernedProductionModeEntered
.
updateContractAddresses
#
function updateContractAddresses(
bytes32[] _contractNameHashes,
address[] _contractAddresses
) external;
External method called from AddressUpdater
only.
Modifiers#
onlyAddressUpdater
#
modifier onlyAddressUpdater()
Only the AdressUpdater
contract can call this method.
Its address is set at construction time but it can also update itself.
onlyFtsoManager
#
modifier onlyFtsoManager()
Only the ftsoManager
can call this method.
Variables#
ftsoManager
#
contract IIFtsoManager ftsoManager
FtsoManager
contract that can add and remove assets to the registry.
governanceSettings
#
contract IGovernanceSettings governanceSettings
Governance Settings.
productionMode
#
bool productionMode
When true, governance
is enabled and cannot be disabled. See switchToProductionMode
.
timelockedCalls
#
mapping(bytes4 => struct GovernedBase.TimelockedCall) timelockedCalls
List of pending timelocked governance
calls.