fedimint_dummy_server/
db.rs1use fedimint_core::encoding::{Decodable, Encodable};
2use fedimint_core::{Amount, InPoint, OutPoint, impl_db_lookup, impl_db_record};
3use serde::Serialize;
4use strum_macros::EnumIter;
5
6#[repr(u8)]
8#[derive(Clone, EnumIter, Debug)]
9pub enum DbKeyPrefix {
10 InputAudit = 0x01,
11 OutputAudit = 0x02,
12}
13
14impl std::fmt::Display for DbKeyPrefix {
15 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
16 write!(f, "{self:?}")
17 }
18}
19
20#[derive(Debug, Clone, Encodable, Decodable, Eq, PartialEq, Hash, Serialize)]
22pub struct DummyInputAuditKey(pub InPoint);
23
24#[derive(Debug, Encodable, Decodable)]
25pub struct DummyInputAuditPrefix;
26
27impl_db_record!(
28 key = DummyInputAuditKey,
29 value = Amount,
30 db_prefix = DbKeyPrefix::InputAudit,
31);
32impl_db_lookup!(
33 key = DummyInputAuditKey,
34 query_prefix = DummyInputAuditPrefix
35);
36
37#[derive(Debug, Clone, Encodable, Decodable, Eq, PartialEq, Hash, Serialize)]
39pub struct DummyOutputAuditKey(pub OutPoint);
40
41#[derive(Debug, Encodable, Decodable)]
42pub struct DummyOutputAuditPrefix;
43
44impl_db_record!(
45 key = DummyOutputAuditKey,
46 value = Amount,
47 db_prefix = DbKeyPrefix::OutputAudit,
48);
49impl_db_lookup!(
50 key = DummyOutputAuditKey,
51 query_prefix = DummyOutputAuditPrefix
52);