-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIVotsEngineFunctionClient.sol
More file actions
88 lines (78 loc) · 3.24 KB
/
IVotsEngineFunctionClient.sol
File metadata and controls
88 lines (78 loc) · 3.24 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.21;
/**
* @title IVotsEngineFunctionClient
* @author Ayeni-yeniyan
* @notice Interface for the VotsEngineFunctionClient contract
* Defines the contract that handles Chainlink Functions requests for voter verification
*/
interface IVotsEngineFunctionClient {
// ====================================================================
// Errors
// ====================================================================
error VotsEngineFunctionClient__OnlyVotsEngine();
error VotsEngineFunctionClient__InvalidRequestId();
// ====================================================================
// Events
// ====================================================================
event VerificationRequestSent(bytes32 indexed requestId, string voterMatricNo, uint256 electionTokenId);
event VerificationRequestFulfilled(bytes32 indexed requestId, string voterMatricNo, uint256 electionTokenId);
// ====================================================================
// Structs
// ====================================================================
struct RequestInfo {
uint256 electionTokenId;
address messageSender;
string voterMatricNo;
bool exists;
}
// ====================================================================
// Functions
// ====================================================================
/**
* @dev Sends an HTTP request to an ID verification portal
* @param ninNumber National identification number
* @param firstName First name of the voter
* @param lastName Last name of the voter
* @param voterMatricNo Voter's matriculation number
* @param slotId DON-hosted secrets slot ID
* @param version DON-hosted secrets version
* @param electionTokenId Token ID of the election
* @param subscriptionId Chainlink Functions subscription ID
* @param messageSender Original message sender who initiated the request
* @return requestId The ID of the request
*/
function sendVerificationRequestForElection(
string calldata ninNumber,
string calldata firstName,
string calldata lastName,
string calldata voterMatricNo,
uint256 slotId,
uint256 version,
uint256 electionTokenId,
uint64 subscriptionId,
address messageSender
) external returns (bytes32 requestId);
/**
* @dev Returns the DON ID used by this contract
* @return bytes32 The DON ID
*/
function getDonId() external view returns (bytes32);
/**
* @dev Returns the VotsEngine contract address
* @return address The VotsEngine contract address
*/
function votsEngine() external view returns (address);
/**
* @dev Returns request information for a given request ID
* @param requestId The request ID to query
* @return RequestInfo The request information
*/
function getRequestInfo(bytes32 requestId) external view returns (RequestInfo memory);
/**
* @dev Checks if a request exists
* @param requestId The request ID to check
* @return bool True if the request exists
*/
function requestExists(bytes32 requestId) external view returns (bool);
}