Skip to main content

CustomDataFacet

Asset Tokenization Studio Team

CustomDataFacet

Diamond facet that exposes the key/value custom data operations — set and get — as selectable proxy functions.

Inherits CustomData for the business logic and implements IStaticFunctionSelectors for the Diamond resolver pattern. The resolver key RESOLVER_KEY_CUSTOM_DATA identifies this facet within the diamond proxy.

Methods​

getCustomData​

function getCustomData(bytes32 _key) external view returns (bytes[] value_)

Returns the ordered list of byte payloads associated with _key.

Returns an empty array if the key has never been set or has been cleared. Read-only; no access control.

Parameters​

NameTypeDescription
_keybytes32The custom data key to query.

Returns​

NameTypeDescription
value_bytes[]The ordered list of byte payloads stored under _key, or an empty array if unset.

getStaticFunctionSelectors​

function getStaticFunctionSelectors() external pure returns (bytes4[])

Gets all function selectors of a facet

Returns​

NameTypeDescription
_0bytes4[]Face functions selectors

getStaticInterfaceIds​

function getStaticInterfaceIds() external pure returns (bytes4[])

Gets all interfaces ids of a facet.

Returns​

NameTypeDescription
_0bytes4[]Face interface ids

getStaticResolverKey​

function getStaticResolverKey() external pure returns (bytes32 staticResolverKey_)

Gets the static resolver key

Returns​

NameTypeDescription
staticResolverKey_bytes32Static resolver key

initializeCustomData​

function initializeCustomData(ICustomData.CustomDataEntry[] _entries) external nonpayable

Parameters​

NameTypeDescription
_entriesICustomData.CustomDataEntry[]undefined

setCustomData​

function setCustomData(bytes32 _key, bytes[] _value) external nonpayable

Sets the ordered list of byte payloads associated with _key, replacing any previously stored value.

Requires ROLE_CUSTOM_DATA_MANAGER and the token to be unpaused. Delegates persistence to CustomDataStorageWrapper.setCustomData, which overwrites any existing array, then emits CustomDataSet.

Parameters​

NameTypeDescription
_keybytes32The custom data key under which to store the value.
_valuebytes[]The ordered list of byte payloads to associate with the key.

setCustomDataBatch​

function setCustomDataBatch(ICustomData.CustomDataEntry[] _entries) external nonpayable

Parameters​

NameTypeDescription
_entriesICustomData.CustomDataEntry[]undefined

Events​

CustomDataBatchSet​

event CustomDataBatchSet(ICustomData.CustomDataEntry[] entries)

Emitted once when multiple key/value entries are written atomically via setCustomDataBatch.

Fires once per setCustomDataBatch call, after all entries have been persisted. Does NOT fire from initializeCustomData, which emits CustomDataInitialized instead. Each entry in entries follows the same full-overwrite semantics as setCustomData; an empty inner array clears that key.

Parameters​

NameTypeDescription
entriesICustomData.CustomDataEntry[]The list of key/value pairs written in this batch call.

CustomDataInitialized​

event CustomDataInitialized(ICustomData.CustomDataEntry[] entries)

Emitted once when the metadata capability is initialised on a token.

Fires exclusively from initializeCustomData, after all seed entries have been written.

Parameters​

NameTypeDescription
entriesICustomData.CustomDataEntry[]The list of key/value pairs seeded at initialisation time, or an empty array if no seed data was provided.

CustomDataSet​

event CustomDataSet(bytes32 indexed key, bytes[] value)

Emitted whenever the value stored under key is set or replaced by setCustomData.

Fires once per setCustomData call. Does NOT fire from setCustomDataBatch or initializeCustomData. The emitted value is the full replacement array; an empty array signals the key was cleared.

Parameters​

NameTypeDescription
key indexedbytes32The custom data key whose value was set.
valuebytes[]The ordered list of byte payloads now stored under key.

Errors​

AccountHasNoRole​

error AccountHasNoRole(address account, bytes32 role)

Thrown when an account does not hold a required role.

Parameters​

NameTypeDescription
accountaddressThe account that lacks the role.
rolebytes32The role that is not held.

AssetNotOperational​

error AssetNotOperational(bytes32 configId, uint256 versionId)

Raised by InitializerStorageWrapper.checkOperational (and the related isConfigVersionOperational helper) when an operation is attempted on a configuration version that has not yet been marked operational.

Parameters​

NameTypeDescription
configIdbytes32Resolver-proxy configuration whose operational status was checked.
versionIduint256Configuration version whose operational status was checked.

Deactivated​

error Deactivated()

Thrown when an operation guarded by onlyActivated is attempted on a token whose deactivation flag has already been set.

FacetAlreadyRegistered​

error FacetAlreadyRegistered(bytes32 facetId, uint256 lastVersion)

Raised when an initialiser tries to register a facet that already has a non-zero last registered version (i.e. the facet is being re-initialised on a fresh install).

Parameters​

NameTypeDescription
facetIdbytes32Identifier of the offending facet.
lastVersionuint256Last version recorded for that facet at the time of the check.

IsPaused​

error IsPaused()

Thrown when an operation that requires the token to be unpaused is attempted while the token is paused (own flag or any external pause contract).

UnrecognizedResolverProxyVersion​

error UnrecognizedResolverProxyVersion(bytes8 _resolverProxyVersion)

Thrown when the provided proxy version does not match any BLR compatible standard.

Parameters​

NameTypeDescription
_resolverProxyVersionbytes8proxy version that is not compatible with the BLR.

WalletRecovered​

error WalletRecovered()

Thrown when attempting to recover a wallet that has already been recovered.