diff --git a/bridges/snowbridge/pallets/inbound-queue/src/lib.rs b/bridges/snowbridge/pallets/inbound-queue/src/lib.rs index 423b92b9fae0..dda12c285d38 100644 --- a/bridges/snowbridge/pallets/inbound-queue/src/lib.rs +++ b/bridges/snowbridge/pallets/inbound-queue/src/lib.rs @@ -155,11 +155,11 @@ pub mod pallet { nonce: u64, /// ID of the XCM message which was forwarded to the final destination parachain message_id: [u8; 32], - /// Fee burned for the teleport - fee_burned: BalanceOf, }, /// Set OperatingMode OperatingModeChanged { mode: BasicOperatingMode }, + /// A XCM message was sent. + Sent { destination: Location, message_id: XcmHash }, } #[pallet::error] @@ -241,6 +241,12 @@ pub mod pallet { let envelope = Envelope::try_from(&message.event_log).map_err(|_| Error::::InvalidEnvelope)?; + Self::deposit_event(Event::MessageReceived { + channel_id: envelope.channel_id, + nonce: envelope.nonce, + message_id: envelope.message_id.into(), + }); + // Verify that the message was submitted from the known Gateway contract ensure!(T::GatewayAddress::get() == envelope.gateway, Error::::InvalidGateway); @@ -293,14 +299,7 @@ pub mod pallet { Self::burn_fees(channel.para_id, fee)?; // Attempt to send XCM to a dest parachain - let message_id = Self::send_xcm(xcm, channel.para_id)?; - - Self::deposit_event(Event::MessageReceived { - channel_id: envelope.channel_id, - nonce: envelope.nonce, - message_id, - fee_burned: fee, - }); + Self::send_xcm(xcm, channel.para_id)?; Ok(()) } @@ -331,7 +330,9 @@ pub mod pallet { pub fn send_xcm(xcm: Xcm<()>, dest: ParaId) -> Result> { let dest = Location::new(1, [Parachain(dest.into())]); - let (xcm_hash, _) = send_xcm::(dest, xcm).map_err(Error::::from)?; + let (xcm_hash, _) = + send_xcm::(dest.clone(), xcm.clone()).map_err(Error::::from)?; + Self::deposit_event(Event::Sent { destination: dest, message_id: xcm_hash }); Ok(xcm_hash) } diff --git a/prdoc/pr_6965.prdoc b/prdoc/pr_6965.prdoc new file mode 100644 index 000000000000..977b05e15ec0 --- /dev/null +++ b/prdoc/pr_6965.prdoc @@ -0,0 +1,9 @@ +title: 'Snowbridge: Emit sent xcm from BH to AH' +doc: +- audience: Runtime Dev + description: Emit the sent xcm from BH to AH which is helpful + to index the transfer across multiple chains. +crates: +- name: snowbridge-pallet-inbound-queue + bump: patch +