1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use cosmwasm_std::Uint128;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use std::fmt;

use super::AssetEntry;

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct AnsAsset {
    pub name: AssetEntry,
    pub amount: Uint128,
}

impl AnsAsset {
    pub fn new(name: impl Into<AssetEntry>, amount: impl Into<Uint128>) -> Self {
        AnsAsset {
            name: name.into(),
            amount: amount.into(),
        }
    }
}

impl fmt::Display for AnsAsset {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}:{}", self.name, self.amount)
    }
}