Skip to content

Commit

Permalink
add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
gitofdeepanshu committed Aug 9, 2023
1 parent 6309b53 commit 2a21e1e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion precompiles/utils/src/xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ impl EvmData for MultiLocation {
<(u8, Junctions)>::has_static_size()
}
}

#[derive(Debug)]
pub struct EvmMultiAsset {
location: MultiLocation,
amount: U256,
Expand Down
28 changes: 26 additions & 2 deletions precompiles/xcm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ where
},
Transact {
origin_kind: OriginKind::SovereignAccount,
require_weight_at_most: Weight::from_parts(transact_weight,DEFAULT_PROOF_SIZE),
require_weight_at_most: Weight::from_parts(transact_weight, DEFAULT_PROOF_SIZE),
call: remote_call.into(),
},
]);
Expand Down Expand Up @@ -568,7 +568,7 @@ where
},
Transact {
origin_kind: OriginKind::SovereignAccount,
require_weight_at_most: Weight::from_parts(transact_weight,DEFAULT_PROOF_SIZE),
require_weight_at_most: Weight::from_parts(transact_weight, DEFAULT_PROOF_SIZE),
call: remote_call.into(),
},
]);
Expand Down Expand Up @@ -714,6 +714,10 @@ where
WeightLimit::Limited(Weight::from_parts(weight, DEFAULT_PROOF_SIZE))
};

log::trace!(target: "xcm-precompile::transfer", "Raw arguments: currency_address: {:?}, amount_of_tokens: {:?}, destination: {:?}, \
weight: {:?}, calculated asset_id: {:?}",
currency_address, amount_of_tokens, destination, weight, asset_id);

let call = orml_xtokens::Call::<Runtime>::transfer {
currency_id: asset_id.into(),
amount: amount_of_tokens,
Expand Down Expand Up @@ -758,6 +762,10 @@ where
WeightLimit::Limited(Weight::from_parts(weight, DEFAULT_PROOF_SIZE))
};

log::trace!(target: "xcm-precompile::transfer_with_fee", "Raw arguments: currency_address: {:?}, amount_of_tokens: {:?}, destination: {:?}, \
weight: {:?}, calculated asset_id: {:?}",
currency_address, amount_of_tokens, destination, weight, asset_id);

let call = orml_xtokens::Call::<Runtime>::transfer_with_fee {
currency_id: asset_id.into(),
amount: amount_of_tokens,
Expand Down Expand Up @@ -796,6 +804,10 @@ where
WeightLimit::Limited(Weight::from_parts(weight, DEFAULT_PROOF_SIZE))
};

log::trace!(target: "xcm-precompile::transfer_multiasset", "Raw arguments: asset_location: {:?}, amount_of_tokens: {:?}, destination: {:?}, \
weight: {:?}",
asset_location, amount_of_tokens, destination, weight);

let call = orml_xtokens::Call::<Runtime>::transfer_multiasset {
asset: Box::new(VersionedMultiAsset::V3(MultiAsset {
id: AssetId::Concrete(asset_location),
Expand Down Expand Up @@ -841,6 +853,10 @@ where
WeightLimit::Limited(Weight::from_parts(weight, DEFAULT_PROOF_SIZE))
};

log::trace!(target: "xcm-precompile::transfer_multiasset_with_fee", "Raw arguments: asset_location: {:?}, amount_of_tokens: {:?}, fee{:?}, destination: {:?}, \
weight: {:?}",
asset_location, amount_of_tokens, fee, destination, weight);

let call = orml_xtokens::Call::<Runtime>::transfer_multiasset_with_fee {
asset: Box::new(VersionedMultiAsset::V3(MultiAsset {
id: AssetId::Concrete(asset_location),
Expand Down Expand Up @@ -901,6 +917,10 @@ where
WeightLimit::Limited(Weight::from_parts(weight, DEFAULT_PROOF_SIZE))
};

log::trace!(target: "xcm-precompile::transfer_multi_currencies", "Raw arguments: currencies: {:?}, fee_item{:?}, destination: {:?}, \
weight: {:?}",
currencies, fee_item, destination, weight);

let call = orml_xtokens::Call::<Runtime>::transfer_multicurrencies {
currencies,
fee_item,
Expand Down Expand Up @@ -936,6 +956,10 @@ where
WeightLimit::Limited(Weight::from_parts(weight, DEFAULT_PROOF_SIZE))
};

log::trace!(target: "xcm-precompile::transfer_multi_assets", "Raw arguments: assets: {:?}, fee_item{:?}, destination: {:?}, \
weight: {:?}",
assets, fee_item, destination, weight);

let multiasset_vec: EvmResult<Vec<MultiAsset>> = assets
.into_iter()
.map(|evm_multiasset| {
Expand Down

0 comments on commit 2a21e1e

Please sign in to comment.