-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContentRegistry.sol
More file actions
35 lines (31 loc) · 1006 Bytes
/
Copy pathContentRegistry.sol
File metadata and controls
35 lines (31 loc) · 1006 Bytes
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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract ContentRegistry {
struct ContentRecord {
bytes32 contentHash;
address creatorWallet;
uint256 citationPrice;
uint256 timestamp;
}
mapping(bytes32 => ContentRecord) public registry;
event ContentRegistered(
bytes32 indexed contentHash,
address indexed creatorWallet,
uint256 citationPrice,
uint256 timestamp
);
function registerContent(
bytes32 contentHash,
address creatorWallet,
uint256 citationPrice
) external {
require(registry[contentHash].timestamp == 0, "Content already registered");
registry[contentHash] = ContentRecord({
contentHash: contentHash,
creatorWallet: creatorWallet,
citationPrice: citationPrice,
timestamp: block.timestamp
});
emit ContentRegistered(contentHash, creatorWallet, citationPrice, block.timestamp);
}
}