Cub

Git Source

Inherits: Proxy, ERC1967Upgrade, ICub

Author: mortimr @ Kiln

The cub is controlled by a Hatcher in charge of providing its status details and implementation address.

Unstructured Storage Friendly

Functions

___initializeCub

Initializer to not rely on the constructor.

function ___initializeCub(address beacon, bytes memory data) external;

Parameters

NameTypeDescription
beaconaddressThe address of the beacon to pull its info from
databytesThe calldata to add to the initial call, if any

_implementation

Internal utility to retrieve the implementation from the beacon.

function _implementation() internal view virtual override returns (address);

Returns

NameTypeDescription
<none>addressThe implementation address

onlyBeacon

Prevents unauthorized calls.

This will make the method transparent, forcing unauthorized callers into the fallback.

modifier onlyBeacon();

onlyMe

Prevents unauthorized calls.

This will make the method transparent, forcing unauthorized callers into the fallback.

modifier onlyMe();

appliedFixes

Public method that emits the AppliedFixes event.

Transparent to all callers except the cub itself

function appliedFixes(address[] memory fixers) public onlyMe;

Parameters

NameTypeDescription
fixersaddress[]

applyFix

Applies the provided fix.

Transparent to all callers except the hatcher

function applyFix(address fixer) external onlyBeacon;

Parameters

NameTypeDescription
fixeraddress

_fixes

Retrieve the list of fixes for this cub from the hatcher.

function _fixes(address beacon) internal view returns (address[] memory);

Parameters

NameTypeDescription
beaconaddressAddress of the hatcher acting as a beacon

Returns

NameTypeDescription
<none>address[]List of fixes to apply

_status

Retrieve the status for this cub from the hatcher.

function _status(address beacon) internal view returns (address, bool, bool);

Parameters

NameTypeDescription
beaconaddressAddress of the hatcher acting as a beacon

Returns

NameTypeDescription
<none>addressFirst value is true if fixes are pending, second value is true if cub is paused
<none>bool
<none>bool

_commit

Commits fixes to the hatcher.

function _commit(address beacon) internal;

Parameters

NameTypeDescription
beaconaddressAddress of the hatcher acting as a beacon

_fix

Fetches the current cub status and acts accordingly.

function _fix(address beacon) internal returns (address);

Parameters

NameTypeDescription
beaconaddressAddress of the hatcher acting as a beacon

_applyFix

Applies the given fix, and reverts in case of error.

function _applyFix(address fixer) internal;

Parameters

NameTypeDescription
fixeraddressAddress that implements the fix

_fallback

Fallback method that ends up forwarding calls as delegatecalls to the implementation.

function _fallback() internal override(Proxy);