Trait xcm_builder::test_utils::AssetLock
pub trait AssetLock {
type LockTicket: Enact;
type UnlockTicket: Enact;
type ReduceTicket: Enact;
// Required methods
fn prepare_lock(
unlocker: MultiLocation,
asset: MultiAsset,
owner: MultiLocation
) -> Result<Self::LockTicket, LockError>;
fn prepare_unlock(
locker: MultiLocation,
asset: MultiAsset,
owner: MultiLocation
) -> Result<Self::UnlockTicket, LockError>;
fn note_unlockable(
locker: MultiLocation,
asset: MultiAsset,
owner: MultiLocation
) -> Result<(), LockError>;
fn prepare_reduce_unlockable(
locker: MultiLocation,
asset: MultiAsset,
owner: MultiLocation
) -> Result<Self::ReduceTicket, LockError>;
}
Expand description
Define a handler for notification of an asset being locked and for the unlock instruction.
Required Associated Types§
type LockTicket: Enact
type LockTicket: Enact
Enact
implementer for prepare_lock
. This type may be dropped safely to avoid doing the
lock.
type UnlockTicket: Enact
type UnlockTicket: Enact
Enact
implementer for prepare_unlock
. This type may be dropped safely to avoid doing the
unlock.
type ReduceTicket: Enact
type ReduceTicket: Enact
Enact
implementer for prepare_reduce_unlockable
. This type may be dropped safely to
avoid doing the unlock.
Required Methods§
fn prepare_lock(
unlocker: MultiLocation,
asset: MultiAsset,
owner: MultiLocation
) -> Result<Self::LockTicket, LockError>
fn prepare_lock( unlocker: MultiLocation, asset: MultiAsset, owner: MultiLocation ) -> 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
.
fn prepare_unlock(
locker: MultiLocation,
asset: MultiAsset,
owner: MultiLocation
) -> Result<Self::UnlockTicket, LockError>
fn prepare_unlock( locker: MultiLocation, asset: MultiAsset, owner: MultiLocation ) -> 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
.
fn note_unlockable(
locker: MultiLocation,
asset: MultiAsset,
owner: MultiLocation
) -> Result<(), LockError>
fn note_unlockable( locker: MultiLocation, asset: MultiAsset, owner: MultiLocation ) -> 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.
fn prepare_reduce_unlockable(
locker: MultiLocation,
asset: MultiAsset,
owner: MultiLocation
) -> Result<Self::ReduceTicket, LockError>
fn prepare_reduce_unlockable( locker: MultiLocation, asset: MultiAsset, owner: MultiLocation ) -> 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
.