1use std::collections::BTreeMap;
2
3use crate::constants::{D_DISPLAY_PLACES, TOTAL_TOKENS};
4use crate::primitives::asset::TokenAmount;
5
6pub mod druid_utils;
9pub mod error_utils;
10pub mod script_utils;
11pub mod test_utils;
12pub mod transaction_utils;
13
14pub fn is_valid_amount(_value: &TokenAmount) -> bool {
21 true
22}
23
24pub fn format_for_display(value: &u64) -> String {
30 if value < &TOTAL_TOKENS {
31 let value_f64 = *value as f64;
32 return (value_f64 / D_DISPLAY_PLACES).to_string();
33 }
34
35 "Value out of bounds".to_string()
36}
37
38pub fn add_btreemap<E: Ord, T: Copy + std::ops::AddAssign>(
46 m1: &mut BTreeMap<E, T>,
47 m2: BTreeMap<E, T>,
48) -> &BTreeMap<E, T> {
49 m2.into_iter().for_each(|(key, value)| {
50 m1.entry(key).and_modify(|e| *e += value).or_insert(value);
51 });
52 m1
53}