referrerpolicy=no-referrer-when-downgrade

Trait staging_xcm_executor::traits::AssetLock

source ·
pub trait AssetLock {
    type LockTicket: Enact;
    type UnlockTicket: Enact;
    type ReduceTicket: Enact;

    // Required methods
    fn prepare_lock(
        unlocker: Location,
        asset: Asset,
        owner: Location,
    ) -> Result<Self::LockTicket, LockError>;
    fn prepare_unlock(
        locker: Location,
        asset: Asset,
        owner: Location,
    ) -> Result<Self::UnlockTicket, LockError>;
    fn note_unlockable(
        locker: Location,
        asset: Asset,
        owner: Location,
    ) -> Result<(), LockError>;
    fn prepare_reduce_unlockable(
        locker: Location,
        asset: Asset,
        owner: Location,
    ) -> Result<Self::ReduceTicket, LockError>;
}
Expand description

Define a handler for notification of an asset being locked and for the unlock instruction.

Required Associated Types§

source

type LockTicket: Enact

Enact implementer for prepare_lock. This type may be dropped safely to avoid doing the lock.

source

type UnlockTicket: Enact

Enact implementer for prepare_unlock. This type may be dropped safely to avoid doing the unlock.

source

type ReduceTicket: Enact

Enact implementer for prepare_reduce_unlockable. This type may be dropped safely to avoid doing the unlock.

Required Methods§

source

fn prepare_lock( unlocker: Location, asset: Asset, owner: Location, ) -> Result<Self::LockTicket, LockError>

Prepare to lock an asset. On success, a Self::LockTicket it returned, which can be used to actually enact the lock.

WARNING: Don’t call this with an undropped instance of Self::LockTicket or Self::UnlockTicket.

source

fn prepare_unlock( locker: Location, asset: Asset, owner: Location, ) -> Result<Self::UnlockTicket, LockError>

Prepare to unlock an asset. On success, a Self::UnlockTicket it returned, which can be used to actually enact the lock.

WARNING: Don’t call this with an undropped instance of Self::LockTicket or Self::UnlockTicket.

source

fn note_unlockable( locker: Location, asset: Asset, owner: Location, ) -> Result<(), LockError>

Handler for when a location reports to us that an asset has been locked for us to unlock at a later stage.

If there is no way to handle the lock report, then this should return an error so that the sending chain can ensure the lock does not remain.

We should only act upon this message if we believe that the origin is honest.

source

fn prepare_reduce_unlockable( locker: Location, asset: Asset, owner: Location, ) -> Result<Self::ReduceTicket, LockError>

Handler for when an owner wishes to unlock an asset on a remote chain.

Returns a ticket which can be used to actually note the reduction in unlockable assets that owner commands on locker.

WARNING: Don’t call this with an undropped instance of Self::ReduceTicket.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl AssetLock for ()

§

type LockTicket = Infallible

§

type UnlockTicket = Infallible

§

type ReduceTicket = Infallible

source§

fn prepare_lock( _: Location, _: Asset, _: Location, ) -> Result<Self::LockTicket, LockError>

source§

fn prepare_unlock( _: Location, _: Asset, _: Location, ) -> Result<Self::UnlockTicket, LockError>

source§

fn note_unlockable(_: Location, _: Asset, _: Location) -> Result<(), LockError>

source§

fn prepare_reduce_unlockable( _: Location, _: Asset, _: Location, ) -> Result<Self::ReduceTicket, LockError>

Implementors§