forked from filecoin-project/raas-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIAggregatorOracle.sol
63 lines (51 loc) · 2.25 KB
/
IAggregatorOracle.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import {
ProofData,
InclusionProof,
InclusionVerifierData,
InclusionAuxData,
SegmentDesc,
Fr32
} from "../data-segment/ProofTypes.sol";
// Behavioral Interface for an aggregator oracle
interface IAggregatorOracle {
struct Deal {
// A unique identifier for the deal.
uint64 dealId;
// The miner that is storing the data for the deal.
uint64 minerId;
}
// Emitted when a new request is submitted with an ID and content identifier (CID).
event SubmitAggregatorRequest(uint256 indexed id, bytes cid);
// Emitted when a new request is submitted with an ID, content identifier (CID), and RaaS parameters
event SubmitAggregatorRequestWithRaaS(uint256 indexed id, bytes cid,
uint256 _replication_target, uint256 _repair_threshold,
uint256 _renew_threshold);
// Emitted when a request is completed, providing the request ID and deal ID.
event CompleteAggregatorRequest(uint256 indexed id, uint64 indexed dealId);
// Function that submits a new request to the oracle
function submit(bytes memory _cid) external returns (uint256);
// Function to submit a new file to the aggregator, specifing the raas parameters
function submitRaaS(
bytes memory _cid,
uint256 _replication_target,
uint256 _repair_threshold,
uint256 _renew_threshold
) external returns (uint256);
// Callback function that is called by the aggregator
function complete(
uint256 _id,
uint64 _dealId,
uint64 _minerId,
InclusionProof memory _proof,
InclusionVerifierData memory _verifierData
) external returns (InclusionAuxData memory);
function getAllCIDs() external view returns (bytes[] memory);
// Get all deal IDs for a specified cid
function getAllDeals(bytes memory _cid) external view returns (Deal[] memory);
// getActiveDeals should return all the _cid's active dealIds
function getActiveDeals(bytes memory _cid) external returns (Deal[] memory);
// getExpiringDeals should return all the deals' dealIds if they are expiring within `epochs`
function getExpiringDeals(bytes memory _cid, uint64 epochs) external returns (Deal[] memory);
}