mirror of
https://github.com/hanzoai/papers.git
synced 2026-10-29 07:34:31 +00:00
51 lines
1.5 KiB
TeX
51 lines
1.5 KiB
TeX
\section{Full Contract Specification}
|
|
|
|
\label{app:contract}
|
|
|
|
\begin{verbatim}
|
|
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.20;
|
|
|
|
interface IExperienceRegistry {
|
|
struct Entry {
|
|
bytes32 merkleRoot;
|
|
string cid;
|
|
uint64 schema;
|
|
uint64 quality; // [0, 1000] fixed-point
|
|
address submitter;
|
|
uint256 bond;
|
|
uint64 timestamp;
|
|
uint8 status; // 0=pending, 1=verified, 2=slashed
|
|
}
|
|
|
|
event Submitted(uint256 indexed id, address indexed submitter);
|
|
event QualityVoted(uint256 indexed id, address voter, uint64 score);
|
|
event Challenged(uint256 indexed id, address challenger, bool slashed);
|
|
event Aggregated(bytes32 aggregateRoot, uint256[] sourceIds);
|
|
|
|
function submit(Entry calldata e) external payable
|
|
returns (uint256 id);
|
|
|
|
function voteQuality(uint256 id, uint64 score) external;
|
|
|
|
function challenge(uint256 id, bytes calldata proof)
|
|
external returns (bool slashed);
|
|
|
|
function aggregate(uint256[] calldata ids)
|
|
external returns (bytes32 aggregateMerkleRoot);
|
|
|
|
function getEntry(uint256 id)
|
|
external view returns (Entry memory);
|
|
|
|
function getEntriesBySchema(uint64 schema)
|
|
external view returns (uint256[] memory ids);
|
|
|
|
function getSubmitterEntries(address submitter)
|
|
external view returns (uint256[] memory ids);
|
|
|
|
function getAggregateRoot(uint64 schema)
|
|
external view returns (bytes32);
|
|
}
|
|
\end{verbatim}
|
|
|