SetRegistry

Git Source

Inherits: ISetRegistry, SetRegistryErrors, OwnableUpgradeable, UUPSUpgradeable, Soke

Set registration and management

State Variables

SETREGISTRY_STORAGE_LOCATION

Deterministic storage slot per ERC-7201

keccak256(abi.encode(uint256(keccak256("every.storage.SetRegistry")) - 1)) & ~bytes32(uint256(0xff))

bytes32 private constant SETREGISTRY_STORAGE_LOCATION =
    0xb8684b9e6721af0d1bdda1cb8f0f025a168f1333cb4134fd73b30bed06876100;

Functions

_getSetRegistryStorage

function _getSetRegistryStorage() private pure returns (SetRegistryStorage storage $);

_authorizeUpgrade

function _authorizeUpgrade(address newImplementation) internal virtual override onlyOwner;

semver

function semver() external pure returns (uint32 version);

initialize

function initialize(address owner, address omnir, address kindr, address elemr) public initializer;

setRegister

Registers a new set

function setRegister(bytes32 data) external override returns (uint64 id, Descriptor memory desc);

Parameters

NameTypeDescription
databytes32Hash of external content (e.g. metadata or schema)

Returns

NameTypeDescription
iduint64ID of the new set
descDescriptorDescriptor after registration

setUpdate

Updates the data hash of an existing set

function setUpdate(bytes32 data) external override returns (uint64 id, Descriptor memory desc);

Parameters

NameTypeDescription
databytes32New data hash

Returns

NameTypeDescription
iduint64ID of the updated set
descDescriptorUpdated descriptor

setUpgrade

Upgrades the kind or set revision

function setUpgrade(uint32 kindRev, uint32 setRev) external override returns (uint64 id, Descriptor memory desc);

Parameters

NameTypeDescription
kindRevuint32New kind revision (0 to skip)
setRevuint32New set revision (0 to skip)

Returns

NameTypeDescription
iduint64ID of the set
descDescriptorDescriptor after upgrade

setTouch

Touches a set (increments revision without any changes)

function setTouch() external override returns (uint64 id, Descriptor memory desc);

Returns

NameTypeDescription
iduint64ID of the set
descDescriptorDescriptor after touch

setRevision

Resolves and validates a specific revision

function setRevision(uint64 id, uint32 rev0) external view override returns (uint32 rev);

Parameters

NameTypeDescription
iduint64Set ID
rev0uint32Requested revision (0 = latest)

Returns

NameTypeDescription
revuint32Validated revision (0 if not found)

setDescriptor

Returns the descriptor at a given revision

function setDescriptor(uint64 id, uint32 rev0) external view override returns (Descriptor memory desc);

Parameters

NameTypeDescription
iduint64Set ID
rev0uint32Revision to query (0 = latest)

Returns

NameTypeDescription
descDescriptorDescriptor of the set at the specified revision

setSnapshot

Returns descriptor and elements of a set at a specific revision

function setSnapshot(uint64 id, uint32 rev)
    external
    view
    override
    returns (Descriptor memory desc, bytes32[] memory elems);

Parameters

NameTypeDescription
iduint64Set ID
revuint32

Returns

NameTypeDescription
descDescriptorDescriptor at the revision
elemsbytes32[]Packed element list

setOwner

Returns the current owner of a set

function setOwner(uint64 id) external view override returns (address owner);

Parameters

NameTypeDescription
iduint64Set ID

Returns

NameTypeDescription
owneraddressOwner address

setSota

Returns the latest descriptor and current owner

function setSota(uint64 id) external view override returns (Descriptor memory desc, address owner);

Parameters

NameTypeDescription
iduint64Set ID

Returns

NameTypeDescription
descDescriptorLatest descriptor
owneraddressCurrent owner

setStatus

Checks whether all provided set IDs are active

function setStatus(uint64[] memory ids) external view override returns (bool active);

Parameters

NameTypeDescription
idsuint64[]List of set IDs

Returns

NameTypeDescription
activeboolTrue if all sets have a revision > 0

setContract

Returns the contract address associated with a set

function setContract(uint64 id) external view override returns (address code);

Parameters

NameTypeDescription
iduint64Set ID

Returns

NameTypeDescription
codeaddressAddress of the deployed contract

_validateHolder

Validates that the caller is the owner of the set

function _validateHolder(uint64 id) private view;

_kindOfSetRevision

Returns the latest revision of the Kind-of-Set object

function _kindOfSetRevision() private view returns (uint32);

_setOfSetRevision

Returns the latest revision of the Set-of-Set object

function _setOfSetRevision() private view returns (uint32);

_regsiterSet

function _regsiterSet(uint64 id, uint32 kindRev, uint32 setRev, address code, bytes32 data, address owner)
    private
    returns (Descriptor memory desc);

_regsiterSetEmit

function _regsiterSetEmit(uint64 id, uint32 kindRev, uint32 setRev, address code, bytes32 data, address owner)
    private
    returns (Descriptor memory desc);

_validateSetContract

function _validateSetContract(address c) private view;

Structs

SetRegistryStorage

Note: storage-location: erc7201:every.storage.SetRegistry

struct SetRegistryStorage {
    Counter48.Counter counter;
    Snapshots.Storage sets;
    mapping(address => uint64) contracts;
}