git.delta.rocks / unique-network / refs/commits / f00271a42d7d

difftreelog

Add a working smart contract to transfer NFT

Greg Zaitsev2021-01-28parent: #bf6a3d4.patch.diff
in: master

14 files changed

addedsmart_contracs/transfer/.gitignorediffbeforeafterboth
--- /dev/null
+++ b/smart_contracs/transfer/.gitignore
@@ -0,0 +1,9 @@
+# Ignore build artifacts from the local tests sub-crate.
+/target/
+
+# Ignore backup files creates by cargo fmt.
+**/*.rs.bk
+
+# Remove Cargo.lock when creating an executable, leave it for libraries
+# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock
+Cargo.lock
addedsmart_contracs/transfer/Cargo.tomldiffbeforeafterboth
--- /dev/null
+++ b/smart_contracs/transfer/Cargo.toml
@@ -0,0 +1,35 @@
+[package]
+name = "nft_transfer"
+version = "0.1.0"
+authors = ["[Greg Zaitsev] <[your_email]>"]
+edition = "2018"
+
+[dependencies]
+ink_primitives = { git = "https://github.com/paritytech/ink", branch = "master", default-features = false }
+ink_metadata = { git = "https://github.com/paritytech/ink", branch = "master", default-features = false, features = ["derive"], optional = true }
+ink_env = { git = "https://github.com/paritytech/ink", branch = "master", default-features = false }
+ink_storage = { git = "https://github.com/paritytech/ink", branch = "master", default-features = false }
+ink_lang = { git = "https://github.com/paritytech/ink", branch = "master", default-features = false }
+
+scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
+scale-info = { version = "0.4.1", default-features = false, features = ["derive"], optional = true }
+
+[lib]
+name = "nft_transfer"
+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 = []
addedsmart_contracs/transfer/lib.rsdiffbeforeafterboth
--- /dev/null
+++ b/smart_contracs/transfer/lib.rs
@@ -0,0 +1,75 @@
+#![cfg_attr(not(feature = "std"), no_std)]
+
+use ink_lang as ink;
+use ink_env::{Environment, DefaultEnvironment};
+
+pub enum NftEnvironment {}
+
+impl Environment for NftEnvironment {
+    const MAX_EVENT_TOPICS: usize =
+        <DefaultEnvironment as Environment>::MAX_EVENT_TOPICS;
+
+    type AccountId = <DefaultEnvironment as Environment>::AccountId;
+    type Balance = <DefaultEnvironment as Environment>::Balance;
+    type Hash = <DefaultEnvironment as Environment>::Hash;
+    type BlockNumber = <DefaultEnvironment as Environment>::BlockNumber;
+    type Timestamp = <DefaultEnvironment as Environment>::Timestamp;
+
+    type ChainExtension = NftChainExtension;
+}
+
+/// The shared error code for the NFT chain extension.
+#[derive(
+    Debug, Copy, Clone, PartialEq, Eq, scale::Encode, scale::Decode,
+)]
+pub enum NftErrorCode {
+    SomeError,
+}
+
+impl ink_env::chain_extension::FromStatusCode for NftErrorCode {
+    fn from_status_code(status_code: u32) -> Result<(), Self> {
+        match status_code {
+            0 => Ok(()),
+            1 => Err(Self::SomeError),
+            _ => panic!("encountered unknown status code"),
+        }
+    }
+}
+
+#[ink::chain_extension]
+pub trait NftChainExtension {
+    type ErrorCode = NftErrorCode;
+
+    /// Transfer one NFT token from sender
+    ///
+    #[ink(extension = 0, returns_result = false)]
+    fn transfer(recipient: <DefaultEnvironment as Environment>::AccountId, collection_id: u32, token_id: u32, amount: u128);
+}
+
+#[ink::contract(env = crate::NftEnvironment)]
+mod nft_transfer {
+
+    #[ink(storage)]
+    pub struct NftTransfer {
+    }
+
+    impl NftTransfer {
+        /// Default Constructor
+        ///
+        /// Constructors can delegate to other constructors.
+        #[ink(constructor)]
+        pub fn default() -> Self {
+            Self {}
+        }
+
+        /// Transfer one NFT token
+        #[ink(message)]
+        pub fn transfer(&mut self, recipient: AccountId, collection_id: u32, token_id: u32, amount: u128) {
+            let _ = self.env()
+                .extension()
+                .transfer(recipient, collection_id, token_id, amount);
+        }
+
+    }
+
+}
deletedsmart_contract/ink-types-node-runtime/.gitignorediffbeforeafterboth
--- a/smart_contract/ink-types-node-runtime/.gitignore
+++ /dev/null
@@ -1,16 +0,0 @@
-# Ignore build artifacts
-/target/
-/examples/**/target/
-
-# Ignore backup files creates by cargo fmt.
-**/*.rs.bk
-
-# Remove Cargo.lock when creating an executable, leave it for libraries
-# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock
-Cargo.lock
-
-# Ignore VS Code artifacts.
-**/.vscode/**
-
-# Ignore history files.
-**/.history/**
\ No newline at end of file
deletedsmart_contract/ink-types-node-runtime/Cargo.tomldiffbeforeafterboth
--- a/smart_contract/ink-types-node-runtime/Cargo.toml
+++ /dev/null
@@ -1,54 +0,0 @@
-[package]
-name = "ink_types_node_runtime"
-version = "0.1.0"
-authors = ["Parity Technologies <admin@parity.io>"]
-edition = "2018"
-
-license = "GPL-3.0"
-readme = "README.md"
-
-repository = "https://github.com/usetech-llc/ink"
-homepage = "https://www.parity.io/"
-
-description = "[ink!] Rust based eDSL for writing smart contracts for Substrate"
-keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"]
-categories = ["no-std", "embedded"]
-
-include = ["/Cargo.toml", "src/**/*.rs", "/README.md", "/LICENSE"]
-
-[dependencies]
-ink_core = { version = "2", git = "https://github.com/usetech-llc/ink", tag = "latest-v2", package = "ink_core", default-features = false }
-ink_prelude = { version = "2", git = "https://github.com/usetech-llc/ink", tag = "latest-v2", package = "ink_prelude", default-features = false }
-frame-system = { git = "https://github.com/usetech-llc/substrate/", branch = "rc4_ext_dispatch_reenabled", package = "frame-system", default-features = false }
-pallet-indices = { git = "https://github.com/usetech-llc/substrate/", branch = "rc4_ext_dispatch_reenabled", package = "pallet-indices", default-features = false }
-sp-core = { git = "https://github.com/usetech-llc/substrate/", branch = "rc4_ext_dispatch_reenabled", package = "sp-core", default-features = false }
-sp-io = { git = "https://github.com/usetech-llc/substrate/", branch = "rc4_ext_dispatch_reenabled", package = "sp-io", default-features = false, features = ["disable_panic_handler", "disable_oom", "disable_allocator"] }
-sp-runtime = { git = "https://github.com/usetech-llc/substrate/", branch = "rc4_ext_dispatch_reenabled", package = "sp-runtime", default-features = false }
-scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
-
-[dependencies.type-metadata]
-git = "https://github.com/type-metadata/type-metadata.git"
-rev = "02eae9f35c40c943b56af5b60616219f2b72b47d"
-default-features = false
-features = ["derive"]
-optional = true
-
-
-[dev-dependencies]
-node-runtime = { git = "https://github.com/usetech-llc/nft_parachain/", package = "nft", features = ["std"] }
-
-[features]
-default = ["std"]
-std = [
-    "ink_core/std",
-    "frame-system/std",
-    "pallet-indices/std",
-    "sp-core/std",
-    "sp-io/std",
-    "sp-runtime/std",
-]
-ink-generate-abi = [
-    "std",
-    "type-metadata",
-    "ink_core/ink-generate-abi",
-]
deletedsmart_contract/ink-types-node-runtime/LICENSEdiffbeforeafterboth

no changes

deletedsmart_contract/ink-types-node-runtime/README.mddiffbeforeafterboth
--- a/smart_contract/ink-types-node-runtime/README.md
+++ /dev/null
@@ -1,33 +0,0 @@
-# Node runtime types for `ink!`
-
-Defines types for [ink!](https://github.com/paritytech/ink) smart contracts targeting [Substrate's `node-runtime`](https://github.com/paritytech/substrate/blob/master/bin/node/runtime/src/lib.rs).
-
-Supplies an implementation of the [ink! `EnvTypes` trait](https://github.com/paritytech/ink/blob/master/core/src/env/types.rs#L128).
-
-See `ink!` [examples](./examples) for usage.
-
-## Requirements
-```
-rustup component add rust-src --toolchain nightly
-rustup target add wasm32-unknown-unknown --toolchain nightly
-rustup target add wasm32-unknown-unknown --toolchain stable
-cargo install cargo-contract --vers 0.6.1 --force
-```
-
-## Build
-
-### Runtime Dependencies
-```
-cargo +nightly build --release
-```
-
-### ink! Smart Contract
-```
-cargo +nightly contract build
-cargo +nightly contract generate-metadata
-```
-
-## Test
-```
-cargo +nightly test
-```
\ No newline at end of file
deletedsmart_contract/ink-types-node-runtime/calls/.gitignorediffbeforeafterboth
--- a/smart_contract/ink-types-node-runtime/calls/.gitignore
+++ /dev/null
@@ -1,9 +0,0 @@
-# Ignore build artifacts from the local tests sub-crate.
-/target/
-
-# Ignore backup files creates by cargo fmt.
-**/*.rs.bk
-
-# Remove Cargo.lock when creating an executable, leave it for libraries
-# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock
-Cargo.lock
\ No newline at end of file
deletedsmart_contract/ink-types-node-runtime/calls/.ink/abi_gen/Cargo.tomldiffbeforeafterboth
--- a/smart_contract/ink-types-node-runtime/calls/.ink/abi_gen/Cargo.toml
+++ /dev/null
@@ -1,16 +0,0 @@
-[package]
-name = "abi-gen"
-version = "0.1.0"
-authors = ["Parity Technologies <admin@parity.io>"]
-edition = "2018"
-publish = false
-
-[[bin]]
-name = "abi-gen"
-path = "main.rs"
-
-[dependencies]
-contract = { path = "../..", package = "calls", default-features = false, features = ["ink-generate-abi"] }
-ink_lang = { version = "2", git = "https://github.com/usetech-llc/ink", tag = "latest-v2", package = "ink_lang", default-features = false, features = ["ink-generate-abi"] }
-serde = "1.0.101"
-serde_json = "1.0.55"
deletedsmart_contract/ink-types-node-runtime/calls/.ink/abi_gen/main.rsdiffbeforeafterboth
--- a/smart_contract/ink-types-node-runtime/calls/.ink/abi_gen/main.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-fn main() -> Result<(), std::io::Error> {
-    let abi = <contract::Calls as ink_lang::GenerateAbi>::generate_abi();
-    let contents = serde_json::to_string_pretty(&abi)?;
-    std::fs::create_dir("target").ok();
-    std::fs::write("target/metadata.json", contents)?;
-    Ok(())
-}
deletedsmart_contract/ink-types-node-runtime/calls/Cargo.tomldiffbeforeafterboth
--- a/smart_contract/ink-types-node-runtime/calls/Cargo.toml
+++ /dev/null
@@ -1,73 +0,0 @@
-[package]
-name = "calls"
-version = "0.1.0"
-authors = ["Parity Technologies <admin@parity.io>"]
-edition = "2018"
-
-[dependencies]
-ink_abi = { version = "2", git = "https://github.com/usetech-llc/ink", tag = "latest-v2", package = "ink_abi", default-features = false, features = ["derive"], optional = true }
-ink_primitives = { version = "2", git = "https://github.com/usetech-llc/ink", tag = "latest-v2", package = "ink_primitives", default-features = false }
-ink_core = { version = "2", git = "https://github.com/usetech-llc/ink", tag = "latest-v2", package = "ink_core", default-features = false }
-ink_lang = { version = "2", git = "https://github.com/usetech-llc/ink", tag = "latest-v2", package = "ink_lang", default-features = false }
-ink_prelude = { version = "2", git = "https://github.com/usetech-llc/ink", tag = "latest-v2", package = "ink_prelude", default-features = false }
-
-scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
-sp-keyring = { git = "https://github.com/usetech-llc/substrate/", branch = "rc4_ext_dispatch_reenabled", package = "sp-keyring", optional = true }
-ink_types_node_runtime = { path = "../", default-features = false }
-
-[dependencies.type-metadata]
-git = "https://github.com/type-metadata/type-metadata.git"
-rev = "02eae9f35c40c943b56af5b60616219f2b72b47d"
-default-features = false
-features = ["derive"]
-optional = true
-
-[lib]
-name = "calls"
-path = "lib.rs"
-crate-type = [
-	# Used for normal contract Wasm blobs.
-	"cdylib",
-	# Used for ABI generation.
-	"rlib",
-]
-
-[features]
-default = ["test-env"]
-std = [
-    "ink_abi/std",
-    "ink_core/std",
-    "ink_primitives/std",
-    "scale/std",
-    "type-metadata/std",
-    "ink_types_node_runtime/std",
-    "sp-keyring",
-]
-test-env = [
-    "std",
-    "ink_lang/test-env",
-]
-ink-generate-abi = [
-    "std",
-    "ink_abi",
-    "type-metadata",
-    "ink_core/ink-generate-abi",
-    "ink_lang/ink-generate-abi",
-    "ink_types_node_runtime/ink-generate-abi",
-]
-ink-as-dependency = []
-
-[profile.release]
-panic = "abort"
-lto = true
-opt-level = "z"
-overflow-checks = true
-codegen-units = 1
-
-[workspace]
-members = [
-	".ink/abi_gen"
-]
-exclude = [
-	".ink"
-]
deletedsmart_contract/ink-types-node-runtime/calls/lib.rsdiffbeforeafterboth
--- a/smart_contract/ink-types-node-runtime/calls/lib.rs
+++ /dev/null
@@ -1,243 +0,0 @@
-#![cfg_attr(not(feature = "std"), no_std)]
-
-use ink_lang as ink;
-
-#[ink::contract(version = "0.1.0", env = NodeRuntimeTypes)]
-mod calls {
-    use ink_core::env;
-    use ink_prelude::vec::Vec;
-    use ink_prelude::*;
-    use ink_types_node_runtime::{calls as runtime_calls, NodeRuntimeTypes, RawData, AccountList };
-    use scale::{
-        Decode,
-        Encode,
-    };
-
-    #[derive(Encode, Decode)]
-    pub struct NftItemType {
-        pub collection: u64,
-        pub owner: AccountId,
-        pub data: Vec<u8>,
-    }
-
-    /// This simple dummy contract dispatches substrate runtime calls
-    #[ink(storage)]
-    struct Calls {}
-
-    impl Calls {
-        #[ink(constructor)]
-        fn new(&mut self) {}
-
-        #[ink(message)]
-        fn transfer(&self, new_owner: AccountId, collection_id: u64, item_id: u64, value: u64) {
-            env::println(&format!(
-                "transfer invoke_runtime params {:?}, {:?}, {:?}, {:?} ",
-                new_owner, collection_id, item_id, value
-            ));
-
-            let transfer_call = runtime_calls::transfer(new_owner, collection_id, item_id, value);
-            // dispatch the call to the runtime
-            let result = self.env().invoke_runtime(&transfer_call);
-
-            // report result to console
-            // NOTE: println should only be used on a development chain)
-            env::println(&format!("transfer invoke_runtime result {:?}", result));
-        }
-
-        // SafeTransfer
-
-        #[ink(message)]
-        fn approve(&self, approved: AccountId, collection_id: u64, item_id: u64) {
-            env::println(&format!(
-                "approve invoke_runtime params {:?}, {:?}, {:?} ",
-                approved, collection_id, item_id
-            ));
-
-            let approve_call = runtime_calls::approve(approved, collection_id, item_id);
-            // dispatch the call to the runtime
-            let result = self.env().invoke_runtime(&approve_call);
-
-            // report result to console
-            // NOTE: println should only be used on a development chain)
-            env::println(&format!("approve invoke_runtime result {:?}", result));
-        }
-
-        #[ink(message)]
-        fn get_approved(&self, collection_id: u64, item_id: u64) -> AccountList {
-            let mut key = vec![
-                // Precomputed: Twox128("Nft")
-                244, 63, 251, 230, 30, 244, 104, 116, 157, 54, 23, 172, 26, 99, 196, 183,
-                // Precomputed: Twox128("ApprovedList")
-                86, 163, 236, 207, 221, 111, 252, 227, 254, 40, 142, 38, 40, 224, 192, 18,
-            ];
-
-            let key_ext = vec![
-                146, 214, 40, 117, 20, 27, 72, 25, 232, 204, 175, 194, 112, 244, 140, 100,
-            ];
-            key.extend_from_slice(&key_ext);
-
-            // collection id 
-            let mut collection_bytes: Vec<u8> =  collection_id.to_be_bytes().iter().cloned().collect();
-            collection_bytes.reverse();
-            key.extend_from_slice(&collection_bytes.as_slice());
-
-             // item id 
-             let mut item_bytes: Vec<u8> =  item_id.to_be_bytes().iter().cloned().collect();
-             item_bytes.reverse();
-             key.extend_from_slice(&item_bytes.as_slice());           
-
-            // fetch from runtime storage
-            let result = self.env().get_runtime_storage::<Vec<AccountId>>(&key[..]);
- 
-            match result {
-                Some(Ok(accounts)) => { 
-                    env::println(&format!("get_approved result {:?}", accounts));
-                    AccountList(accounts) 
-                },
-                Some(Err(err)) => {
-                    env::println(&format!("Error reading {:?}", err));
-                    AccountList(vec![])
-                }
-                None => {
-                    env::println(&format!("No data at key {:?}", key));
-                    AccountList(vec![])
-                }
-            }
-        }
-
-        #[ink(message)]
-        fn transfer_from(&self, new_owner: AccountId, collection_id: u64, item_id: u64, value: u64) {
-            env::println(&format!(
-                "transfer_from invoke_runtime params {:?}, {:?}, {:?}, {:?} ",
-                new_owner, collection_id, item_id, value
-            ));
-
-            let transfer_from_call =
-                runtime_calls::transfer_from(new_owner, collection_id, item_id, value);
-            // dispatch the call to the runtime
-            let result = self.env().invoke_runtime(&transfer_from_call);
-
-            // report result to console
-            // NOTE: println should only be used on a development chain)
-            env::println(&format!("transfer_from invoke_runtime result {:?}", result));
-        }
-
-        // SafeTransferFrom
-        #[ink(message)]
-        fn create_item(&self, collection_id: u64, properties: RawData, owner: AccountId) {
-            env::println(&format!(
-                "create_item invoke_runtime params {:?}, {:?}, {:?} ",
-                collection_id, properties, owner
-            ));
-
-            let create_item_call = runtime_calls::create_item(collection_id, properties.into(), owner);
-            // dispatch the call to the runtime
-            let result = self.env().invoke_runtime(&create_item_call);
-
-            // report result to console
-            // NOTE: println should only be used on a development chain)
-            env::println(&format!("create_item invoke_runtime result {:?}", result));
-        }
-
-        #[ink(message)]
-        fn burn_item(&self, collection_id: u64, item_id: u64) {
-            env::println(&format!(
-                "burn_item invoke_runtime params {:?}, {:?}",
-                collection_id, item_id
-            ));
-
-            let burn_item_call = runtime_calls::burn_item(collection_id, item_id);
-            // dispatch the call to the runtime
-            let result = self.env().invoke_runtime(&burn_item_call);
-
-            // report result to console
-            // NOTE: println should only be used on a development chain)
-            env::println(&format!("burn_item invoke_runtime result {:?}", result));
-        }
-
-        // GetOwner
-        #[ink(message)]
-        fn get_owner(&self, collection_id: u64, token_id: u64) -> AccountId {
-            let mut key = vec![
-                // Precomputed: Twox128("Nft")
-                244, 63, 251, 230, 30, 244, 104, 116, 157, 54, 23, 172, 26, 99, 196, 183,
-                // Precomputed: Twox128("ItemList")
-                116, 232, 175, 181, 237, 113, 149, 125, 139, 77, 55, 251, 115, 253, 29, 240,
-            ];
-
-            let key_ext = vec![
-                146, 214, 40, 117, 20, 27, 72, 25, 232, 204, 175, 194, 112, 244, 140, 100,
-            ];
-            key.extend_from_slice(&key_ext);
-
-            // collection id 
-            let mut collection_bytes: Vec<u8> =  collection_id.to_be_bytes().iter().cloned().collect();
-            collection_bytes.reverse();
-            key.extend_from_slice(&collection_bytes.as_slice());
-
-             // token id 
-             let mut token_bytes: Vec<u8> =  token_id.to_be_bytes().iter().cloned().collect();
-             token_bytes.reverse();
-             key.extend_from_slice(&token_bytes.as_slice());           
-
-            // fetch from runtime storage        
-            let result = self.env().get_runtime_storage::<NftItemType>(&key[..]);
- 
-            match result {
-                Some(Ok(item)) => { 
-                    env::println(&format!("get_owner result {:?}", item.owner));
-                    item.owner
-                },
-                Some(Err(err)) => {
-                    env::println(&format!("Error reading {:?}", err));
-                    AccountId::from([0u8; 32])
-                }
-                None => {
-                    env::println(&format!("No data at key {:?}", key));
-                    AccountId::from([0u8; 32])
-                }
-            }
-        }
-
-        #[ink(message)]
-        fn get_balance_of(&self, collection_id: u64, owner: AccountId) -> u64 {
-            let mut key = vec![
-                // Precomputed: Twox128("Nft")
-                244, 63, 251, 230, 30, 244, 104, 116, 157, 54, 23, 172, 26, 99, 196, 183,
-                // Precomputed: Twox128("Balance")
-                78, 168, 234, 12, 1, 250, 164, 43, 110, 179, 68, 168, 92, 71, 179, 135,
-            ];
-
-            let key_ext = vec![
-                15, 97, 136, 0, 76, 187, 168, 28, 239, 85, 170, 23, 77, 81, 248, 159,
-            ];
-            key.extend_from_slice(&key_ext);
-
-            // collection id 
-            let mut collection_bytes: Vec<u8> =  collection_id.to_be_bytes().iter().cloned().collect();
-            collection_bytes.reverse();
-            key.extend_from_slice(&collection_bytes.as_slice());
-
-             // owner
-             key.extend_from_slice(&owner.encode());           
-
-            // fetch from runtime storage
-            let result = self.env().get_runtime_storage::<u64>(&key[..]);
- 
-            match result {
-                Some(Ok(balance)) => { 
-                    env::println(&format!("get_balance_of result {:?}", balance));
-                    balance
-                },
-                Some(Err(err)) => {
-                    env::println(&format!("Error reading {:?}", err));
-                    0
-                }
-                None => {
-                    env::println(&format!("No data at key {:?}", key));
-                    0
-                }
-            }
-        }
-    }
-}
deletedsmart_contract/ink-types-node-runtime/src/calls.rsdiffbeforeafterboth
--- a/smart_contract/ink-types-node-runtime/src/calls.rs
+++ /dev/null
@@ -1,122 +0,0 @@
-use crate::{AccountId, NodeRuntimeTypes};
-use ink_core::env::EnvTypes;
-use ink_prelude::vec::Vec;
-use scale::{Codec, Decode, Encode};
-use sp_runtime::traits::Member;
-
-#[derive(Encode, Decode)]
-#[cfg_attr(feature = "std", derive(Clone, PartialEq, Eq))]
-pub enum Call {
-    #[codec(index = "7")]
-    Nft(Nft<NodeRuntimeTypes>),
-}
-
-impl From<Nft<NodeRuntimeTypes>> for Call {
-    fn from(nft_call: Nft<NodeRuntimeTypes>) -> Call {
-        Call::Nft(nft_call)
-    }
-}
-
-// #[cfg_attr(feature = "ink-generate-abi", derive(Metadata))]
-#[derive(Encode, Decode, Debug, Eq, Clone, PartialEq)]
-pub enum CollectionMode {
-    Invalid,
-    // custom data size
-    NFT(u32),
-    // decimal points
-    Fungible(u32),
-    // custom data size and decimal points
-	ReFungible(u32, u32),
-}
-
-/// Generic Balance Call, could be used with other runtimes
-#[derive(Encode, Decode, Clone, PartialEq, Eq)]
-pub enum Nft<T>
-where
-    T: EnvTypes,
-    T::AccountId: Member + Codec,
-{
-    #[allow(non_camel_case_types)]
-    create_collection(Vec<u16>, Vec<u16>, Vec<u8>, CollectionMode),
-
-    #[allow(non_camel_case_types)]
-    destroy_collection(u64),
-
-    #[allow(non_camel_case_types)]
-    add_collection_admin(u64, T::AccountId),
-
-    #[allow(non_camel_case_types)]
-    remove_collection_admin(u64, T::AccountId),
-
-    #[allow(non_camel_case_types)]
-    change_collection_owner(u64, T::AccountId),
-
-    #[allow(non_camel_case_types)]
-    set_collection_sponsor(u64, T::AccountId),
-
-    #[allow(non_camel_case_types)]
-    confirm_sponsorship(u64),
-
-    #[allow(non_camel_case_types)]
-    remove_collection_sponsor(u64),
-
-    #[allow(non_camel_case_types)]
-    create_item(u64, Vec<u8>, T::AccountId),
-
-    #[allow(non_camel_case_types)]
-    burn_item(u64, u64),
-
-    #[allow(non_camel_case_types)]
-    transfer(T::AccountId, u64, u64, u64),
-
-    #[allow(non_camel_case_types)]
-    nft_approve(T::AccountId, u64, u64),
-
-    #[allow(non_camel_case_types)]
-    nft_transfer_from(T::AccountId, u64, u64, u64),
-
-    #[allow(non_camel_case_types)]
-    nft_safe_transfer(u64, u64, T::AccountId),
-
-    #[allow(non_camel_case_types)]
-    set_offchain_schema(u64, Vec<u8>),
-}
-
-pub fn transfer(new_owner: AccountId, collection_id: u64, item_id: u64, value: u64) -> Call {
-    Nft::<NodeRuntimeTypes>::transfer(new_owner.into(), collection_id, item_id, value).into()
-}
-
-pub fn create_collection(
-    collection_name: Vec<u16>,
-    collection_description: Vec<u16>,
-    token_prefix: Vec<u8>,
-    mode: CollectionMode
-) -> Call {
-    Nft::<NodeRuntimeTypes>::create_collection(
-        collection_name,
-        collection_description,
-        token_prefix,
-        mode
-    )
-    .into()
-}
-
-// pub fn safe_transfer(collection_id: u64, item_id: u64, new_owner: AccountId) -> Call {
-//     Nft::<NodeRuntimeTypes>::nft_safe_transfer(collection_id, item_id, new_owner.into()).into()
-// }
-
-pub fn approve(approved: AccountId, collection_id: u64, item_id: u64) -> Call {
-    Nft::<NodeRuntimeTypes>::nft_approve(approved.into(), collection_id, item_id).into()
-}
-
-pub fn transfer_from(new_owner: AccountId, collection_id: u64, item_id: u64, value: u64) -> Call {
-    Nft::<NodeRuntimeTypes>::nft_transfer_from(new_owner.into(), collection_id, item_id, value).into()
-}
-
-pub fn create_item(collection_id: u64, properties: Vec<u8>, owner: AccountId) -> Call {
-    Nft::<NodeRuntimeTypes>::create_item(collection_id, properties, owner).into()
-}
-
-pub fn burn_item(collection_id: u64, item_id: u64) -> Call {
-    Nft::<NodeRuntimeTypes>::burn_item(collection_id, item_id).into()
-}
deletedsmart_contract/ink-types-node-runtime/src/lib.rsdiffbeforeafterboth
--- a/smart_contract/ink-types-node-runtime/src/lib.rs
+++ /dev/null
@@ -1,163 +0,0 @@
-#![cfg_attr(not(feature = "std"), no_std)]
-
-use core::{array::TryFromSliceError, convert::TryFrom};
-use ink_core::env::Clear;
-use scale::{Decode, Encode};
-use sp_core::crypto::AccountId32;
-use ink_prelude::vec::Vec;
-#[cfg(feature = "ink-generate-abi")]
-use type_metadata::{ HasTypeDef, HasTypeId, MetaType, Metadata, TypeDef, TypeId, TypeIdArray, TypeIdSlice};
-
-pub mod calls;
-
-/// Contract environment types defined in substrate node-runtime
-#[cfg_attr(feature = "ink-generate-abi", derive(Metadata))]
-#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum NodeRuntimeTypes {}
-
-#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Encode, Decode)]
-pub struct AccountId(AccountId32);
-
-impl From<AccountId32> for AccountId {
-    fn from(account: AccountId32) -> Self {
-        AccountId(account)
-    }
-}
-
-impl From<[u8; 32]> for AccountId {
-    fn from(account: [u8; 32]) -> Self {
-        AccountId(AccountId32::from(account))
-    }
-}
-
-#[cfg(feature = "ink-generate-abi")]
-impl HasTypeId for AccountId {
-    fn type_id() -> TypeId {
-        TypeIdArray::new(32, MetaType::new::<u8>()).into()
-    }
-}
-
-#[cfg(feature = "ink-generate-abi")]
-impl HasTypeDef for AccountId {
-    fn type_def() -> TypeDef {
-        TypeDef::builtin()
-    }
-}
-
-/// The default SRML balance type.
-pub type Balance = u128;
-
-#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Encode, Decode)]
-pub struct AccountList(pub Vec<AccountId>);
-
-impl AccountList {
-    pub fn new(param: Vec<AccountId>) -> AccountList {
-        AccountList(param)
-    }
-}
-
-impl Into<Vec<AccountId>> for AccountList {
-    fn into(self) -> Vec<AccountId> {
-        self.0
-    }
-}
-
-#[cfg(feature = "ink-generate-abi")]
-impl HasTypeDef for AccountList {
-    fn type_def() -> TypeDef {
-        TypeDef::builtin()
-    }
-}
-
-#[cfg(feature = "ink-generate-abi")]
-impl HasTypeId for AccountList {
-    fn type_id() -> TypeId {
-        TypeIdSlice::new(AccountId::meta_type()).into()
-    }
-}
-
-
-#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Encode, Decode)]
-pub struct RawData(Vec<u8>);
-
-impl Into<Vec<u8>> for RawData {
-    fn into(self) -> Vec<u8> {
-        self.0
-    }
-}
-
-#[cfg(feature = "ink-generate-abi")]
-impl HasTypeDef for RawData {
-    fn type_def() -> TypeDef {
-        TypeDef::builtin()
-    }
-}
-
-#[cfg(feature = "ink-generate-abi")]
-impl HasTypeId for RawData {
-    fn type_id() -> TypeId {
-        TypeIdSlice::new(u8::meta_type()).into()
-    }
-}
-
-/// The default SRML hash type.
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Encode, Decode)]
-pub struct Hash([u8; 32]);
-
-impl From<[u8; 32]> for Hash {
-    fn from(hash: [u8; 32]) -> Hash {
-        Hash(hash)
-    }
-}
-
-impl<'a> TryFrom<&'a [u8]> for Hash {
-    type Error = TryFromSliceError;
-
-    fn try_from(bytes: &'a [u8]) -> Result<Hash, TryFromSliceError> {
-        let hash = <[u8; 32]>::try_from(bytes)?;
-        Ok(Hash(hash))
-    }
-}
-
-impl AsRef<[u8]> for Hash {
-    fn as_ref(&self) -> &[u8] {
-        &self.0[..]
-    }
-}
-
-impl AsMut<[u8]> for Hash {
-    fn as_mut(&mut self) -> &mut [u8] {
-        &mut self.0[..]
-    }
-}
-
-impl Clear for Hash {
-    fn is_clear(&self) -> bool {
-        self.as_ref().iter().all(|&byte| byte == 0x00)
-    }
-
-    fn clear() -> Self {
-        Self([0x00; 32])
-    }
-}
-
-/// The default SRML moment type.
-pub type Moment = u64;
-
-/// The default SRML blocknumber type.
-pub type BlockNumber = u64;
-
-/// The default SRML AccountIndex type.
-pub type AccountIndex = u32;
-
-/// The default timestamp type.
-pub type Timestamp = u64;
-
-impl ink_core::env::EnvTypes for NodeRuntimeTypes {
-    type AccountId = AccountId;
-    type Balance = Balance;
-    type Hash = Hash;
-    type Timestamp = Timestamp;
-    type BlockNumber = BlockNumber;
-    type Call = calls::Call;
-}