SetRegistry
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
Name | Type | Description |
---|---|---|
data | bytes32 | Hash of external content (e.g. metadata or schema) |
Returns
Name | Type | Description |
---|---|---|
id | uint64 | ID of the new set |
desc | Descriptor | Descriptor after registration |
setUpdate
Updates the data hash of an existing set
function setUpdate(bytes32 data) external override returns (uint64 id, Descriptor memory desc);
Parameters
Name | Type | Description |
---|---|---|
data | bytes32 | New data hash |
Returns
Name | Type | Description |
---|---|---|
id | uint64 | ID of the updated set |
desc | Descriptor | Updated descriptor |
setUpgrade
Upgrades the kind or set revision
function setUpgrade(uint32 kindRev, uint32 setRev) external override returns (uint64 id, Descriptor memory desc);
Parameters
Name | Type | Description |
---|---|---|
kindRev | uint32 | New kind revision (0 to skip) |
setRev | uint32 | New set revision (0 to skip) |
Returns
Name | Type | Description |
---|---|---|
id | uint64 | ID of the set |
desc | Descriptor | Descriptor after upgrade |
setTouch
Touches a set (increments revision without any changes)
function setTouch() external override returns (uint64 id, Descriptor memory desc);
Returns
Name | Type | Description |
---|---|---|
id | uint64 | ID of the set |
desc | Descriptor | Descriptor after touch |
setRevision
Resolves and validates a specific revision
function setRevision(uint64 id, uint32 rev0) external view override returns (uint32 rev);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | Set ID |
rev0 | uint32 | Requested revision (0 = latest) |
Returns
Name | Type | Description |
---|---|---|
rev | uint32 | Validated 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
Name | Type | Description |
---|---|---|
id | uint64 | Set ID |
rev0 | uint32 | Revision to query (0 = latest) |
Returns
Name | Type | Description |
---|---|---|
desc | Descriptor | Descriptor 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
Name | Type | Description |
---|---|---|
id | uint64 | Set ID |
rev | uint32 |
Returns
Name | Type | Description |
---|---|---|
desc | Descriptor | Descriptor at the revision |
elems | bytes32[] | Packed element list |
setOwner
Returns the current owner of a set
function setOwner(uint64 id) external view override returns (address owner);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | Set ID |
Returns
Name | Type | Description |
---|---|---|
owner | address | Owner address |
setSota
Returns the latest descriptor and current owner
function setSota(uint64 id) external view override returns (Descriptor memory desc, address owner);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | Set ID |
Returns
Name | Type | Description |
---|---|---|
desc | Descriptor | Latest descriptor |
owner | address | Current owner |
setStatus
Checks whether all provided set IDs are active
function setStatus(uint64[] memory ids) external view override returns (bool active);
Parameters
Name | Type | Description |
---|---|---|
ids | uint64[] | List of set IDs |
Returns
Name | Type | Description |
---|---|---|
active | bool | True 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
Name | Type | Description |
---|---|---|
id | uint64 | Set ID |
Returns
Name | Type | Description |
---|---|---|
code | address | Address 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;
}