SetRegistryHook

Git Source

Inherits: ISetRegistryHook

Base implementation of ISetRegistryHook for handling set lifecycle callbacks.

Updates the SetContext during set registration, upgrades, and touches. Intended to be inherited by set contracts to handle automatic context tracking.

Functions

constructor

Constructs the hook and sets the SetRegistry address in context.

constructor(address setRegistry);

Parameters

NameTypeDescription
setRegistryaddressAddress of the SetRegistry contract.

onlySetRegistry

Restricts access to only the configured SetRegistry.

modifier onlySetRegistry();

onSetRegister

Called before a set is registered.

function onSetRegister(uint64 set, Descriptor memory od) external virtual override onlySetRegistry returns (bytes4);

Parameters

NameTypeDescription
setuint64Set ID being registered.
odDescriptorInitial descriptor of the set.

Returns

NameTypeDescription
<none>bytes4selector Must return onSetRegister.selector to confirm the action.

onSetUpdate

Called before a set is updated.

function onSetUpdate(uint64 set, Descriptor memory od) external virtual override onlySetRegistry returns (bytes4);

Parameters

NameTypeDescription
setuint64Set ID being updated.
odDescriptorUpdated descriptor of the set.

Returns

NameTypeDescription
<none>bytes4selector Must return onSetUpdate.selector to confirm the action.

onSetUpgrade

Called before a set is upgraded.

function onSetUpgrade(uint64 set, Descriptor memory od) external virtual override onlySetRegistry returns (bytes4);

Parameters

NameTypeDescription
setuint64Set ID being upgraded.
odDescriptorDescriptor of the set after the upgrade.

Returns

NameTypeDescription
<none>bytes4selector Must return onSetUpgrade.selector to confirm the action.

onSetTouch

Called before a set is touched (bumped revision with no content change).

function onSetTouch(uint64 set, Descriptor memory od) external virtual override onlySetRegistry returns (bytes4);

Parameters

NameTypeDescription
setuint64Set ID being touched.
odDescriptorDescriptor of the set after the touch.

Returns

NameTypeDescription
<none>bytes4selector Must return onSetTouch.selector to confirm the action.

supportsInterface

Returns true if this contract implements the interface defined by interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] to learn more about how these ids are created. This function call must use less than 30 000 gas.

function supportsInterface(bytes4 interfaceId) external pure virtual override returns (bool supported);

Errors

CallerNotSetRegistry

error CallerNotSetRegistry();