Skip to main content

DataPointRegistry

The IDataPointRegistry interface defines functions to manage the creation, transfer, and access control of Data Points.

Inside the Data Point Registry (DPR), Data Point ownership can be tracked like this:

    /// @dev Access data for each DataPoint
mapping(DataPoint => DPAccessData) private _accessData;

This component is vital for identifying each user's storage for the data defined in the Data Object.

    /**
* @notice Allocates a DataPoint to an owner
* @param owner Owner of the new DataPoint
* @dev Owner SHOULD be granted Admin role during allocation
*/
function allocate(address owner) external payable returns (DataPoint);

To integrate IDataPointRegistry for access control in the DataIndex and create a modifier, you can follow this example:

    /**
* @notice Restricts access to the function, allowing only DataPoint admins
* @param dp DataPoint to check ownership of
*/
modifier onlyDPOwner(DataPoint dp) {
bool isAdmin = IDataPointRegistry(registry).isAdmin(dp, msg.sender);
if (!isAdmin) revert InvalidDataPointAdmin(dp, msg.sender);
_;
}