Skip to content

Commit

Permalink
add v5 new epoch event type
Browse files Browse the repository at this point in the history
  • Loading branch information
0o-de-lally committed Dec 4, 2024
1 parent 8b20710 commit c57d5d5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
Binary file added compatibility/.DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions compatibility/src/version_five/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pub mod diem_account_v5;
pub mod freezing_v5;
pub mod legacy_address_v5;
pub mod module_v5;
pub mod new_epoch_v5;
pub mod ol_ancestry;
pub mod ol_cumulative_deposit;
pub mod ol_receipts;
Expand Down
29 changes: 29 additions & 0 deletions compatibility/src/version_five/new_epoch_v5.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
use crate::version_five::move_resource_v5::MoveStructTypeV5;
use anyhow::Result;
use move_core_types::{ident_str, identifier::IdentStr};
use serde::{Deserialize, Serialize};

/// Struct that represents a NewEpochEvent.
#[derive(Debug, Serialize, Deserialize)]
pub struct NewEpochEventV5 {
epoch: u64,
}

impl NewEpochEventV5 {
pub fn new(epoch: u64) -> Self {
NewEpochEventV5 { epoch }
}

pub fn epoch(&self) -> u64 {
self.epoch
}

pub fn try_from_bytes(bytes: &[u8]) -> Result<Self> {
bcs::from_bytes(bytes).map_err(Into::into)
}
}

impl MoveStructTypeV5 for NewEpochEventV5 {
const MODULE_NAME: &'static IdentStr = ident_str!("DiemConfig");
const STRUCT_NAME: &'static IdentStr = ident_str!("NewEpochEvent");
}

0 comments on commit c57d5d5

Please sign in to comment.