CleanupBlockNumberManager
#
Source | Inherits from Governed, AddressUpdatable
Token history cleanup manager.
Maintains the list of cleanable tokens for which history cleanup can be collectively executed.
Events#
CleanupBlockNumberSet
#
event CleanupBlockNumberSet(
contract IICleanable theContract,
uint256 blockNumber,
bool success
)
Emitted when an attempt has been made to set the cleanup block number.
Parameters | Type | Description |
---|---|---|
theContract |
contract IICleanable |
The token contract address. |
blockNumber |
uint256 |
The block number being set. |
success |
bool |
Whether it succeeded or not. |
GovernanceCallTimelocked
#
event GovernanceCallTimelocked(
bytes4 selector,
uint256 allowedAfterTimestamp,
bytes encodedCall
)
Emitted when a new governance
call has been recorded and is now waiting for the time lock to expire.
GovernanceInitialised
#
event GovernanceInitialised(
address initialGovernance
)
Emitted when the governance
address is initialized.
This address will be used until production mode is entered (see GovernedProductionModeEntered
).
At that point the governance
address is taken from GovernanceSettings
.
GovernedProductionModeEntered
#
event GovernedProductionModeEntered(
address governanceSettings
)
Emitted when governance
is enabled and the governance
address cannot be changed anymore
(only through a network fork).
RegistrationUpdated
#
event RegistrationUpdated(
contract IICleanable theContract,
bool add
)
Emitted when a new token has been registered to have its history managed by us, or an old one unregistered.
Parameters | Type | Description |
---|---|---|
theContract |
contract IICleanable |
The token contract address. |
add |
bool |
true is the token has been registered, false if unregistered. |
TimelockedGovernanceCallCanceled
#
event TimelockedGovernanceCallCanceled(
bytes4 selector,
uint256 timestamp
)
Emitted when a timelocked governance
call is canceled before execution.
TimelockedGovernanceCallExecuted
#
event TimelockedGovernanceCallExecuted(
bytes4 selector,
uint256 timestamp
)
Emitted when a timelocked governance
call is executed.
Functions#
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,
address _addressUpdater,
string _triggerContractName
) public;
Build a new instance.
Parameters | Type | Description |
---|---|---|
_governance |
address |
Contract address that can make governance calls. See Governed . |
_addressUpdater |
address |
Contract address that can update redeployable addresses. See AdressUpdatable . |
_triggerContractName |
string |
Contract name that can trigger history cleanups. |
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. |
governance
#
function governance(
) public view returns (
address);
Returns the current effective governance
address.
registerToken
#
function registerToken(
contract IICleanable _cleanableToken
) external;
Register a token contract whose history cleanup index is to be managed.
The registered contracts must allow calling setCleanupBlockNumber
.
Parameters | Type | Description |
---|---|---|
_cleanableToken |
contract IICleanable |
The address of the contract to be managed. |
setCleanUpBlockNumber
#
function setCleanUpBlockNumber(
uint256 _blockNumber
) external;
Sets clean up block number on managed cleanable tokens.
Parameters | Type | Description |
---|---|---|
_blockNumber |
uint256 |
cleanup block number |
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
.
unregisterToken
#
function unregisterToken(
contract IICleanable _cleanableToken
) external;
Unregister a token contract from history cleanup index management.
Parameters | Type | Description |
---|---|---|
_cleanableToken |
contract IICleanable |
The address of the contract to unregister. |
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.
onlyTrigger
#
modifier onlyTrigger()
Only the trigger contract can call this method.
This contract is set at construction time and updated through AddressUpdatable
.
Variables#
governanceSettings
#
contract IGovernanceSettings governanceSettings
Governance Settings.
productionMode
#
bool productionMode
When true, governance
is enabled and cannot be disabled. See switchToProductionMode
.
registeredTokens
#
contract IICleanable[] registeredTokens
Current list of token contracts being managed.
timelockedCalls
#
mapping(bytes4 => struct GovernedBase.TimelockedCall) timelockedCalls
List of pending timelocked governance
calls.
triggerContract
#
address triggerContract
Address of the contract that can trigger a cleanup.
triggerContractName
#
string triggerContractName
Name of the contract that can trigger a cleanup.
Needed to update the trigger contract address through the AddressUpdater
.