-1
#![cfg_attr(not(feature = "std"), no_std)]

use ink_lang as ink;

#[ink::contract]

mod XYZ {

    #[ink(storage)]
    pub struct Xyz {
        token_id: u32,
        serial_code: String
    }
    ...
}

错误:

             serial_code: String
   |                      ^^^^^^ not found in this scope
4

1 回答 1

2

基于- 您应该使用包含String类型 ink!

use ink_prelude::string::String;

并包含在正确的 Cargo.toml 文件中:

[Dependencies]
ink_prelude = { version = "2", git = "github.com/paritytech/ink", tag = "latest-v2", package = "ink_prelude", default-features = false }"

(或任何适合您的版本)

于 2021-10-06T16:31:30.207 回答