Skip to content

Commit

Permalink
Add serialization and deserialization to Coins
Browse files Browse the repository at this point in the history
  • Loading branch information
shanev committed Aug 7, 2023
1 parent d5eaa62 commit 77c12a3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/std/src/coins.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use alloc::collections::BTreeMap;
use core::fmt;
use core::str::FromStr;
use serde::{Deserialize, Serialize};

use crate::{errors::CoinsError, Coin, StdError, StdResult, Uint128};
use crate::{OverflowError, OverflowOperation};
Expand All @@ -14,7 +15,7 @@ use crate::{OverflowError, OverflowOperation};
/// - coins are naturally sorted alphabetically by denom
/// - duplicate denoms are automatically removed
/// - cheaper for searching/inserting/deleting: O(log(n)) compared to O(n)
#[derive(Clone, Default, Debug, PartialEq, Eq)]
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq)]
pub struct Coins(BTreeMap<String, Uint128>);

/// Casting a Vec<Coin> to Coins.
Expand Down

0 comments on commit 77c12a3

Please sign in to comment.