use crate::msa::MessageSourceId;
use frame_support::traits::tokens::Balance;
use sp_runtime::DispatchError;
pub trait TargetValidator {
fn validate(target: MessageSourceId) -> bool;
}
impl TargetValidator for () {
fn validate(_target: MessageSourceId) -> bool {
false
}
}
pub trait Nontransferable {
type Balance: Balance;
fn balance(msa_id: MessageSourceId) -> Self::Balance;
fn deduct(msa_id: MessageSourceId, amount: Self::Balance) -> Result<(), DispatchError>;
fn deposit(msa_id: MessageSourceId, amount: Self::Balance) -> Result<(), DispatchError>;
}
pub trait Replenishable {
type Balance: Balance;
fn replenish_by_amount(
msa_id: MessageSourceId,
amount: Self::Balance,
) -> Result<(), DispatchError>;
fn replenish_all_for(msa_id: MessageSourceId) -> Result<(), DispatchError>;
fn can_replenish(msa_id: MessageSourceId) -> bool;
}