verifier_42-contract-lab/contracts/interfaces/IVerifier.sol

101 lines
3.3 KiB
Solidity

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
/**
* @title IVerifier
* @notice Core interface defining verification mechanisms for ChunkNet protocol
* @dev Implements verification strategies with flexible challenge and validation workflows
*/
interface IVerifier {
/// @notice Represents the different verification states a submission can have
enum VerificationStatus {
Pending,
Verified,
Challenged,
Rejected
}
/// @notice Represents a verification submission
struct VerificationSubmission {
address submitter;
bytes32 contentHash;
uint256 submissionTime;
uint256 challengePeriod;
VerificationStatus status;
uint256 requiredStake;
bytes32[] proofData;
}
/// @notice Emitted when a new verification submission is created
event SubmissionCreated(
bytes32 indexed submissionId,
address indexed submitter,
bytes32 contentHash
);
/// @notice Emitted when a submission changes verification status
event VerificationStatusChanged(
bytes32 indexed submissionId,
VerificationStatus newStatus
);
/**
* @notice Submit content for verification
* @param contentHash Unique hash representing the content
* @param proofData Additional cryptographic proofs
* @param challengePeriod Duration for potential challenges
* @return submissionId Unique identifier for the submission
*/
function submitVerification(
bytes32 contentHash,
bytes32[] calldata proofData,
uint256 challengePeriod
) external payable returns (bytes32 submissionId);
/**
* @notice Challenge an existing verification submission
* @param submissionId Unique identifier of the submission
* @param challengeProof Proof supporting the challenge
* @return challengeAccepted Whether the challenge was successfully processed
*/
function challengeSubmission(
bytes32 submissionId,
bytes32[] calldata challengeProof
) external returns (bool challengeAccepted);
/**
* @notice Retrieve current status of a verification submission
* @param submissionId Unique identifier of the submission
* @return Current verification status
*/
function getSubmissionStatus(
bytes32 submissionId
) external view returns (VerificationStatus);
/**
* @notice Retrieve full details of a verification submission
* @param submissionId Unique identifier of the submission
* @return Detailed verification submission struct
*/
function getSubmissionDetails(
bytes32 submissionId
) external view returns (VerificationSubmission memory);
/**
* @notice Finalize a verified submission
* @param submissionId Unique identifier of the submission
* @return Indicates whether finalization was successful
*/
function finalizeSubmission(
bytes32 submissionId
) external returns (bool);
/**
* @notice Calculate required stake for a verification submission
* @param contentHash Hash of content being verified
* @return Required stake amount in native token
*/
function calculateRequiredStake(
bytes32 contentHash
) external view returns (uint256);
}