fix log targets for nonfungibles-adapter (#7154)

* fix log targets for nonfungibles-adapter

* change target

* make const for LOG_TARGET and fmt
This commit is contained in:
Just van Stam
2023-05-02 16:22:34 +02:00
committed by GitHub
parent d50ff483f8
commit e22e449c4a
@@ -25,6 +25,8 @@ use sp_std::{marker::PhantomData, prelude::*, result};
use xcm::latest::prelude::*;
use xcm_executor::traits::{Convert, Error as MatchError, MatchesNonFungibles, TransactAsset};
const LOG_TARGET: &str = "xcm::nonfungibles_adapter";
pub struct NonFungiblesTransferAdapter<Assets, Matcher, AccountIdConverter, AccountId>(
PhantomData<(Assets, Matcher, AccountIdConverter, AccountId)>,
);
@@ -42,9 +44,12 @@ impl<
context: &XcmContext,
) -> result::Result<xcm_executor::Assets, XcmError> {
log::trace!(
target: "xcm::non_fungibles_adapter",
target: LOG_TARGET,
"transfer_asset what: {:?}, from: {:?}, to: {:?}, context: {:?}",
what, from, to, context,
what,
from,
to,
context,
);
// Check we handle this asset.
let (class, instance) = Matcher::matches_nonfungibles(what)?;
@@ -126,9 +131,11 @@ impl<
{
fn can_check_in(_origin: &MultiLocation, what: &MultiAsset, context: &XcmContext) -> XcmResult {
log::trace!(
target: "xcm::fungibles_adapter",
target: LOG_TARGET,
"can_check_in origin: {:?}, what: {:?}, context: {:?}",
_origin, what, context,
_origin,
what,
context,
);
// Check we handle this asset.
let (class, instance) = Matcher::matches_nonfungibles(what)?;
@@ -143,9 +150,11 @@ impl<
fn check_in(_origin: &MultiLocation, what: &MultiAsset, context: &XcmContext) {
log::trace!(
target: "xcm::fungibles_adapter",
target: LOG_TARGET,
"check_in origin: {:?}, what: {:?}, context: {:?}",
_origin, what, context,
_origin,
what,
context,
);
if let Ok((class, instance)) = Matcher::matches_nonfungibles(what) {
match CheckAsset::asset_checking(&class) {
@@ -160,9 +169,11 @@ impl<
fn can_check_out(_dest: &MultiLocation, what: &MultiAsset, context: &XcmContext) -> XcmResult {
log::trace!(
target: "xcm::fungibles_adapter",
target: LOG_TARGET,
"can_check_out dest: {:?}, what: {:?}, context: {:?}",
_dest, what, context,
_dest,
what,
context,
);
// Check we handle this asset.
let (class, instance) = Matcher::matches_nonfungibles(what)?;
@@ -177,9 +188,11 @@ impl<
fn check_out(_dest: &MultiLocation, what: &MultiAsset, context: &XcmContext) {
log::trace!(
target: "xcm::fungibles_adapter",
target: LOG_TARGET,
"check_out dest: {:?}, what: {:?}, context: {:?}",
_dest, what, context,
_dest,
what,
context,
);
if let Ok((class, instance)) = Matcher::matches_nonfungibles(what) {
match CheckAsset::asset_checking(&class) {
@@ -194,9 +207,11 @@ impl<
fn deposit_asset(what: &MultiAsset, who: &MultiLocation, context: &XcmContext) -> XcmResult {
log::trace!(
target: "xcm::fungibles_adapter",
target: LOG_TARGET,
"deposit_asset what: {:?}, who: {:?}, context: {:?}",
what, who, context,
what,
who,
context,
);
// Check we handle this asset.
let (class, instance) = Matcher::matches_nonfungibles(what)?;
@@ -212,9 +227,11 @@ impl<
maybe_context: Option<&XcmContext>,
) -> result::Result<xcm_executor::Assets, XcmError> {
log::trace!(
target: "xcm::fungibles_adapter",
target: LOG_TARGET,
"withdraw_asset what: {:?}, who: {:?}, maybe_context: {:?}",
what, who, maybe_context,
what,
who,
maybe_context,
);
// Check we handle this asset.
let who = AccountIdConverter::convert_ref(who)