fedimint_lnv2_client/
db.rs

1use fedimint_core::encoding::{Decodable, Encodable};
2use fedimint_core::impl_db_record;
3use fedimint_core::secp256k1::PublicKey;
4use fedimint_core::util::SafeUrl;
5use strum::EnumIter;
6
7#[repr(u8)]
8#[derive(Clone, EnumIter, Debug)]
9pub enum DbKeyPrefix {
10    Gateway = 0x41,
11    IncomingContractStreamIndex = 0x42,
12    #[allow(dead_code)]
13    /// Prefixes between 0xb0..=0xcf shall all be considered allocated for
14    /// historical and future external use
15    ExternalReservedStart = 0xb0,
16    #[allow(dead_code)]
17    /// Prefixes between 0xd0..=0xff shall all be considered allocated for
18    /// historical and future internal use
19    CoreInternalReservedStart = 0xd0,
20    #[allow(dead_code)]
21    CoreInternalReservedEnd = 0xff,
22}
23
24#[derive(Debug, Encodable, Decodable)]
25pub struct GatewayKey(pub PublicKey);
26
27impl_db_record!(
28    key = GatewayKey,
29    value = SafeUrl,
30    db_prefix = DbKeyPrefix::Gateway,
31);
32
33#[derive(Debug, Encodable, Decodable)]
34pub struct IncomingContractStreamIndexKey;
35
36impl_db_record!(
37    key = IncomingContractStreamIndexKey,
38    value = u64,
39    db_prefix = DbKeyPrefix::IncomingContractStreamIndex
40);