Skip to content
Snippets Groups Projects
Commit e22e449c authored by Just van Stam's avatar Just van Stam Committed by GitHub
Browse files

fix log targets for nonfungibles-adapter (#7154)

* fix log targets for nonfungibles-adapter

* change target

* make const for LOG_TARGET and fmt
parent d50ff483
No related merge requests found
...@@ -25,6 +25,8 @@ use sp_std::{marker::PhantomData, prelude::*, result}; ...@@ -25,6 +25,8 @@ use sp_std::{marker::PhantomData, prelude::*, result};
use xcm::latest::prelude::*; use xcm::latest::prelude::*;
use xcm_executor::traits::{Convert, Error as MatchError, MatchesNonFungibles, TransactAsset}; use xcm_executor::traits::{Convert, Error as MatchError, MatchesNonFungibles, TransactAsset};
const LOG_TARGET: &str = "xcm::nonfungibles_adapter";
pub struct NonFungiblesTransferAdapter<Assets, Matcher, AccountIdConverter, AccountId>( pub struct NonFungiblesTransferAdapter<Assets, Matcher, AccountIdConverter, AccountId>(
PhantomData<(Assets, Matcher, AccountIdConverter, AccountId)>, PhantomData<(Assets, Matcher, AccountIdConverter, AccountId)>,
); );
...@@ -42,9 +44,12 @@ impl< ...@@ -42,9 +44,12 @@ impl<
context: &XcmContext, context: &XcmContext,
) -> result::Result<xcm_executor::Assets, XcmError> { ) -> result::Result<xcm_executor::Assets, XcmError> {
log::trace!( log::trace!(
target: "xcm::non_fungibles_adapter", target: LOG_TARGET,
"transfer_asset what: {:?}, from: {:?}, to: {:?}, context: {:?}", "transfer_asset what: {:?}, from: {:?}, to: {:?}, context: {:?}",
what, from, to, context, what,
from,
to,
context,
); );
// Check we handle this asset. // Check we handle this asset.
let (class, instance) = Matcher::matches_nonfungibles(what)?; let (class, instance) = Matcher::matches_nonfungibles(what)?;
...@@ -126,9 +131,11 @@ impl< ...@@ -126,9 +131,11 @@ impl<
{ {
fn can_check_in(_origin: &MultiLocation, what: &MultiAsset, context: &XcmContext) -> XcmResult { fn can_check_in(_origin: &MultiLocation, what: &MultiAsset, context: &XcmContext) -> XcmResult {
log::trace!( log::trace!(
target: "xcm::fungibles_adapter", target: LOG_TARGET,
"can_check_in origin: {:?}, what: {:?}, context: {:?}", "can_check_in origin: {:?}, what: {:?}, context: {:?}",
_origin, what, context, _origin,
what,
context,
); );
// Check we handle this asset. // Check we handle this asset.
let (class, instance) = Matcher::matches_nonfungibles(what)?; let (class, instance) = Matcher::matches_nonfungibles(what)?;
...@@ -143,9 +150,11 @@ impl< ...@@ -143,9 +150,11 @@ impl<
fn check_in(_origin: &MultiLocation, what: &MultiAsset, context: &XcmContext) { fn check_in(_origin: &MultiLocation, what: &MultiAsset, context: &XcmContext) {
log::trace!( log::trace!(
target: "xcm::fungibles_adapter", target: LOG_TARGET,
"check_in origin: {:?}, what: {:?}, context: {:?}", "check_in origin: {:?}, what: {:?}, context: {:?}",
_origin, what, context, _origin,
what,
context,
); );
if let Ok((class, instance)) = Matcher::matches_nonfungibles(what) { if let Ok((class, instance)) = Matcher::matches_nonfungibles(what) {
match CheckAsset::asset_checking(&class) { match CheckAsset::asset_checking(&class) {
...@@ -160,9 +169,11 @@ impl< ...@@ -160,9 +169,11 @@ impl<
fn can_check_out(_dest: &MultiLocation, what: &MultiAsset, context: &XcmContext) -> XcmResult { fn can_check_out(_dest: &MultiLocation, what: &MultiAsset, context: &XcmContext) -> XcmResult {
log::trace!( log::trace!(
target: "xcm::fungibles_adapter", target: LOG_TARGET,
"can_check_out dest: {:?}, what: {:?}, context: {:?}", "can_check_out dest: {:?}, what: {:?}, context: {:?}",
_dest, what, context, _dest,
what,
context,
); );
// Check we handle this asset. // Check we handle this asset.
let (class, instance) = Matcher::matches_nonfungibles(what)?; let (class, instance) = Matcher::matches_nonfungibles(what)?;
...@@ -177,9 +188,11 @@ impl< ...@@ -177,9 +188,11 @@ impl<
fn check_out(_dest: &MultiLocation, what: &MultiAsset, context: &XcmContext) { fn check_out(_dest: &MultiLocation, what: &MultiAsset, context: &XcmContext) {
log::trace!( log::trace!(
target: "xcm::fungibles_adapter", target: LOG_TARGET,
"check_out dest: {:?}, what: {:?}, context: {:?}", "check_out dest: {:?}, what: {:?}, context: {:?}",
_dest, what, context, _dest,
what,
context,
); );
if let Ok((class, instance)) = Matcher::matches_nonfungibles(what) { if let Ok((class, instance)) = Matcher::matches_nonfungibles(what) {
match CheckAsset::asset_checking(&class) { match CheckAsset::asset_checking(&class) {
...@@ -194,9 +207,11 @@ impl< ...@@ -194,9 +207,11 @@ impl<
fn deposit_asset(what: &MultiAsset, who: &MultiLocation, context: &XcmContext) -> XcmResult { fn deposit_asset(what: &MultiAsset, who: &MultiLocation, context: &XcmContext) -> XcmResult {
log::trace!( log::trace!(
target: "xcm::fungibles_adapter", target: LOG_TARGET,
"deposit_asset what: {:?}, who: {:?}, context: {:?}", "deposit_asset what: {:?}, who: {:?}, context: {:?}",
what, who, context, what,
who,
context,
); );
// Check we handle this asset. // Check we handle this asset.
let (class, instance) = Matcher::matches_nonfungibles(what)?; let (class, instance) = Matcher::matches_nonfungibles(what)?;
...@@ -212,9 +227,11 @@ impl< ...@@ -212,9 +227,11 @@ impl<
maybe_context: Option<&XcmContext>, maybe_context: Option<&XcmContext>,
) -> result::Result<xcm_executor::Assets, XcmError> { ) -> result::Result<xcm_executor::Assets, XcmError> {
log::trace!( log::trace!(
target: "xcm::fungibles_adapter", target: LOG_TARGET,
"withdraw_asset what: {:?}, who: {:?}, maybe_context: {:?}", "withdraw_asset what: {:?}, who: {:?}, maybe_context: {:?}",
what, who, maybe_context, what,
who,
maybe_context,
); );
// Check we handle this asset. // Check we handle this asset.
let who = AccountIdConverter::convert_ref(who) let who = AccountIdConverter::convert_ref(who)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment