Skip to content

Commit c491773

Browse files
ee
authored andcommitted
Add IAuditLog interface for tamper-proof trade audit trail
1 parent 1442625 commit c491773

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

include/flox/audit/audit_log.h

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Flox Engine
3+
* Developed by FLOX Foundation (https://github.com/FLOX-Foundation)
4+
*
5+
* Copyright (c) 2025 FLOX Foundation
6+
* Licensed under the MIT License. See LICENSE file in the project root for full
7+
* license information.
8+
*/
9+
10+
#pragma once
11+
12+
#include <cstdint>
13+
#include <string>
14+
#include <string_view>
15+
#include <vector>
16+
17+
namespace flox
18+
{
19+
20+
struct AuditEntry
21+
{
22+
int64_t seq = 0;
23+
std::string ts;
24+
std::string actor;
25+
std::string action;
26+
int64_t trade_id = 0;
27+
std::string details;
28+
std::string source;
29+
std::string prev_hash;
30+
std::string hash;
31+
};
32+
33+
struct AuditVerifyResult
34+
{
35+
int64_t total = 0;
36+
int64_t verified = 0;
37+
bool intact = false;
38+
int64_t broken_at_seq = 0;
39+
std::string error;
40+
};
41+
42+
struct IAuditLog
43+
{
44+
virtual ~IAuditLog() = default;
45+
46+
virtual void audit(std::string_view actor, std::string_view action,
47+
int64_t tradeId, std::string_view details,
48+
std::string_view source = "") = 0;
49+
50+
virtual std::vector<AuditEntry> getLog(int limit = 100, int64_t beforeSeq = 0,
51+
std::string_view actor = "",
52+
int64_t tradeId = 0) = 0;
53+
54+
virtual AuditVerifyResult verify() = 0;
55+
};
56+
57+
} // namespace flox

0 commit comments

Comments
 (0)