Semi fungible tokens

I am using following tutorial Mint a semi-fungible token — Concordium documentation

However, I am getting following errors when trying to build

Compiling proc-macro2 v1.0.86
Compiling static_assertions v1.1.0
Compiling base64 v0.21.7
Compiling hex v0.4.3
Compiling hashbrown v0.11.2
Compiling fnv v1.0.7
Compiling crunchy v0.2.2
Compiling byteorder v1.5.0
error[E0463]: can’t find crate for core
|
= note: the wasm32-unknown-unknown target may not be installed
= help: consider downloading the target with rustup target add wasm32-unknown-unknown

error[E0463]: can’t find crate for std
|
= note: the wasm32-unknown-unknown target may not be installed
= help: consider downloading the target with rustup target add wasm32-unknown-unknown

For more information about this error, try rustc --explain E0463.
error: could not compile hex (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish…
error: could not compile crunchy (lib) due to 1 previous error
error: could not compile fnv (lib) due to 1 previous error
error: could not compile byteorder (lib) due to 1 previous error
error: could not compile base64 (lib) due to 1 previous error
error: could not compile static_assertions (lib) due to 1 previous error
error: could not compile hashbrown (lib) due to 1 previous error
Error: Could not build smart contract.

Caused by:
0: Could not build module schema.
1: Compilation failed.

Building contracts on Concordium requires the wasm32-unknown-unknown target to be installed. You can run the command to install it:

rustup target add wasm32-unknown-unknown

More information to set up your development environment can be found here:
https://developer.concordium.software/en/mainnet/smart-contracts/tutorials/setup-env.html#setup-env

1 Like

Thx but I get following error

error: cannot find derive macro StateClone in this scope
→ src/lib.rs:221:37
|
221 | #[derive(Serial, DeserialWithState, StateClone)]

The contract state no longer needs to implement StateClone trait in order to work with the test infrastructure. You can remove the word StateClone in the smart contract snippet to resolve this error.

Our old test infrastructure (which required StateClone trait) is deprecated in favor of using integration tests. The below library should be used to write integration tests for your smart contract.

You can update your Cargo.toml file to use the integration testing library as follows:

[dev-dependencies]
concordium-smart-contract-testing = "4.2"

Thx now recieving following error

error[E0433]: failed to resolve: use of undeclared crate or module hex
→ src/lib.rs:185:23
|
185 | let hex_res = hex::decode_to_slice(self.hash.to_owned(), &mut hash_bytes);

My Cargo.toml

[package]
name = “semi_ft”
version = “0.1.0”
authors = [ “muniryasir muniryasir2009@gmail.com” ]
edition = “2021”
license = “MPL-2.0”
description = “1”

[features]
default = [“std”, “bump_alloc”]
std = [“concordium-std/std”, “concordium-cis2/std”]
bump_alloc = [“concordium-std/bump_alloc”]

[dependencies]
concordium-std = {path = “/home/yasir/concordium_dev/contracts/semi-FT/concordium-rust-smart-contracts/concordium-std”, default-features = false}
concordium-cis2 = {path = “/home/yasir/concordium_dev/contracts/semi-FT/concordium-rust-smart-contracts/concordium-cis2”, default-features = false}

[dev-dependencies]
concordium-smart-contract-testing = {path = “/home/yasir/concordium_dev/contracts/semi-FT/concordium-rust-smart-contracts/contract-testing”}
concordium-std-derive = { path = “/home/yasir/concordium_dev/contracts/semi-FT/concordium-rust-smart-contracts/concordium-std-derive” }
rand = “0.8”

cargo add hex

Thx getting following error

error[E0609]: no field blacklist on type &mut State
→ src/lib.rs:867:58
|
867 | fn add_blacklist(&mut self, address: Address) { self.blacklist.insert(address); }
| ^^^^^^^^^ unknown field

Can you share the code repository, please?