ValueRegistry
Inherits: IValueRegistry, ElementRegistryErrors, Initializable, Soke
State Variables
VALUEREGISTRY_STORAGE_LOCATION
Deterministic storage slot per ERC-7201
keccak256(abi.encode(uint256(keccak256("every.storage.ValueRegistry")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant VALUEREGISTRY_STORAGE_LOCATION =
0x7e2fb0066d5c30a775c561af98650c8a5856bdd87a1fa6e7b509179e09d6c200;
Functions
_getValueRegistryStorage
function _getValueRegistryStorage() private pure returns (ValueRegistryStorage storage $);
__ValueRegistry_init
function __ValueRegistry_init(uint64 idStart, address owner, bytes32 data, uint8 decimals, string memory symbol)
internal
onlyInitializing;
valueRegister
Registers a new value token
function valueRegister(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 | Token contract address |
data | bytes32 | Hash of the underlying matter or metadata |
std | TokenStandard | Token standard (e.g. ERC20) |
decimals | uint8 | Token's decimal precision |
symbol | string | Display symbol (max 30 characters) |
Returns
Name | Type | Description |
---|---|---|
id | uint64 | New value ID |
meta | Descriptor | desc Descriptor after registration |
valueUpdate
Updates the data hash of an existing value
function valueUpdate(uint64 id, bytes32 data) external override returns (Descriptor memory meta);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | Value ID |
data | bytes32 | New data hash |
Returns
Name | Type | Description |
---|---|---|
meta | Descriptor | desc Updated descriptor (revision bumped) |
valueUpdate
Updates the data hash of an existing value
function valueUpdate(uint64 id, bytes32 data, string memory symbol)
external
override
returns (Descriptor memory meta);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | Value ID |
data | bytes32 | New data hash |
symbol | string |
Returns
Name | Type | Description |
---|---|---|
meta | Descriptor | desc Updated descriptor (revision bumped) |
valueUpgrade
Upgrades the kind/set revision of a value
function valueUpgrade(uint64 id, uint32 kindRev0, uint32 setRev0) external override returns (Descriptor memory meta);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | Value ID |
kindRev0 | uint32 | New kind revision (0 = no change) |
setRev0 | uint32 | New set revision (0 = no change) |
Returns
Name | Type | Description |
---|---|---|
meta | Descriptor | desc Descriptor after upgrade |
valueTouch
Touches a value, bumping its revision without changing its content
function valueTouch(uint64 id) external override returns (Descriptor memory meta);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | Value ID |
Returns
Name | Type | Description |
---|---|---|
meta | Descriptor | desc Descriptor after touch |
valueTransfer
Transfers ownership of a value to a new address
function valueTransfer(uint64 id, address to) external override returns (address from);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | Value ID |
to | address | Address to transfer ownership to |
Returns
Name | Type | Description |
---|---|---|
from | address | Address of the previous owner |
valueRevision
Resolves and validates a revision of a value
function valueRevision(uint64 id, uint32 rev0) external view override returns (uint32 rev);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | Value ID |
rev0 | uint32 | Requested revision (0 = latest) |
Returns
Name | Type | Description |
---|---|---|
rev | uint32 | Validated revision (0 = not found) |
valueDescriptor
Returns the descriptor of a value at a specific revision
function valueDescriptor(uint64 id, uint32 rev0) external view override returns (Descriptor memory desc);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | Value ID |
rev0 | uint32 | Revision to query (0 = latest) |
Returns
Name | Type | Description |
---|---|---|
desc | Descriptor | Descriptor at the given revision |
valueSnapshot
Returns descriptor and elements of a value at a specific revision
function valueSnapshot(uint64 id, uint32 rev0)
external
view
override
returns (Descriptor memory desc, bytes32[] memory elems);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | Value ID |
rev0 | uint32 | Revision to query (0 = latest) |
Returns
Name | Type | Description |
---|---|---|
desc | Descriptor | Descriptor at the given revision |
elems | bytes32[] | Element values at the given revision |
valueOwner
Returns the current owner of a value
function valueOwner(uint64 id) external view override returns (address owner);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | Value ID |
Returns
Name | Type | Description |
---|---|---|
owner | address | Current owner's address |
valueSota
Returns the latest descriptor and current owner of a value
function valueSota(uint64 id) external view override returns (Descriptor memory desc, address owner);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | Value ID |
Returns
Name | Type | Description |
---|---|---|
desc | Descriptor | Latest descriptor |
owner | address | Current owner's address |
valueStatus
Checks whether all specified values are active (revision > 0)
function valueStatus(uint64[] memory ids) external view override returns (bool active);
Parameters
Name | Type | Description |
---|---|---|
ids | uint64[] | Array of value IDs |
Returns
Name | Type | Description |
---|---|---|
active | bool | True if all values exist and are active |
_register
function _register(
uint64 id,
address code,
bytes32 data,
TokenStandard std,
uint8 decimals,
string memory symbol,
address owner
) private returns (Descriptor memory);
_kindOfValueRevision
Returns the latest revision of the Kind-of-Value object
function _kindOfValueRevision() private view returns (uint32);
_setOfValueRevision
Returns the latest revision of the Set-of-Value object
function _setOfValueRevision() private view returns (uint32);
Structs
ValueRegistryStorage
Note: storage-location: erc7201:every.storage.ValueRegistry
struct ValueRegistryStorage {
Counter48.Counter counter;
Snapshots.Storage values;
}