IHatcher
Inherits: IBeacon
Author: mortimr @ Kiln
The Hatcher can deploy, upgrade, fix and pause a set of instances called cubs. All cubs point to the same coomon implementation.
Unstructured Storage Friendly
Functions
implementation
Retrieve the common implementation.
function implementation() external view returns (address implementationAddress);
Returns
| Name | Type | Description |
|---|---|---|
implementationAddress | address | Address of the common implementation |
status
Retrieve cub status details.
function status(address cub) external view returns (address implementationAddress, bool hasFixes, bool isPaused);
Parameters
| Name | Type | Description |
|---|---|---|
cub | address | The address of the cub to fetch the status of |
Returns
| Name | Type | Description |
|---|---|---|
implementationAddress | address | The current implementation address to use |
hasFixes | bool | True if there are fixes to apply |
isPaused | bool | True if the system is paused globally or the calling cub is paused |
initialProgress
Retrieve the initial progress.
This value is the starting progress value for all new cubs
function initialProgress() external view returns (uint256 currentInitialProgress);
Returns
| Name | Type | Description |
|---|---|---|
currentInitialProgress | uint256 | The initial progress |
progress
Retrieve the current progress of a specific cub.
function progress(address cub) external view returns (uint256 currentProgress);
Parameters
| Name | Type | Description |
|---|---|---|
cub | address | Address of the cub |
Returns
| Name | Type | Description |
|---|---|---|
currentProgress | uint256 | The current progress of the cub |
globalPaused
Retrieve the global pause status.
function globalPaused() external view returns (bool isGlobalPaused);
Returns
| Name | Type | Description |
|---|---|---|
isGlobalPaused | bool | True if globally paused |
paused
Retrieve a cub pause status.
function paused(address cub) external view returns (bool isPaused);
Parameters
| Name | Type | Description |
|---|---|---|
cub | address | Address of the cub |
Returns
| Name | Type | Description |
|---|---|---|
isPaused | bool | True if paused |
pauser
Retrieve the address of the pauser.
function pauser() external view returns (address);
fixes
Retrieve a cub's global fixes that need to be applied, taking its progress into account.
function fixes(address cub) external view returns (address[] memory fixesAddresses);
Parameters
| Name | Type | Description |
|---|---|---|
cub | address | Address of the cub |
Returns
| Name | Type | Description |
|---|---|---|
fixesAddresses | address[] | An array of addresses that implement fixes |
globalFixes
Retrieve the raw list of global fixes.
function globalFixes() external view returns (address[] memory globalFixesAddresses);
Returns
| Name | Type | Description |
|---|---|---|
globalFixesAddresses | address[] | An array of addresses that implement the global fixes |
nextHatch
Retrieve the address of the next hatched cub.
function nextHatch() external view returns (address nextHatchedCub);
Returns
| Name | Type | Description |
|---|---|---|
nextHatchedCub | address | The address of the next cub |
frozen
Retrieve the freeze status.
function frozen() external view returns (bool);
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | True if frozen |
freezeTime
Retrieve the timestamp when the freeze happens.
function freezeTime() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The freeze timestamp |
hatch
Creates a new cub.
function hatch(bytes calldata cdata) external returns (address cubAddress);
Parameters
| Name | Type | Description |
|---|---|---|
cdata | bytes | The calldata to use for the initial atomic call |
Returns
| Name | Type | Description |
|---|---|---|
cubAddress | address | The address of the new cub |
hatch
Creates a new cub, without calldata.
function hatch() external returns (address cubAddress);
Returns
| Name | Type | Description |
|---|---|---|
cubAddress | address | The address of the new cub |
commitFixes
Sets the progress of the caller to the current global fixes array length.
function commitFixes() external;
setPauser
Sets the address of the pauser.
function setPauser(address newPauser) external;
Parameters
| Name | Type | Description |
|---|---|---|
newPauser | address | Address of the new pauser |
applyFixToCubs
Apply a fix to several cubs.
function applyFixToCubs(address fixer, address[] calldata cubs) external;
Parameters
| Name | Type | Description |
|---|---|---|
fixer | address | Fixer contract implementing the fix |
cubs | address[] | List of cubs to apply the fix on |
applyFixesToCub
Apply several fixes to one cub.
function applyFixesToCub(address cub, address[] calldata fixers) external;
Parameters
| Name | Type | Description |
|---|---|---|
cub | address | The cub to apply the fixes on |
fixers | address[] | List of fixer contracts implementing the fixes |
registerGlobalFix
Register a new global fix for cubs to call asynchronously.
function registerGlobalFix(address fixer) external;
Parameters
| Name | Type | Description |
|---|---|---|
fixer | address | Address of the fixer implementing the fix |
deleteGlobalFix
Deletes a global fix from the array.
function deleteGlobalFix(uint256 index) external;
Parameters
| Name | Type | Description |
|---|---|---|
index | uint256 | Index of the global fix to remove |
upgradeTo
Upgrades the common implementation address.
function upgradeTo(address newImplementation) external;
Parameters
| Name | Type | Description |
|---|---|---|
newImplementation | address | Address of the new common implementation |
upgradeToAndChangeInitialProgress
Upgrades the common implementation address and the initial progress value.
function upgradeToAndChangeInitialProgress(address newImplementation, uint256 initialProgress_) external;
Parameters
| Name | Type | Description |
|---|---|---|
newImplementation | address | Address of the new common implementation |
initialProgress_ | uint256 | The new initial progress value |
setInitialProgress
Sets the initial progress value.
function setInitialProgress(uint256 initialProgress_) external;
Parameters
| Name | Type | Description |
|---|---|---|
initialProgress_ | uint256 | The new initial progress value |
setCubProgress
Sets the progress of a cub.
function setCubProgress(address cub, uint256 newProgress) external;
Parameters
| Name | Type | Description |
|---|---|---|
cub | address | Address of the cub |
newProgress | uint256 | New progress value |
pauseCubs
Pauses a set of cubs.
function pauseCubs(address[] calldata cubs) external;
Parameters
| Name | Type | Description |
|---|---|---|
cubs | address[] | List of cubs to pause |
unpauseCubs
Unpauses a set of cubs.
function unpauseCubs(address[] calldata cubs) external;
Parameters
| Name | Type | Description |
|---|---|---|
cubs | address[] | List of cubs to unpause |
globalPause
Pauses all the cubs of the system.
function globalPause() external;
globalUnpause
Unpauses all the cubs of the system.
If a cub was specifically paused, this method won't unpause it
function globalUnpause() external;
freeze
Sets the freeze timestamp.
function freeze(uint256 freezeTimeout) external;
Parameters
| Name | Type | Description |
|---|---|---|
freezeTimeout | uint256 | The timeout to add to current timestamp before freeze happens |
cancelFreeze
Cancels the freezing procedure.
function cancelFreeze() external;
Events
GlobalPause
Emitted when the system is globally paused.
event GlobalPause();
GlobalUnpause
Emitted when the system is globally unpaused.
event GlobalUnpause();
Pause
Emitted when a specific cub is paused.
event Pause(address cub);
Unpause
Emitted when a specific cub is unpaused.
event Unpause(address cub);
DeletedGlobalFix
Emitted when a global fix is removed.
event DeletedGlobalFix(uint256 index);
AppliedFix
Emitted when a cub has properly applied a fix.
event AppliedFix(address cub, address fix);
Upgraded
Emitted the common implementation is updated.
event Upgraded(address indexed implementation);
Hatched
Emitted a new cub is hatched.
event Hatched(address indexed cub, bytes cdata);
SetInitialProgress
Emitted a the initial progress has been changed.
event SetInitialProgress(uint256 initialProgress);
SetPauser
Emitted a new pauser is set.
event SetPauser(address pauser);
CommittedFixes
Emitted a cub committed some global fixes.
event CommittedFixes(address cub, uint256 progress);
RegisteredGlobalFix
Emitted a global fix is registered.
event RegisteredGlobalFix(address fix, uint256 index);
Errors
ImplementationNotAContract
The provided implementation is not a smart contract.
error ImplementationNotAContract(address implementation);