Skip to content

Commit

Permalink
impl MoveResource for StakePool
Browse files Browse the repository at this point in the history
  • Loading branch information
so-kkroy22 committed May 16, 2024
1 parent 11897a4 commit 437832d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions types/src/stake_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

use crate::{account_address::AccountAddress, event::EventHandle};
use serde::{Deserialize, Serialize};
use move_core_types::ident_str;
use move_core_types::identifier::IdentStr;
use move_core_types::move_resource::{MoveResource, MoveStructType};

#[derive(Debug, Serialize, Deserialize)]
pub struct StakePool {
Expand All @@ -28,6 +31,13 @@ pub struct StakePool {
pub leave_validator_set_events: EventHandle,
}

impl MoveStructType for StakePool {
const MODULE_NAME: &'static IdentStr = ident_str!("stake");
const STRUCT_NAME: &'static IdentStr = ident_str!("StakePool");
}

impl MoveResource for StakePool {}

impl StakePool {
pub fn get_total_staked_amount(&self) -> u64 {
self.active + self.inactive + self.pending_active + self.pending_inactive
Expand Down

0 comments on commit 437832d

Please sign in to comment.