Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
DOBEN committed Dec 4, 2023
1 parent 27a7e04 commit 45e3d08
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
8 changes: 4 additions & 4 deletions concordium-cis2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@ pub struct OnReceivingCis2Params<T, A> {
pub amount: A,
/// The previous owner of the tokens.
pub from: Address,
/// Some extra information which where sent as part of the transfer.
/// Some extra information which was sent as part of the transfer.
pub data: AdditionalData,
}

Expand All @@ -1262,7 +1262,7 @@ pub struct OnReceivingCis2DataParams<T, A, D> {
pub amount: A,
/// The previous owner of the tokens.
pub from: Address,
/// Some extra information which where sent as part of the transfer.
/// Some extra information which was sent as part of the transfer.
pub data: D,
}

Expand All @@ -1286,8 +1286,8 @@ impl<T: Serial, A: Serial, D: Serial> Serial for OnReceivingCis2DataParams<T, A,
self.token_id.serial(out)?;
self.amount.serial(out)?;
self.from.serial(out)?;
(to_bytes(&self.data).len() as u16).serial(out)?;
out.write_all(&to_bytes(&self.data))?;
let add = AdditionalData(to_bytes(&self.data));
add.serial(out)?;
Ok(())
}
}
Expand Down
12 changes: 12 additions & 0 deletions examples/sponsored-tx-enabled-auction/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,3 +474,15 @@ fn view_item_state(ctx: &ReceiveContext, host: &Host<State>) -> ContractResult<I
let item = host.state().items.get(&item_index).map(|x| x.to_owned()).ok_or(Error::NoItem)?;
Ok(item)
}

/// Helper function that can be invoked at the front-end to serialize the
/// `AdditionalDataIndex` before generating the message to be signed in the
/// wallet.
#[receive(
contract = "sponsored_tx_enabled_auction",
name = "serializationHelper",
parameter = "AdditionalDataIndex"
)]
fn contract_serialization_helper(_ctx: &ReceiveContext, _host: &Host<State>) -> ContractResult<()> {
Ok(())
}

0 comments on commit 45e3d08

Please sign in to comment.