Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
lassemoldrup committed May 14, 2024
1 parent 8f8540b commit 167f309
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion concordium-cis2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ default-features = false

[dependencies.concordium-contracts-common]
path = "../concordium-rust-sdk/concordium-base/smart-contracts/contracts-common/concordium-contracts-common"
version = "9.0"
version = "*"
optional = true
default-features = false

Expand Down
7 changes: 7 additions & 0 deletions concordium-cis2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,7 @@ impl AsRef<[u8]> for AdditionalData {
// Note: For the serialization to be derived according to the CIS2
// specification, the order of the fields cannot be changed.
#[derive(Debug, Serialize, Clone, SchemaType)]
#[cfg_attr(feature = "serde", derive(SerdeSerialize, SerdeDeserialize))]
pub struct Transfer<T: IsTokenId, A: IsTokenAmount> {
/// The ID of the token being transferred.
pub token_id: T,
Expand All @@ -1307,6 +1308,7 @@ pub struct Transfer<T: IsTokenId, A: IsTokenAmount> {

/// The parameter type for the contract function `transfer`.
#[derive(Debug, Serialize, Clone, SchemaType)]
#[cfg_attr(feature = "serde", derive(SerdeSerialize, SerdeDeserialize))]
#[concordium(transparent)]
pub struct TransferParams<T: IsTokenId, A: IsTokenAmount>(
#[concordium(size_length = 2)] pub Vec<Transfer<T, A>>,
Expand All @@ -1324,6 +1326,7 @@ impl<T: IsTokenId, A: IsTokenAmount> AsRef<[Transfer<T, A>]> for TransferParams<
// Note: For the serialization to be derived according to the CIS2
// specification, the order of the variants cannot be changed.
#[derive(Debug, Serialize, Clone, Copy, SchemaType, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(SerdeSerialize, SerdeDeserialize))]
pub enum OperatorUpdate {
/// Remove the operator.
Remove,
Expand All @@ -1335,6 +1338,7 @@ pub enum OperatorUpdate {
// Note: For the serialization to be derived according to the CIS2
// specification, the order of the fields cannot be changed.
#[derive(Debug, Serialize, Clone, SchemaType, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(SerdeSerialize, SerdeDeserialize))]
pub struct UpdateOperator {
/// The update for this operator.
pub update: OperatorUpdate,
Expand All @@ -1346,6 +1350,7 @@ pub struct UpdateOperator {

/// The parameter type for the contract function `updateOperator`.
#[derive(Debug, Serialize, Clone, SchemaType)]
#[cfg_attr(feature = "serde", derive(SerdeSerialize, SerdeDeserialize))]
#[concordium(transparent)]
pub struct UpdateOperatorParams(#[concordium(size_length = 2)] pub Vec<UpdateOperator>);

Expand Down Expand Up @@ -1798,7 +1803,9 @@ mod test {
// since the strings are written in little endian order, i.e. "de" is the first
// byte, "ad" is the second, etc.
assert_eq!(parse_bytes_exact::<4>("deadBEEF"), Ok(0xDEADBEEF_u32.to_be_bytes()));
// odd number of characters fails
assert!(parse_bytes_exact::<3>("deadBEE").is_err());
// invalid character fails
assert!(parse_bytes_exact::<4>("deadBEEK").is_err());
}
}
1 change: 1 addition & 0 deletions examples/cis5-smart-contract-wallet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ impl SigningAmount for TokenAmount {}

/// The token amount signed in the message.
#[derive(Serialize, Clone, SchemaType)]
#[cfg_attr(feature = "serde", derive(SerdeSerialize, SerdeDeserialize))]
pub struct TokenAmount {
/// The token amount signed in the message.
pub token_amount: ContractTokenAmount,
Expand Down

0 comments on commit 167f309

Please sign in to comment.