-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRepRegistry.sol
More file actions
50 lines (43 loc) · 1.39 KB
/
Copy pathRepRegistry.sol
File metadata and controls
50 lines (43 loc) · 1.39 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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
/// @notice Public commitments to privacy-safe PureFlow Rep summaries.
contract RepRegistry {
error EmptyCommitment();
error AlreadyAttested();
error InvalidDuration();
error InvalidOwnership();
event RepAttested(
address indexed developer,
bytes32 indexed commitment,
uint32 focusedSeconds,
uint16 testRuns,
uint16 debugLoops,
uint8 ownership,
uint64 completedAt
);
mapping(bytes32 commitment => address developer) public attestorOf;
mapping(address developer => uint64 count) public repCount;
function attest(
bytes32 commitment,
uint32 focusedSeconds,
uint16 testRuns,
uint16 debugLoops,
uint8 ownership
) external {
if (commitment == bytes32(0)) revert EmptyCommitment();
if (attestorOf[commitment] != address(0)) revert AlreadyAttested();
if (focusedSeconds == 0 || focusedSeconds > 24 hours) revert InvalidDuration();
if (ownership < 1 || ownership > 3) revert InvalidOwnership();
attestorOf[commitment] = msg.sender;
repCount[msg.sender]++;
emit RepAttested(
msg.sender,
commitment,
focusedSeconds,
testRuns,
debugLoops,
ownership,
uint64(block.timestamp)
);
}
}