sourcekeeper_42-contract-lab/contracts/interfaces/ILabRegistry.sol

93 lines
3.0 KiB
Solidity

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
/**
* @title ILabRegistry
* @notice Interface for managing lab registration and metadata
* @dev Provides core functionality for tracking and validating lab entities
*/
interface ILabRegistry {
/// @notice Represents the core structure of a registered lab
struct LabEntity {
address owner;
string name;
string description;
bytes32 metadataHash;
uint256 registrationTimestamp;
bool isActive;
address[] authorizedResearchers;
}
/// @notice Emitted when a new lab is registered
event LabRegistered(
address indexed labAddress,
string name,
uint256 registrationTimestamp
);
/// @notice Emitted when lab details are updated
event LabUpdated(
address indexed labAddress,
string newName,
bytes32 newMetadataHash
);
/// @notice Registers a new lab in the registry
/// @param name Unique name for the lab
/// @param description Detailed description of the lab's focus
/// @param metadataHash IPFS or content hash of additional metadata
/// @return labId Unique identifier for the registered lab
function registerLab(
string memory name,
string memory description,
bytes32 metadataHash
) external returns (uint256 labId);
/// @notice Updates existing lab metadata
/// @param labId Identifier of the lab to update
/// @param newName Updated lab name
/// @param newDescription Updated lab description
/// @param newMetadataHash New metadata hash
function updateLabDetails(
uint256 labId,
string memory newName,
string memory newDescription,
bytes32 newMetadataHash
) external;
/// @notice Adds an authorized researcher to a lab
/// @param labId Lab identifier
/// @param researcherAddress Address of researcher to authorize
function addResearcher(
uint256 labId,
address researcherAddress
) external;
/// @notice Removes an authorized researcher from a lab
/// @param labId Lab identifier
/// @param researcherAddress Address of researcher to remove
function removeResearcher(
uint256 labId,
address researcherAddress
) external;
/// @notice Retrieves full details of a registered lab
/// @param labId Identifier of the lab
/// @return Lab entity details
function getLab(
uint256 labId
) external view returns (LabEntity memory);
/// @notice Checks if an address is an authorized researcher for a lab
/// @param labId Lab identifier
/// @param researcherAddress Address to check
/// @return Boolean indicating researcher authorization
function isAuthorizedResearcher(
uint256 labId,
address researcherAddress
) external view returns (bool);
/// @notice Deactivates a lab, preventing further modifications
/// @param labId Identifier of the lab to deactivate
function deactivateLab(uint256 labId) external;
}