AddressUpdater
#
Source | Inherits from IIAddressUpdater, Governed
Keeps track of the current address for all unique and special platform contracts.
This contract keeps a list of addresses that gets updated by governance
every time
any of the tracked contracts is redeployed.
This list is then used by the FlareContractRegistry
, and also by AddressUpdatable
to inform all dependent contracts of any address change.
Functions#
addOrUpdateContractNamesAndAddresses
#
function addOrUpdateContractNamesAndAddresses(
string[] _contractNames,
address[] _contractAddresses
) external;
Add or update
contract names and addresses that are later used in updateContractAddresses
calls.
Can only be called by governance
.
Parameters | Type | Description |
---|---|---|
_contractNames |
string[] |
Contracts names. |
_contractAddresses |
address[] |
Addresses of corresponding contracts names. |
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. |
constructor
#
constructor(
address _governance
) public;
Parameters | Type | Description |
---|---|---|
_governance |
address |
Governance contract. Must not be zero. |
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). |
getContractAddress
#
function getContractAddress(
string _name
) external view returns (
address);
Returns contract address for the given name, which might be address(0).
Parameters | Type | Description |
---|---|---|
_name |
string |
Name of the contract to query. |
Returns | Type | Description |
---|---|---|
[0] | address |
Current address for the queried contract. |
getContractAddressByHash
#
function getContractAddressByHash(
bytes32 _nameHash
) external view returns (
address);
Returns contract address for the given name hash, which might be address(0).
Parameters | Type | Description |
---|---|---|
_nameHash |
bytes32 |
Hash of the contract name: keccak256(abi.encode(name)) |
Returns | Type | Description |
---|---|---|
[0] | address |
Current address for the queried contract. |
getContractAddresses
#
function getContractAddresses(
string[] _names
) external view returns (
address[]);
Returns contract addresses for the given names, which might be address(0).
Parameters | Type | Description |
---|---|---|
_names |
string[] |
Names of the contracts to query. |
Returns | Type | Description |
---|---|---|
[0] | address[] |
Current addresses for the queried contracts. |
getContractAddressesByHash
#
function getContractAddressesByHash(
bytes32[] _nameHashes
) external view returns (
address[]);
Returns contract addresses for the given name hashes, which might be address(0).
Parameters | Type | Description |
---|---|---|
_nameHashes |
bytes32[] |
Hashes of the contract names: keccak256(abi.encode(name)) |
Returns | Type | Description |
---|---|---|
[0] | address[] |
Current addresses for the queried contracts. |
getContractNamesAndAddresses
#
function getContractNamesAndAddresses(
) external view returns (
string[] _contractNames,
address[] _contractAddresses);
Returns all contract names and corresponding addresses currently being tracked.
Returns | Type | Description |
---|---|---|
_contractNames |
string[] |
Array of contract names. |
_contractAddresses |
address[] |
Array of contract addresses. |
governance
#
function governance(
) public view returns (
address);
Returns the current effective governance
address.
removeContracts
#
function removeContracts(
string[] _contractNames
) external;
Remove contracts with given names.
Can only be called by governance
.
Parameters | Type | Description |
---|---|---|
_contractNames |
string[] |
Contract names. |
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
.
update
#
function update(
string[] _contractNames,
address[] _contractAddresses,
contract IIAddressUpdatable[] _contractsToUpdate
) external;
Set or update
contract names and addresses, and then apply changes to specific contracts.
This is a combination of addOrUpdateContractNamesAndAddresses
and updateContractAddresses
.
Can only be called by governance
.
Parameters | Type | Description |
---|---|---|
_contractNames |
string[] |
Contracts names. |
_contractAddresses |
address[] |
Addresses of corresponding contracts names. |
_contractsToUpdate |
contract IIAddressUpdatable[] |
Contracts to be updated. |
updateContractAddresses
#
function updateContractAddresses(
contract IIAddressUpdatable[] _contractsToUpdate
) external;
Updates contract addresses on specific contracts.
Can only be called by governance
.
Parameters | Type | Description |
---|---|---|
_contractsToUpdate |
contract IIAddressUpdatable[] |
Contracts to be updated, which must implement the IIAddressUpdatable interface. |
Variables#
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.