IDocumentRegistry

Git Source

Lightweight interface for the DocumentRegistry contract exposing events, enums and external callable functions. Contracts that only need to interact with the registry should import this interface instead of the full implementation to reduce byte-code size.

Functions

registerDocument

function registerDocument(bytes32 hash, string calldata uri, bool isTemplate, bytes32 templateHash)
    external
    returns (bytes32);

addSigner

function addSigner(bytes32 documentHash, address signerAddress, uint256 signatureOrder, bool isRequired) external;

sign

function sign(bytes32 documentHash, address owner) external;

rejectDocument

function rejectDocument(bytes32 documentHash) external;

setDocumentExpiration

function setDocumentExpiration(bytes32 documentHash, uint256 expirationTime) external;

updateDocumentURI

function updateDocumentURI(bytes32 hash, string calldata newUri) external;

deactivateDocument

function deactivateDocument(bytes32 hash) external;

reactivateDocument

function reactivateDocument(bytes32 hash) external;

documentOwners

function documentOwners(bytes32 hash) external view returns (address);

documents

function documents(bytes32 hash, address owner)
    external
    view
    returns (
        bytes32 docHash,
        string memory uri,
        address docOwner,
        uint256 timestamp,
        bool isActive,
        bool isTemplate,
        bytes32 templateHash,
        uint256 requiredSignatures,
        bool isSequential,
        SigningStatus status,
        uint256 expirationTime
    );

getDocumentInfo

function getDocumentInfo(bytes32 hash)
    external
    view
    returns (
        bytes32 docHash,
        string memory uri,
        address owner,
        uint256 timestamp,
        bool isActive,
        bool isTemplate,
        bytes32 templateHash,
        uint256 requiredSignatures,
        bool isSequential,
        SigningStatus status,
        uint256 expirationTime
    );

getDocumentSigners

function getDocumentSigners(bytes32 hash) external view returns (address[] memory);

getSignerDetails

function getSignerDetails(bytes32 hash, address signerAddress)
    external
    view
    returns (address account, bool hasSigned, uint256 signedAt, bool isRequired, uint256 signatureOrder);

getSignerDetailsByOwner

function getSignerDetailsByOwner(bytes32 hash, address owner, address signerAddress)
    external
    view
    returns (address account, bool hasSigned, uint256 signedAt, bool isRequired, uint256 signatureOrder);

getDocumentsByOwner

function getDocumentsByOwner(address owner) external view returns (bytes32[] memory);

getPendingSignatures

function getPendingSignatures(address signer) external view returns (bytes32[] memory);

registerInstanceAndSign

function registerInstanceAndSign(bytes32 templateHash, string calldata uri) external returns (bytes32 instanceHash);

Events

DocumentRegistryCreated

event DocumentRegistryCreated(address indexed registry);

DocumentRegistered

event DocumentRegistered(
    bytes32 indexed hash, string uri, address indexed owner, bool isTemplate, bytes32 templateHash
);

SignerAdded

event SignerAdded(bytes32 indexed documentHash, address indexed signer, uint256 signatureOrder, bool isRequired);

DocumentSigned

event DocumentSigned(bytes32 indexed documentHash, address indexed signer, uint256 timestamp);

DocumentRejected

event DocumentRejected(bytes32 indexed documentHash, address indexed signer, uint256 timestamp);

DocumentURIUpdated

event DocumentURIUpdated(bytes32 indexed hash, string oldUri, string newUri);

DocumentDeactivated

event DocumentDeactivated(bytes32 indexed hash);

DocumentReactivated

event DocumentReactivated(bytes32 indexed hash);

DocumentStatusChanged

event DocumentStatusChanged(bytes32 indexed hash, SigningStatus previousStatus, SigningStatus newStatus);

Structs

Signer

struct Signer {
    address account;
    bool hasSigned;
    uint256 signedAt;
    bool isRequired;
    uint256 signatureOrder;
}

Document

struct Document {
    bytes32 hash;
    string uri;
    address owner;
    uint256 timestamp;
    bool isActive;
    bool isTemplate;
    bytes32 templateHash;
    address[] signers;
    mapping(address => Signer) signerDetails;
    uint256 requiredSignatures;
    bool isSequential;
    SigningStatus status;
    uint256 expirationTime;
}

Enums

SigningStatus

enum SigningStatus {
    Pending,
    Completed,
    Rejected,
    Expired
}

Last updated

Was this helpful?