-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRawArticleStore.sol
More file actions
31 lines (26 loc) · 965 Bytes
/
RawArticleStore.sol
File metadata and controls
31 lines (26 loc) · 965 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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;
/// @title RawArticleStore
/// @notice Baseline contract: standard mapping with full-zero deletion.
/// Used as the control case for gas benchmarks against RecycledArticleStore.
contract RawArticleStore {
struct Article {
address owner;
uint32 withdrawalPermittedAt;
uint56 bountyAmount;
uint8 category;
}
mapping(uint256 => Article) public articles;
uint256 public nextId;
function createArticle(uint56 _bountyAmount, uint8 _category) external returns (uint256 id) {
id = nextId++;
articles[id] =
Article({owner: msg.sender, withdrawalPermittedAt: 0, bountyAmount: _bountyAmount, category: _category});
}
function deleteArticle(uint256 _id) external {
delete articles[_id];
}
function readArticle(uint256 _id) external view returns (Article memory) {
return articles[_id];
}
}