DocumentCoreFacet
Handles basic document registration and retrieval
Core facet for DocumentRegistry diamond
Functions
registerDocument
Registers a new document entry
function registerDocument(bytes32 hash, string calldata uri, bool isTemplate, bytes32 templateHash)
external
returns (bytes32);
Parameters
hash
bytes32
The hash of the document
uri
string
The URI pointing to the document location
isTemplate
bool
Whether this is a template
templateHash
bytes32
If not a template, the hash of template used
getDocument
Gets document details
function getDocument(bytes32 hash, address owner)
external
view
returns (
bytes32 documentHash,
string memory uri,
address documentOwner,
uint256 timestamp,
bool isActive,
bool isTemplate,
bytes32 templateHash,
IDocumentRegistry.SigningStatus status,
uint256 expirationTime
);
Parameters
hash
bytes32
The document hash
owner
address
The document owner
Returns
documentHash
bytes32
The document hash
uri
string
The document URI
documentOwner
address
The document owner
timestamp
uint256
The document timestamp
isActive
bool
Whether the document is active
isTemplate
bool
Whether the document is a template
templateHash
bytes32
The template hash
status
IDocumentRegistry.SigningStatus
expirationTime
uint256
getDocumentsByOwner
Gets all document hashes owned by an address
function getDocumentsByOwner(address owner) external view returns (bytes32[] memory);
Parameters
owner
address
The address to query
Returns
<none>
bytes32[]
Array of document hashes
deactivateDocument
Deactivate a document
function deactivateDocument(bytes32 hash) external;
Parameters
hash
bytes32
The document hash
reactivateDocument
Reactivate a document
function reactivateDocument(bytes32 hash) external;
Parameters
hash
bytes32
The document hash
documentExists
Check if a document exists
function documentExists(bytes32 hash, address owner) external view returns (bool exists);
Parameters
hash
bytes32
The document hash
owner
address
The document owner
Returns
exists
bool
Whether the document exists
Events
DocumentRegistered
event DocumentRegistered(
bytes32 indexed hash, string uri, address indexed owner, bool isTemplate, bytes32 templateHash
);
DocumentDeactivated
event DocumentDeactivated(bytes32 indexed hash, address indexed owner);
DocumentReactivated
event DocumentReactivated(bytes32 indexed hash, address indexed owner);
Last updated
Was this helpful?