pub trait Pay {
type Balance: Balance;
type Beneficiary;
type AssetKind;
type Id: FullCodec + MaxEncodedLen + TypeInfo + Clone + Eq + PartialEq + Debug + Copy;
type Error: Debug;
// Required methods
fn pay(
who: &Self::Beneficiary,
asset_kind: Self::AssetKind,
amount: Self::Balance,
) -> Result<Self::Id, Self::Error>;
fn check_payment(id: Self::Id) -> PaymentStatus;
}
Expand description
Can be implemented by PayFromAccount
using a fungible
impl, but can also be implemented with
XCM/Asset and made generic over assets.
Required Associated Types§
sourcetype Balance: Balance
type Balance: Balance
The type by which we measure units of the currency in which we make payments.
sourcetype Beneficiary
type Beneficiary
The type by which we identify the beneficiaries to whom a payment may be made.
sourcetype AssetKind
type AssetKind
The type for the kinds of asset that are going to be paid.
The unit type can be used here to indicate there’s only one kind of asset to do payments with. When implementing, it should be clear from the context what that asset is.
Required Methods§
sourcefn pay(
who: &Self::Beneficiary,
asset_kind: Self::AssetKind,
amount: Self::Balance,
) -> Result<Self::Id, Self::Error>
fn pay( who: &Self::Beneficiary, asset_kind: Self::AssetKind, amount: Self::Balance, ) -> Result<Self::Id, Self::Error>
Make a payment and return an identifier for later evaluation of success in some off-chain mechanism (likely an event, but possibly not on this chain).
sourcefn check_payment(id: Self::Id) -> PaymentStatus
fn check_payment(id: Self::Id) -> PaymentStatus
Check how a payment has proceeded. id
must have been previously returned by pay
for
the result of this call to be meaningful. Once this returns anything other than
InProgress
for some id
it must return Unknown
rather than the actual result
value.