Skip to content

Commit

Permalink
LiquidityPools: Add restriction_set field to AddTranche message (#…
Browse files Browse the repository at this point in the history
…1610)

* LP: Add restriction_set field to AddTranche message

* fmt
  • Loading branch information
NunoAlexandre authored Nov 20, 2023
1 parent 8d78e6f commit c49ac60
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions pallets/liquidity-pools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
)?;

Expand Down
9 changes: 8 additions & 1 deletion pallets/liquidity-pools/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down Expand Up @@ -436,6 +439,7 @@ impl<
token_name,
token_symbol,
decimals,
restriction_set,
} => encoded_message(
self.call_type(),
vec![
Expand All @@ -444,6 +448,7 @@ impl<
token_name.encode(),
token_symbol.encode(),
decimals.encode(),
restriction_set.encode(),
],
),
Message::UpdateTrancheTokenPrice {
Expand Down Expand Up @@ -749,6 +754,7 @@ impl<
token_name: decode::<TOKEN_NAME_SIZE, _, _>(input)?,
token_symbol: decode::<TOKEN_SYMBOL_SIZE, _, _>(input)?,
decimals: decode::<1, _, _>(input)?,
restriction_set: decode::<1, _, _>(input)?,
}),
5 => Ok(Self::UpdateTrancheTokenPrice {
pool_id: decode_be_bytes::<8, _, _>(input)?,
Expand Down Expand Up @@ -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",
)
}

Expand Down

0 comments on commit c49ac60

Please sign in to comment.