Skip to content
Open
Changes from 3 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions src/interfaces/IHookMetadata.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IHookMetadata {
// Struct representing the auditor of a smart contract
struct Auditor {
string name; // Name of the auditor
string uri; // URI with additional information about the auditor
string[] authors; // List of authors who are responsible for the audit
}

// Struct representing a summary of the audit
struct AuditSummary {
Auditor auditor; // The auditor who performed the audit
uint256 issuedAt; // The timestamp at which the audit was issued
uint256[] ercs; // List of ERC standards that were covered in the audit
bytes32 codeHash; // Hash of the audited smart contract code
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this should be more specific in the comment - is this the github commit? the bytecode hash? the initcode hash?

bytes32 auditHash; // Hash of the audit document
string auditUri; // URI with additional information or the full audit report
}

// Struct representing the EIP712 domain, which is used for signatures
struct EIP712Domain {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason not to pre-define the eip712 typehash of what the signature should be of?

string name; // Name of the domain
string version; // Version of the domain
}

// Enum defining different types of signature standards
enum SignatureType {
SECP256K1, // Standard ECDSA signature using secp256k1 curve
BLS, // BLS signature
ERC1271, // Signature type for smart contract based signatures (EIP-1271)
SECP256R1 // ECDSA signature using secp256r1 curve
}

// Struct representing a cryptographic signature
struct Signature {
SignatureType signatureType; // Type of the signature (e.g., SECP256K1, BLS, etc.)
bytes data; // Actual signature data
}

// Struct representing a signed audit summary
struct SignedAuditSummary {
AuditSummary auditSummary; // The audit summary being signed
uint256 signedAt; // Timestamp indicating when the audit summary was signed
Signature auditorSignature; // Signature of the auditor for authenticity
}

// These are external functions that must be implemented by any contract that implements this interface

function name() external view returns (string memory); // Returns the name of the hook
function repository() external view returns (string memory); // Returns the repository URI for the smart contract code
function logoURI() external view returns (string memory); // Returns the URI for the hook's logo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thoughts on adding a field for the hook dev to provide a URL to a website/docs or something about their hook?

function description() external view returns (string memory); // Returns a description of the hook
function version() external view returns (bytes32); // Returns the version of the hook
function auditSummary() external view returns (AuditSummary memory); // Returns the audit summary of the hook
function eip712Domain() external view returns (EIP712Domain memory); // Returns the EIP712 domain details for signing purposes
function signatureType() external view returns (SignatureType[] memory); // Returns the list of supported signature types
function signature() external view returns (Signature memory); // Returns the signature details of a specific audit
function signedAuditSummary() external view returns (SignedAuditSummary memory); // Returns a signed audit summary of the hook
}