use std::collections::BTreeMap;
pub use namada_core::address::Address;
use namada_core::borsh::{BorshDeserialize, BorshSerialize};
pub use namada_core::masp::MaspEpoch;
pub use namada_core::masp_primitives::asset_type::AssetType;
pub use namada_core::masp_primitives::convert::AllowedConversion;
pub use namada_core::masp_primitives::merkle_tree::FrozenCommitmentTree;
pub use namada_core::masp_primitives::sapling::Node as SaplingNode;
pub use namada_core::token::{Denomination, MaspDigitPos};
use namada_macros::BorshDeserializer;
#[cfg(feature = "migrations")]
use namada_migrations::*;
#[derive(Debug, BorshSerialize, BorshDeserialize, BorshDeserializer)]
pub struct ConversionLeaf {
pub token: Address,
pub denom: Denomination,
pub digit_pos: MaspDigitPos,
pub epoch: MaspEpoch,
pub conversion: AllowedConversion,
pub leaf_pos: usize,
}
#[derive(
Debug, Default, BorshSerialize, BorshDeserialize, BorshDeserializer,
)]
pub struct ConversionState {
#[deprecated = "Current native precision has been moved into the native \
precision storage key."]
pub current_precision: Option<u128>,
pub tree: FrozenCommitmentTree<SaplingNode>,
pub assets: BTreeMap<AssetType, ConversionLeaf>,
}
pub trait ReadConversionState {
fn conversion_state(&self) -> &ConversionState;
}
pub trait WithConversionState: ReadConversionState {
fn conversion_state_mut(&mut self) -> &mut ConversionState;
}