Skip to content

Commit

Permalink
add stake config test
Browse files Browse the repository at this point in the history
  • Loading branch information
0xh3rman committed May 17, 2024
1 parent 92c05e9 commit ebc4fed
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/primitives/src/chain_stake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use typeshare::typeshare;
#[derive(Copy, Clone, Debug, Serialize, Deserialize, EnumIter, AsRefStr, EnumString)]
#[typeshare(swift = "Equatable, Codable, CaseIterable")]
#[serde(rename_all = "lowercase")]
#[strum(serialize_all = "lowercase")]
pub enum StakeChain {
Cosmos,
Osmosis,
Expand Down
20 changes: 20 additions & 0 deletions gemstone/src/config/stake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,23 @@ pub fn get_min_stake_amount(chain: &str) -> u64 {
Err(_) => 0,
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_get_stake_lock_time() {
assert_eq!(get_stake_lock_time("sui"), 86400);
assert_eq!(get_stake_lock_time("smartchain"), 604800);
}

#[test]
fn test_get_min_stake_amount() {
assert_eq!(get_min_stake_amount("sui"), 1_000_000_000);
assert_eq!(
get_min_stake_amount("smartchain"),
1_000_000_000_000_000_000
);
}
}

0 comments on commit ebc4fed

Please sign in to comment.