In my smart contract, all the ink dependencies are set to =3.0.1
because of this issue:
Cargo contract 3.0.1
When I tried to execute the cargo contract build
or even cargo +nightly contract build
to the flipper project, it results into this error:
error[E0061]: this function takes 2 arguments but 1 argument was supplied
--> lib.rs:18:9
|
18 | / /// Constructor that initializes the `bool` value to the given `init_value`.
19 | | #[ink(constructor)]
20 | | pub fn new(init_value: bool) -> Self {
21 | | Self { value: init_value }
22 | | }
| | ^
| | |
| |_________supplied 1 argument
| expected 2 arguments
|
note: function defined here
--> /home/.cargo/registry/src/github.com-1ecc6299db9ec823/ink_lang-3.0.1/src/codegen/dispatch/execution.rs:81:8
|
81 | pub fn execute_constructor<Contract, F, R>(
| ^^^^^^^^^^^^^^^^^^^
error[E0061]: this function takes 2 arguments but 1 argument was supplied
--> lib.rs:24:9
|
24 | / /// Constructor that initializes the `bool` value to `false`.
25 | | ///
26 | | /// Constructors can delegate to other constructors.
27 | | #[ink(constructor)]
28 | | pub fn default() -> Self {
29 | | Self::new(Default::default())
30 | | }
| | ^
| | |
| |_________supplied 1 argument
| expected 2 arguments
|
note: function defined here
--> /home/.cargo/registry/src/github.com-1ecc6299db9ec823/ink_lang-3.0.1/src/codegen/dispatch/execution.rs:81:8
|
81 | pub fn execute_constructor<Contract, F, R>(
| ^^^^^^^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0061`.
error: could not compile `flipper` due to 2 previous errors
Error: Compilation failed with toolchain `nightly-2022-03-14-x86_64-unknown-linux-gnu`
Caused by:
command failed: "cargo" "check" "--target-dir" "/home/projects/flipper/target/dylint/target/nightly-2022-03-14-x86_64-unknown-linux-gnu" "--manifest-path" "/home/projects/flipper/Cargo.toml"
ERROR: `"/home/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo" "dylint" "--lib" "ink_linting" "--manifest-path=/home/projects/flipper/Cargo.toml"` failed with exit code: Some(1)
I'm at my wit's end.
(I would like to specify that the substrate runtime is for polkadot-v0.9.18
)
To replicate:
- I am using
rustc 1.63.0-nightly (4cbaac699 2022-05-25)
- The
cargo contract
version is 1.4. - The smart contract is the flipper:
cargo contract new flipper
- And then in the .toml file:
[package]
name = "flipper"
version = "0.1.0"
authors = ["[your_name] <[your_email]>"]
edition = "2021"
[dependencies]
ink_primitives = { version = "=3.0.1", default-features = false }
ink_metadata = { version = "=3.0.1", default-features = false, features = ["derive"], optional = true }
ink_env = { version = "=3.0.1", default-features = false }
ink_storage = { version = "=3.0.1", default-features = false }
ink_lang = { version = "=3.0.1", default-features = false }
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2", default-features = false, features = ["derive"], optional = true }
[lib]
name = "flipper"
path = "lib.rs"
crate-type = [
# Used for normal contract Wasm blobs.
"cdylib",
]
[features]
default = ["std"]
std = [
"ink_metadata/std",
"ink_env/std",
"ink_storage/std",
"ink_primitives/std",
"scale/std",
"scale-info/std",
]
ink-as-dependency = []
cargo contract new flipper
, then changed all versions to"=3.0.1"
module imports a non-existent function
error.polkadot-v0.9.19