Skip to main content

Documentation

Hashgraph Asset Tokenization

Documentation

Manages the lifecycle and retrieval of token-related documentation.

Provides the abstract implementation of IDocumentation for diamond facets. Write operations require an operational, activated and unpaused token, and are restricted to authorised documenters. Document data is persisted through DocumentationStorageWrapper, while timestamps are resolved through TimeTravelStorageWrapper to support deterministic test execution.

Methods​

getAllDocuments​

function getAllDocuments() external view returns (bytes32[])

Returns the names of all documents currently attached to the contract.

The returned ordering follows storage order and may change after removals.

Returns​

NameTypeDescription
_0bytes32[]Array of bytes32 document names.

getDocument​

function getDocument(bytes32 _name) external view returns (string, bytes32, uint256)

Returns the URI, content hash, and last-modified timestamp of a document.

Parameters​

NameTypeDescription
_namebytes32Unique bytes32 identifier of the document to query.

Returns​

NameTypeDescription
_0stringOff-chain URI of the document.
_1bytes32Keccak-256 content hash of the document.
_2uint256Unix timestamp of the last write operation on this document.

initializeDocumentation​

function initializeDocumentation() external nonpayable

Initialises the documentation capability on the token.

Registers this facet as ready and emits DocumentationInitialized.

removeDocument​

function removeDocument(bytes32 _name) external nonpayable

Removes an existing document from the contract.

Requires DOCUMENTER_ROLE and an existing document on an operational, activated and unpaused token. Emits DocumentRemoved.

Parameters​

NameTypeDescription
_namebytes32Unique bytes32 identifier of the document to remove.

setDocument​

function setDocument(bytes32 _name, string _uri, bytes32 _documentHash) external nonpayable

Attaches a new document to the contract or updates the URI and hash of an existing one.

Requires ROLE_DOCUMENTER, an operational and activated token, and a non-empty name, URI and hash. Emits DocumentUpdated.

Parameters​

NameTypeDescription
_namebytes32Unique bytes32 identifier for the document. Must not be zero.
_uristringOff-chain URI of the document. Must not be empty.
_documentHashbytes32Keccak-256 content hash of the document. Must not be zero.

Events​

DocumentRemoved​

event DocumentRemoved(bytes32 indexed name, string uri, bytes32 documentHash)

Emitted when a document is permanently removed from the contract.

Parameters​

NameTypeDescription
name indexedbytes32Unique identifier of the document that was removed.
uristringOff-chain URI that was associated with the document.
documentHashbytes32Content hash that was associated with the document.

DocumentUpdated​

event DocumentUpdated(bytes32 indexed name, string uri, bytes32 documentHash)

Emitted when a document is created or its URI or hash is updated.

Parameters​

NameTypeDescription
name indexedbytes32Unique identifier of the document that was set or updated.
uristringOff-chain URI now associated with the document.
documentHashbytes32Content hash now associated with the document.

DocumentationInitialized​

event DocumentationInitialized()

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

Fires exclusively from initializeDocumentation.

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.

DocumentDoesNotExist​

error DocumentDoesNotExist(bytes32 name)

Raised when an operation targets a document name that has not been registered.

Parameters​

NameTypeDescription
namebytes32The document name that could not be found in storage.

EmptyHASH​

error EmptyHASH()

Raised when setDocument is called with a zero-value document hash.

A zero hash provides no integrity guarantee and is therefore disallowed.

EmptyName​

error EmptyName()

Raised when setDocument is called with a zero-value document name.

A bytes32(0) name is rejected to prevent silent collisions in storage.

EmptyURI​

error EmptyURI()

Raised when setDocument is called with an empty URI string.

An empty URI would produce an unresolvable document reference.

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.