I'm fairly new to Rust and ink! itself.
I'm trying to compile and build an extremely basic PSP22 Contract.
I get the following error when I compile & build:
(running cargo +nightly contract build
)
The following is my Contract (lib.rs
) :
#![cfg_attr(not(feature = "std"), no_std)]
#![feature(min_specialization)]
#[openbrush::contract]
pub mod my_psp22 {
// imports from openbrush
use openbrush::contracts::psp22::*;
use openbrush::traits::Storage;
#[ink(storage)]
#[derive(Default, Storage)]
pub struct Ipsp22 {
#[storage_field]
psp22: psp22::Data,
}
// Section contains default implementation without any modifications
impl PSP22 for Ipsp22 {}
impl Ipsp22 {
#[ink(constructor)]
pub fn new(initial_supply: Balance) -> Self {
let mut _instance = Self::default();
_instance._mint_to(_instance.env().caller(), initial_supply).expect("Should mint");
_instance
}
}
}
And here is my Cargo.toml :
[package]
name = "my_token"
version = "0.1.0"
authors = ["0xD1x0n"]
edition = "2021"
license = "Apache 2.0"
[dependencies]
ink = { version = "~4.0.0", default-features = false }
openbrush = { git = "https://github.com/727-Ventures/openbrush-contracts/", tag = "3.0.0", default-features = false, features = ["psp22", "ownable"] }
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
[lib]
name = "my_token"
path = "lib.rs"
crate-type = [
"cdylib",
"rlib",
]
[features]
default = ["std"]
std = [
"ink/std",
"scale/std",
"scale-info/std",
"openbrush/std",
]
ink-as-dependency = []
I am using the following versions of these tools:
- rustc 1.69.0 (84c898d65 2023-04-16)
- cargo-contract-contract 2.2.1-91b5a86-aarch64-apple-darwin
- rustup 1.26.0 (5af9b9484 2023-04-05)
I'm not quite sure why its happening, any help would be deeply appreciated