diff --git a/libs/traits/src/liquidity_pools.rs b/libs/traits/src/liquidity_pools.rs index 51d0717224..8d983d272b 100644 --- a/libs/traits/src/liquidity_pools.rs +++ b/libs/traits/src/liquidity_pools.rs @@ -83,7 +83,11 @@ pub trait LpMessageForwarded: Sized { fn unwrap_forwarded(self) -> Option<(Self::Domain, H160, Self)>; /// Attempts to wrap into a forwarded message. - fn try_wrap_forward(forwarding_contract: H160, message: Self) -> Result; + fn try_wrap_forward( + domain: Self::Domain, + forwarding_contract: H160, + message: Self, + ) -> Result; } pub trait RouterProvider: Sized { diff --git a/pallets/liquidity-pools-forwarder/src/lib.rs b/pallets/liquidity-pools-forwarder/src/lib.rs index dc30b839b5..a93d4cb8d4 100644 --- a/pallets/liquidity-pools-forwarder/src/lib.rs +++ b/pallets/liquidity-pools-forwarder/src/lib.rs @@ -210,7 +210,9 @@ pub mod pallet { message: T::Message, ) -> DispatchResult { let msg = RouterForwarding::::get(&router_id) - .map(|info| T::Message::try_wrap_forward(info.contract, message.clone())) + .map(|info| { + T::Message::try_wrap_forward(Domain::Centrifuge, info.contract, message.clone()) + }) .unwrap_or_else(|| { ensure!(!message.is_forwarded(), Error::::ForwardInfoNotFound); Ok(message) diff --git a/pallets/liquidity-pools-forwarder/src/mock.rs b/pallets/liquidity-pools-forwarder/src/mock.rs index 32bd88ee10..c30bf2fcbb 100644 --- a/pallets/liquidity-pools-forwarder/src/mock.rs +++ b/pallets/liquidity-pools-forwarder/src/mock.rs @@ -46,7 +46,7 @@ impl LpMessageForwarded for Message { } } - fn try_wrap_forward(_: H160, message: Self) -> Result { + fn try_wrap_forward(_: Self::Domain, _: H160, message: Self) -> Result { match message { Self::Forward => Err(ERROR_NESTING), Self::NonForward => Ok(Self::Forward), diff --git a/pallets/liquidity-pools/src/message.rs b/pallets/liquidity-pools/src/message.rs index 0c41d19c64..07d469dd0e 100644 --- a/pallets/liquidity-pools/src/message.rs +++ b/pallets/liquidity-pools/src/message.rs @@ -659,9 +659,13 @@ impl LpMessageForwarded for Message { } } - fn try_wrap_forward(forwarding_contract: H160, message: Self) -> Result { + fn try_wrap_forward( + source_domain: Self::Domain, + forwarding_contract: H160, + message: Self, + ) -> Result { Ok(Self::Forwarded { - source_domain: Domain::Centrifuge.into(), + source_domain: source_domain.into(), forwarding_contract, message: message.try_into().map_err(|_| { DispatchError::Other(