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
use filament_chain::{Address, AssetId};

pub trait StateKey {
    fn state_key(&self) -> String;
}

impl StateKey for Address {
    fn state_key(&self) -> String {
        hex::encode(self)
    }
}

impl StateKey for AssetId {
    fn state_key(&self) -> String {
        // FIXME(xla): Conversion here should be safe and respect character set that is tolerated in
        // state keys.
        self.to_string()
    }
}

#[inline]
pub fn block_height() -> &'static str {
    "block_height"
}

#[inline]
pub fn block_timestamp() -> &'static str {
    "block_timestamp"
}

#[inline]
pub fn chain_parameters() -> &'static str {
    "chain_parameters"
}