DocumentRegistry

Git Source

Inherits: ContextUpgradeable, HubOwnableUUPSUpgradeable, IDocumentRegistry

Author: Daniel Yamagata & Jerry Qi

A registry that keeps track of documents for departments and treasuries

ContextUpgradeable's _msgSender() is used instead of msg.sender to support gas relayers in the future if needed Document indices and versions are indexed at zero

State Variables

DocumentRegistryStorageLocation

bytes32 private constant DocumentRegistryStorageLocation =
    0x46700f930ad7adfc0a292e81ee80058e1cf74d898e6dd683beb9ef96db973800;

Functions

_getDocumentRegistryStorage

function _getDocumentRegistryStorage() internal pure returns (DocumentRegistryStorage storage $);

constructor

constructor(address _mezzHub) HubOwnableUUPSUpgradeable(_mezzHub);

addDocument

Adds a document to the registry for the caller

This function is not access controlled: any account can add a document to the registry if desired

function addDocument(string memory documentName, string memory documentUri) external virtual returns (uint256);

Returns

updateDocument

Updates the document associated with 'documentIndex' in the registry for the caller

This function will revert if the 'documentIndex' is invalid

function updateDocument(uint256 documentIndex, string memory updatedDocumentName, string memory updatedDocumentUri)
    external
    virtual
    returns (uint256);

Parameters

Returns

getLatestDocuments

Returns all of the latest documents associated with an 'owner'

function getLatestDocuments(address owner) public view virtual returns (DataTypes.Document[] memory);

Parameters

Returns

getLatestDocumentByIndex

Returns the latest document given an 'owner' and 'documentIndex'

function getLatestDocumentByIndex(address owner, uint256 documentIndex)
    public
    view
    virtual
    returns (DataTypes.Document memory);

getDocumentByVersion

Returns a document given an 'owner', 'documentIndex', and 'documentVersion'

This function will revert if the document does not exist

function getDocumentByVersion(address owner, uint256 documentIndex, uint256 documentVersion)
    public
    view
    virtual
    returns (DataTypes.Document memory);

Parameters

Returns

_validateDocumentExistence

Validates that the document exists, reverts if it does not

function _validateDocumentExistence(address owner, uint256 documentIndex) internal view;

Structs

DocumentRegistryStorage

struct DocumentRegistryStorage {
    mapping(address => mapping(uint256 => DataTypes.VersionedDocuments)) _documentByOwnerByIndex;
    mapping(address => uint256) _nextDocumentIndexByOwner;
}

Last updated