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

LiquidityPools: Add restriction_set field to AddTranche message #1610

Merged
merged 2 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
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
Loading