use crate::pallet_prelude::{Decode, Encode};
use core::fmt::Debug;
use frame_support::traits::tokens::PaymentStatus;
use scale_info::TypeInfo;
use sp_runtime::codec::{FullCodec, MaxEncodedLen};
pub trait Transfer {
type Balance;
type Sender;
type Beneficiary;
type AssetKind;
type RemoteFeeAsset;
type Id: FullCodec + MaxEncodedLen + TypeInfo + Clone + Eq + PartialEq + Debug + Copy;
type Error: Debug;
fn transfer(
from: &Self::Sender,
to: &Self::Beneficiary,
asset_kind: Self::AssetKind,
amount: Self::Balance,
remote_fee: Option<Self::RemoteFeeAsset>,
) -> Result<Self::Id, Self::Error>;
fn check_transfer(id: Self::Id) -> PaymentStatus;
#[cfg(feature = "runtime-benchmarks")]
fn ensure_successful(
to: &Self::Beneficiary,
asset_kind: Self::AssetKind,
amount: Self::Balance,
);
#[cfg(feature = "runtime-benchmarks")]
fn ensure_concluded(id: Self::Id);
}
#[derive(Encode, Decode, Eq, PartialEq, Clone, TypeInfo, MaxEncodedLen, Debug)]
pub enum TransferStatus {
InProgress,
Unknown,
Success,
Failure,
}