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

Generating cis3 signatures in test case #359

Merged
merged 8 commits into from
Nov 22, 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
2 changes: 1 addition & 1 deletion concordium-rust-sdk
1 change: 1 addition & 0 deletions contract-testing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ pub use concordium_base::{
OwnedContractName, OwnedEntrypointName, OwnedParameter, OwnedReceiveName, Parameter,
ReceiveName, SignatureThreshold, SlotTime, Timestamp,
},
ed25519,
hashes::BlockHash,
id::types::{AccountKeys, CredentialPublicKeys, VerifyKey},
smart_contracts::{ContractEvent, ContractTraceElement, InstanceUpdatedEvent, WasmVersion},
Expand Down
1 change: 1 addition & 0 deletions examples/cis3-nft-sponsored-txs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ concordium-cis2 = {path = "../../concordium-cis2", default-features = false}

[dev-dependencies]
concordium-smart-contract-testing = { path = "../../contract-testing" }
rand = "0.7.0"

[lib]
crate-type=["cdylib", "rlib"]
Expand Down
10 changes: 6 additions & 4 deletions examples/cis3-nft-sponsored-txs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,15 @@ const SUPPORTS_PERMIT_ENTRYPOINTS: [EntrypointName; 2] =
pub const NONCE_EVENT_TAG: u8 = u8::MAX - 5;

/// Tagged events to be serialized for the event log.
#[derive(Debug, Serial)]
#[derive(Debug, Serial, Deserial, PartialEq, Eq)]
#[concordium(repr(u8))]
pub enum Event {
/// The event tracks the nonce used by the signer of the `PermitMessage`
/// whenever the `permit` function is invoked.
#[concordium(tag = 250)]
Nonce(NonceEvent),
#[concordium(forward = cis2_events)]
abizjak marked this conversation as resolved.
Show resolved Hide resolved
Cis2Event(Cis2Event<ContractTokenId, ContractTokenAmount>),
}

/// The NonceEvent is logged when the `permit` function is invoked. The event
Expand Down Expand Up @@ -744,7 +746,7 @@ fn contract_view_message_hash(
// or sign a message (in that case the prepend is `account` address and 8 zero
// bytes). Hence, the 8 zero bytes ensure that the user does not accidentally
// sign a transaction. The account nonce is of type u64 (8 bytes).
let mut msg_prepend = vec![0; 32 + 8];
let mut msg_prepend = [0; 32 + 8];
// Prepend the `account` address of the signer.
msg_prepend[0..32].copy_from_slice(param.signer.as_ref());
// Prepend 8 zero bytes.
Expand Down Expand Up @@ -962,10 +964,10 @@ fn contract_operator_of(

/// Parameter type for the CIS-2 function `balanceOf` specialized to the subset
/// of TokenIDs used by this contract.
type ContractBalanceOfQueryParams = BalanceOfQueryParams<ContractTokenId>;
pub type ContractBalanceOfQueryParams = BalanceOfQueryParams<ContractTokenId>;
/// Response type for the CIS-2 function `balanceOf` specialized to the subset
/// of TokenAmounts used by this contract.
type ContractBalanceOfQueryResponse = BalanceOfQueryResponse<ContractTokenAmount>;
pub type ContractBalanceOfQueryResponse = BalanceOfQueryResponse<ContractTokenAmount>;

/// Get the balance of given token IDs and addresses.
///
Expand Down
Loading
Loading