Trait noble_atomic_swap::SwapAction[][src]

pub trait SwapAction<AccountId, T: Config> {
    fn reserve(&self, source: &AccountId) -> DispatchResult;
fn claim(&self, source: &AccountId, target: &AccountId) -> bool;
fn weight(&self) -> Weight;
fn cancel(&self, source: &AccountId); }

Definition of a pending atomic swap action. It contains the following three phrases:

  • Reserve: reserve the resources needed for a swap. This is to make sure that Claim succeeds with best efforts.
  • Claim: claim any resources reserved in the first phrase.
  • Cancel: cancel any resources reserved in the first phrase.

Required methods

fn reserve(&self, source: &AccountId) -> DispatchResult[src]

Reserve the resources needed for the swap, from the given source. The reservation is allowed to fail. If that is the case, the the full swap creation operation is cancelled.

fn claim(&self, source: &AccountId, target: &AccountId) -> bool[src]

Claim the reserved resources, with source and target. Returns whether the claim succeeds.

fn weight(&self) -> Weight[src]

Weight for executing the operation.

fn cancel(&self, source: &AccountId)[src]

Cancel the resources reserved in source.

Loading content...

Implementors

impl<T: Config, AccountId, C> SwapAction<AccountId, T> for BalanceSwapAction<AccountId, C> where
    C: ReservableCurrency<AccountId>, 
[src]

Loading content...