Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LP Tweaks #1557

Merged
merged 5 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions libs/types/src/domain_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use cfg_traits::liquidity_pools::Codec;
use cfg_utils::{decode_be_bytes, vec_to_fixed_array};
use codec::{Decode, Encode, Input, MaxEncodedLen};
use frame_support::RuntimeDebug;
use scale_info::TypeInfo;
use sp_runtime::traits::{AccountIdConversion, Convert};
use sp_std::{vec, vec::Vec};
Expand All @@ -23,8 +24,7 @@ use crate::EVMChainId;
/// The domain indices need to match those used in the EVM contracts and these
/// need to pass the Centrifuge domain to send tranche tokens from the other
/// domain here. Therefore, DO NOT remove or move variants around.
#[derive(Encode, Decode, Clone, PartialEq, Eq, TypeInfo, MaxEncodedLen)]
#[cfg_attr(feature = "std", derive(Debug))]
#[derive(Encode, Decode, Clone, Eq, MaxEncodedLen, PartialEq, RuntimeDebug, TypeInfo)]
pub enum Domain {
/// Referring to the Centrifuge Parachain. Will be used for handling
/// incoming messages.
Expand Down Expand Up @@ -77,8 +77,7 @@ pub struct DomainLocator<Domain> {
pub domain: Domain,
}

#[derive(Encode, Decode, Clone, PartialEq, Eq, TypeInfo, MaxEncodedLen)]
#[cfg_attr(feature = "std", derive(Debug))]
#[derive(Encode, Decode, Clone, Eq, MaxEncodedLen, PartialEq, RuntimeDebug, TypeInfo)]
pub enum DomainAddress {
/// A Centrifuge-Chain based account address, 32-bytes long
Centrifuge([u8; 32]),
Expand Down
10 changes: 5 additions & 5 deletions pallets/liquidity-pools-gateway/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub mod pallet {
///
/// NOTE - this `Codec` trait is the Centrifuge trait for liquidity
/// pools' messages.
type Message: Codec + Clone;
type Message: Codec + Clone + Debug + PartialEq;

/// The message router type that is stored for each domain.
type Router: DomainRouter<Sender = Self::AccountId, Message = Self::Message>
Expand Down Expand Up @@ -145,8 +145,8 @@ pub mod pallet {
/// An outbound message has been submitted.
OutboundMessageSubmitted {
sender: T::AccountId,
message: Vec<u8>,
domain: Domain,
message: T::Message,
},
}

Expand Down Expand Up @@ -478,7 +478,7 @@ pub mod pallet {
fn submit(
sender: Self::Sender,
destination: Self::Destination,
msg: Self::Message,
message: Self::Message,
) -> DispatchResult {
ensure!(
destination != Domain::Centrifuge,
Expand All @@ -488,12 +488,12 @@ pub mod pallet {
let router =
DomainRouters::<T>::get(destination.clone()).ok_or(Error::<T>::RouterNotFound)?;

router.send(T::Sender::get(), msg.clone())?;
router.send(T::Sender::get(), message.clone())?;

Self::deposit_event(Event::OutboundMessageSubmitted {
sender,
message: msg.serialize(),
domain: destination,
message,
});

Ok(())
Expand Down
4 changes: 2 additions & 2 deletions pallets/liquidity-pools/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use cfg_primitives::Moment;
use cfg_traits::liquidity_pools::Codec;
use cfg_utils::{decode, decode_be_bytes, encode_be};
use codec::{Decode, Encode, Input};
use frame_support::RuntimeDebug;
use scale_info::TypeInfo;
use sp_std::{vec, vec::Vec};

Expand All @@ -28,8 +29,7 @@ pub const TOKEN_SYMBOL_SIZE: usize = 32;
///
/// NOTE: The sender of a message cannot ensure whether the
/// corresponding receiver rejects it.
#[derive(Encode, Decode, Clone, PartialEq, Eq, TypeInfo)]
#[cfg_attr(feature = "std", derive(Debug))]
#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)]
pub enum Message<Domain, PoolId, TrancheId, Balance, Ratio>
where
Domain: Codec,
Expand Down
Loading