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
35
36
37
38
39
40
41
42
43
44
45
use crate::{account_address::AccountAddress, account_config::DIEM_MODULE_IDENTIFIER};
use anyhow::Result;
use move_core_types::{
ident_str,
identifier::{IdentStr, Identifier},
move_resource::MoveStructType,
};
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
pub struct BurnEvent {
amount: u64,
currency_code: Identifier,
preburn_address: AccountAddress,
}
impl BurnEvent {
pub fn amount(&self) -> u64 {
self.amount
}
pub fn currency_code(&self) -> &IdentStr {
&self.currency_code
}
pub fn preburn_address(&self) -> AccountAddress {
self.preburn_address
}
pub fn try_from_bytes(bytes: &[u8]) -> Result<Self> {
bcs::from_bytes(bytes).map_err(Into::into)
}
}
impl MoveStructType for BurnEvent {
const MODULE_NAME: &'static IdentStr = DIEM_MODULE_IDENTIFIER;
const STRUCT_NAME: &'static IdentStr = ident_str!("BurnEvent");
}