From c49ac60d874b77a7ac4bda5f4bbd3794cd2b5d83 Mon Sep 17 00:00:00 2001 From: Nuno Alexandre Date: Mon, 20 Nov 2023 13:58:35 +0100 Subject: [PATCH] LiquidityPools: Add `restriction_set` field to `AddTranche` message (#1610) * LP: Add restriction_set field to AddTranche message * fmt --- pallets/liquidity-pools/src/lib.rs | 4 ++++ pallets/liquidity-pools/src/message.rs | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pallets/liquidity-pools/src/lib.rs b/pallets/liquidity-pools/src/lib.rs index f45a0bcdf9..5961b87e20 100644 --- a/pallets/liquidity-pools/src/lib.rs +++ b/pallets/liquidity-pools/src/lib.rs @@ -426,6 +426,10 @@ pub mod pallet { decimals: metadata.decimals.saturated_into(), token_name, token_symbol, + // NOTE: This value is for now intentionally hardcoded to 1 since that's the + // only available option. We will design a dynamic approach going forward where + // this value can be set on a per-tranche-token basis on storage. + restriction_set: 1, }, )?; diff --git a/pallets/liquidity-pools/src/message.rs b/pallets/liquidity-pools/src/message.rs index 4df15d4bec..d0e21f1257 100644 --- a/pallets/liquidity-pools/src/message.rs +++ b/pallets/liquidity-pools/src/message.rs @@ -71,6 +71,9 @@ where token_name: [u8; TOKEN_NAME_SIZE], token_symbol: [u8; TOKEN_SYMBOL_SIZE], decimals: u8, + /// The RestrictionManager implementation to be used for this tranche + /// token on the domain it will be added and subsequently deployed in. + restriction_set: u8, }, /// Update the price of a tranche token on the target domain. /// @@ -436,6 +439,7 @@ impl< token_name, token_symbol, decimals, + restriction_set, } => encoded_message( self.call_type(), vec![ @@ -444,6 +448,7 @@ impl< token_name.encode(), token_symbol.encode(), decimals.encode(), + restriction_set.encode(), ], ), Message::UpdateTrancheTokenPrice { @@ -749,6 +754,7 @@ impl< token_name: decode::(input)?, token_symbol: decode::(input)?, decimals: decode::<1, _, _>(input)?, + restriction_set: decode::<1, _, _>(input)?, }), 5 => Ok(Self::UpdateTrancheTokenPrice { pool_id: decode_be_bytes::<8, _, _>(input)?, @@ -1017,8 +1023,9 @@ mod tests { token_name: vec_to_fixed_array("Some Name".to_string().into_bytes()), token_symbol: vec_to_fixed_array("SYMBOL".to_string().into_bytes()), decimals: 15, + restriction_set: 1, }, - "040000000000000001811acd5b3f17c06841c7e41e9e04cb1b536f6d65204e616d65000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000053594d424f4c00000000000000000000000000000000000000000000000000000f", + "040000000000000001811acd5b3f17c06841c7e41e9e04cb1b536f6d65204e616d65000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000053594d424f4c00000000000000000000000000000000000000000000000000000f01", ) }