-
Notifications
You must be signed in to change notification settings - Fork 0
/
DataStore.sol
40 lines (29 loc) · 1.05 KB
/
DataStore.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
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.17;
import "./interfaces/IUsers.sol";
import "./ImmutableState.sol";
import "./Restrictable.sol";
contract DataStore is ImmutableState, Restrictable {
constructor(address _users) ImmutableState(address(uint160(0)), _users, address(uint160(0))) {}
mapping(bytes32 => bool) private history;
event DataUpdate(bytes32 groupID, bytes32 dataID, bytes32 ehrID, bytes data);
///
function dataUpdate(
bytes32 groupID,
bytes32 dataID,
bytes32 ehrID, // TODO remove after Treeindex refactoring
bytes calldata data,
address signer,
uint deadline,
bytes calldata signature
)
external onlyAllowed(msg.sender)
{
signCheck(signer, deadline, signature);
require(data.length > 0, "LEN");
bytes32 dataHash = keccak256(abi.encode(dataID, data));
require(history[dataHash] == false, "AEX");
history[dataHash] = true;
emit DataUpdate(groupID, dataID, ehrID, data);
}
}