UniqueRegistry
Inherits: IUniqueRegistry, ElementRegistryErrors, Initializable, Soke
State Variables
UNIQUEREGISTRY_STORAGE_LOCATION
Deterministic storage slot per ERC-7201
keccak256(abi.encode(uint256(keccak256("every.storage.UniqueRegistry")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant UNIQUEREGISTRY_STORAGE_LOCATION =
0x04dc4921879709492146fc19ec213a3e22c8a01b900b814a9bdf73ef2a847900;
Functions
_getUniqueRegistryStorage
function _getUniqueRegistryStorage() private pure returns (UniqueRegistryStorage storage $);
__UniqueRegistry_init
function __UniqueRegistry_init(uint64 idStart) internal onlyInitializing;
uniqueRegister
Registers a new unique token
function uniqueRegister(address code, bytes32 data, TokenStandard std, uint8 decimals, string memory symbol)
external
override
returns (uint64 id, Descriptor memory meta);
Parameters
Name | Type | Description |
---|---|---|
code | address | Address of the token contract |
data | bytes32 | Hash of the associated matter |
std | TokenStandard | Token standard (e.g. ERC721) |
decimals | uint8 | Number of decimals |
symbol | string | Display symbol (max 30 characters) |
Returns
Name | Type | Description |
---|---|---|
id | uint64 | ID of the new unique |
meta | Descriptor | desc Descriptor after registration |
uniqueUpdate
Updates the data hash of a unique
function uniqueUpdate(uint64 id, bytes32 data) external override returns (Descriptor memory meta);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | Unique ID |
data | bytes32 | New data hash |
Returns
Name | Type | Description |
---|---|---|
meta | Descriptor | desc Updated descriptor |
uniqueUpdate
Updates the data hash of a unique
function uniqueUpdate(uint64 id, bytes32 data, string memory symbol)
external
override
returns (Descriptor memory meta);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | Unique ID |
data | bytes32 | New data hash |
symbol | string |
Returns
Name | Type | Description |
---|---|---|
meta | Descriptor | desc Updated descriptor |
uniqueUpgrade
Upgrades the kind and/or set revision of a unique
function uniqueUpgrade(uint64 id, uint32 kindRev0, uint32 setRev0) external override returns (Descriptor memory meta);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | Unique ID |
kindRev0 | uint32 | |
setRev0 | uint32 |
Returns
Name | Type | Description |
---|---|---|
meta | Descriptor | desc Descriptor after upgrade |
uniqueTouch
Bumps the revision of a unique with no content change
function uniqueTouch(uint64 id) external override returns (Descriptor memory meta);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | Unique ID |
Returns
Name | Type | Description |
---|---|---|
meta | Descriptor | desc Descriptor after touch |
uniqueTransfer
Transfers ownership of a unique token
function uniqueTransfer(uint64 id, address to) external override returns (address from);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | Unique ID |
to | address | Address of the new owner |
Returns
Name | Type | Description |
---|---|---|
from | address | Address of the previous owner |
uniqueRevision
Resolves and validates a revision
function uniqueRevision(uint64 id, uint32 rev0) external view override returns (uint32 rev);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | Unique ID |
rev0 | uint32 | Requested revision (0 = latest) |
Returns
Name | Type | Description |
---|---|---|
rev | uint32 | Resolved revision (0 = not found) |
uniqueDescriptor
Returns the descriptor at a given revision
function uniqueDescriptor(uint64 id, uint32 rev0) external view override returns (Descriptor memory desc);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | Unique ID |
rev0 | uint32 | Revision to query (0 = latest) |
Returns
Name | Type | Description |
---|---|---|
desc | Descriptor | Descriptor at the specified revision |
uniqueSnapshot
Returns descriptor and elements at a specific revision
function uniqueSnapshot(uint64 id, uint32 rev0)
external
view
override
returns (Descriptor memory desc, bytes32[] memory elems);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | Unique ID |
rev0 | uint32 | Revision to query (0 = latest) |
Returns
Name | Type | Description |
---|---|---|
desc | Descriptor | Descriptor at the revision |
elems | bytes32[] | Elements at the revision |
uniqueOwner
Returns the current owner of a unique
function uniqueOwner(uint64 id) external view override returns (address owner);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | Unique ID |
Returns
Name | Type | Description |
---|---|---|
owner | address | Address of the current owner |
uniqueSota
Returns the latest descriptor and current owner
function uniqueSota(uint64 id) external view override returns (Descriptor memory desc, address owner);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | Unique ID |
Returns
Name | Type | Description |
---|---|---|
desc | Descriptor | Latest descriptor |
owner | address | Address of the current owner |
uniqueStatus
function uniqueStatus(uint64[] memory ids) external view override returns (bool active);
_register
function _register(
uint64 id,
address code,
bytes32 data,
TokenStandard std,
uint8 decimals,
bytes30 symbol,
address owner
) private returns (Descriptor memory meta);
_kindOfUniqueRevision
Returns the latest revision of the Kind-of-Value object
function _kindOfUniqueRevision() private view returns (uint32);
_setOfUniqueRevision
Returns the latest revision of the Set-of-Value object
function _setOfUniqueRevision() private view returns (uint32);
Structs
UniqueRegistryStorage
Note: storage-location: erc7201:every.storage.UniqueRegistry
struct UniqueRegistryStorage {
Counter48.Counter counter;
Snapshots.Storage uniques;
}