git.delta.rocks / unique-network / refs/commits / 80401964ebb0

difftreelog

Smart contract update

str-mv2020-07-16parent: #37abce6.patch.diff
in: master

7 files changed

modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
--- a/pallets/nft/src/lib.rs
+++ b/pallets/nft/src/lib.rs
@@ -96,15 +96,6 @@
         // this is needed only if you are using events in your pallet
         fn deposit_event() = default;
 
-        // Initializing events
-        // this is needed only if you are using events in your module
-        // fn deposit_event<T>() = default;
-
-        // Create collection of NFT with given parameters
-        //
-        // @param customDataSz size of custom data in each collection item
-        // returns collection ID
-
         // Create collection of NFT with given parameters
         //
         // @param customDataSz size of custom data in each collection item
modifiedruntime/src/lib.rsdiffbeforeafterboth
--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -8,6 +8,7 @@
 #[cfg(feature = "std")]
 include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
 
+use contracts_rpc_runtime_api::ContractExecResult;
 use grandpa::fg_primitives;
 use grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};
 use sp_api::impl_runtime_apis;
@@ -21,7 +22,6 @@
     transaction_validity::{TransactionSource, TransactionValidity},
     ApplyExtrinsicResult, MultiSignature,
 };
-use contracts_rpc_runtime_api::ContractExecResult;
 use sp_std::prelude::*;
 #[cfg(feature = "std")]
 use sp_version::NativeVersion;
modifiedsmart_contract/ink-types-node-runtime/Cargo.tomldiffbeforeafterboth
--- a/smart_contract/ink-types-node-runtime/Cargo.toml
+++ b/smart_contract/ink-types-node-runtime/Cargo.toml
@@ -19,6 +19,7 @@
 
 [dependencies]
 ink_core = { version = "2", git = "https://github.com/paritytech/ink", tag = "latest-v2", package = "ink_core", default-features = false }
+ink_prelude = { version = "2", git = "https://github.com/paritytech/ink", tag = "latest-v2", package = "ink_prelude", default-features = false }
 frame-system = { git = "https://github.com/paritytech/substrate/", tag = "v2.0.0-rc3", package = "frame-system", default-features = false }
 pallet-indices = { git = "https://github.com/paritytech/substrate/", tag = "v2.0.0-rc3", package = "pallet-indices", default-features = false }
 sp-core = { git = "https://github.com/paritytech/substrate/", tag = "v2.0.0-rc3", package = "sp-core", default-features = false }
modifiedsmart_contract/ink-types-node-runtime/examples/calls/Cargo.lockdiffbeforeafterboth
--- a/smart_contract/ink-types-node-runtime/examples/calls/Cargo.lock
+++ b/smart_contract/ink-types-node-runtime/examples/calls/Cargo.lock
@@ -803,6 +803,7 @@
 dependencies = [
  "frame-system",
  "ink_core",
+ "ink_prelude",
  "pallet-indices",
  "parity-scale-codec",
  "sp-core",
modifiedsmart_contract/ink-types-node-runtime/examples/calls/lib.rsdiffbeforeafterboth
--- a/smart_contract/ink-types-node-runtime/examples/calls/lib.rs
+++ b/smart_contract/ink-types-node-runtime/examples/calls/lib.rs
@@ -7,7 +7,7 @@
     use ink_core::env;
     use ink_prelude::*;
     use ink_types_node_runtime::{calls as runtime_calls, NodeRuntimeTypes};
-    use ink_core::{memory::vec::Vec, storage};
+    use ink_prelude::vec::Vec;
 
     /// This simple dummy contract dispatches substrate runtime calls
     #[ink(storage)]
@@ -17,43 +17,167 @@
         #[ink(constructor)]
         fn new(&mut self) {}
 
-        /// Dispatches a `transfer` call to the Balances srml module
         #[ink(message)]
-        fn create_collection(&self, collection_name: Vec<u16>, collection_description: Vec<u16>, 
-                            token_prefix: Vec<u8>, 
-                            custom_data_sz: u32) {
-            // create the Balances::transfer Call
+        fn transfer(&self, collection_id: u64, item_id: u64, new_owner: AccountId) {
 
-            // collection_name: Vec<u16>,
-            // collection_description: Vec<u16>,
-            // token_prefix: Vec<u8>,
-            // custom_data_sz: u32
+            env::println(&format!(
+                "transfer invoke_runtime params {:?}, {:?}, {:?} ",
+                collection_id,
+                item_id, 
+                new_owner
+            ));
 
-            let transfer_call = runtime_calls::create_collection(collection_name, collection_description, token_prefix, custom_data_sz);
+            let transfer_call = runtime_calls::transfer(collection_id, item_id, new_owner);
             // 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!(
-                "Balance transfer invoke_runtime result {:?}",
+                "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
+            ));
+        }
+
+        ////////////////////////////////////////// GetApproved
+        /// 
+        /// Returns an account's free balance, read directly from runtime storage
+        ///
+        /// # Key Scheme
+        ///
+        /// A key for the [substrate storage map]
+        /// (https://github.com/paritytech/substrate/blob/dd97b1478b31a4715df7e88a5ebc6664425fb6c6/frame/support/src/storage/generator/map.rs#L28)
+        /// is constructed with:
+        ///
+        /// ```nocompile
+        /// Twox128(module_prefix) ++ Twox128(storage_prefix) ++ Hasher(encode(key))
+        /// ```
+        ///
+        /// For the `System` module's `Account` map, the [hasher implementation]
+        /// (https://github.com/paritytech/substrate/blob/2c87fe171bc341755a43a3b32d67560469f8daac/frame/system/src/lib.rs#L349)
+        /// is `blake2_128_concat`.
+        // #[ink(message)]
+        // fn get_balance(&self, account: AccountId) -> Balance {
+        //     let mut key = vec![
+        //         // Precomputed: Twox128("System")
+        //         38, 170, 57, 78, 234, 86, 48, 224, 124, 72, 174, 12, 149, 88, 206, 247,
+        //         // Precomputed: Twox128("Account")
+        //         185, 157, 136, 14, 198, 129, 121, 156, 12, 243, 14, 136, 134, 55, 29, 169,
+        //     ];
+
+        //     let encoded_account = account.encode();
+        //     let hashed_account = <Blake2x128>::hash_bytes(&encoded_account);
+
+        //     // The hasher is `Blake2_128Concat` which appends the unhashed account to the hashed account
+        //     key.extend_from_slice(&hashed_account);
+        //     key.extend_from_slice(&encoded_account);
+
+        //     // fetch from runtime storage
+        //     let result = self.env().get_runtime_storage::<AccountInfo>(&key[..]);
+        //     match result {
+        //         Some(Ok(account_info)) => account_info.data.free,
+        //         Some(Err(err)) => {
+        //             env::println(&format!("Error reading AccountInfo {:?}", err));
+        //             0
+        //         }
+        //         None => {
+        //             env::println(&format!("No data at key {:?}", key));
+        //             0
+        //         }
+        //     }
+        // }
+
+        #[ink(message)]
+        fn transfer_from(&self, collection_id: u64, item_id: u64, new_owner: AccountId) {
+
+            env::println(&format!(
+                "transfer_from invoke_runtime params {:?}, {:?}, {:?} ",
+                collection_id,
+                item_id, 
+                new_owner 
+            ));
+
+            let transfer_from_call = runtime_calls::transfer_from(collection_id, item_id, new_owner);
+            // 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: Vec<u8>) {
+
+            env::println(&format!(
+                "create_item invoke_runtime params {:?}, {:?} ",
+                collection_id,
+                properties 
+            ));
+
+            let create_item_call = runtime_calls::create_item(collection_id, properties);
+            // 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
             ));
         }
-    }
 
-    #[cfg(test)]
-    mod tests {
-        use super::*;
-        use sp_keyring::AccountKeyring;
+        #[ink(message)]
+        fn burn_item(&self, collection_id: u64, item_id: u64) {
 
-        #[test]
-        fn dispatches_balances_call() {
-            let calls = Calls::new();
-            let alice = AccountId::from(AccountKeyring::Alice.to_account_id());
-            // assert_eq!(calls.env().dispatched_calls().into_iter().count(), 0);
-            calls.balance_transfer(alice, 10000);
-            // assert_eq!(calls.env().dispatched_calls().into_iter().count(), 1);
+            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
+        // BalanceOf
     }
 }
modifiedsmart_contract/ink-types-node-runtime/src/calls.rsdiffbeforeafterboth
before · smart_contract/ink-types-node-runtime/src/calls.rs
1// // Copyright 2019 Parity Technologies (UK) Ltd.2// // This file is part of ink!.3// //4// // ink! is free software: you can redistribute it and/or modify5// // it under the terms of the GNU General Public License as published by6// // the Free Software Foundation, either version 3 of the License, or7// // (at your option) any later version.8// //9// // ink! is distributed in the hope that it will be useful,10// // but WITHOUT ANY WARRANTY; without even the implied warranty of11// // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// // GNU General Public License for more details.13// //14// // You should have received a copy of the GNU General Public License15// // along with ink!.  If not, see <http://www.gnu.org/licenses/>.1617// use ink_core::env::EnvTypes;18// use scale::{Codec, Decode, Encode};19// use sp_runtime::traits::Member;20// use crate::{AccountId, Balance, NodeRuntimeTypes};2122// /// Default runtime Call type, a subset of the runtime Call module variants23// ///24// /// The codec indices of the  modules *MUST* match those in the concrete runtime.25// #[derive(Encode, Decode)]26// #[cfg_attr(feature = "std", derive(Clone, PartialEq, Eq))]27// pub enum Call {28//     #[codec(index = "5")]29//     Balances(Balances<NodeRuntimeTypes>),30// }3132// impl From<Balances<NodeRuntimeTypes>> for Call {33//     fn from(balances_call: Balances<NodeRuntimeTypes>) -> Call {34//         Call::Balances(balances_call)35//     }36// }37// /// Generic Balance Call, could be used with other runtimes38// #[derive(Encode, Decode, Clone, PartialEq, Eq)]39// pub enum Balances<T>40// where41//     T: EnvTypes,42//     T::AccountId: Member + Codec,43// {44//     #[allow(non_camel_case_types)]45//     transfer(T::AccountId, #[codec(compact)] T::Balance),46// }4748// /// Construct a `Balances::transfer` call49// pub fn transfer_balance(account: AccountId, balance: Balance) -> Call {50//     Balances::<NodeRuntimeTypes>::transfer(account.into(), balance).into()51// }5253// #[cfg(test)]54// mod tests {55//     use crate::{calls, NodeRuntimeTypes};56//     use super::Call;5758//     use node_runtime::{self, Runtime};59//     use pallet_indices::address;60//     use scale::{Decode, Encode};616263//     #[test]64//     fn call_balance_transfer() {65//         let balance = 10_000;66//         let account_index = 0;6768//         let contract_address = calls::Address::Index(account_index);69//         let contract_transfer =70//             calls::Balances::<NodeRuntimeTypes>::transfer(contract_address, balance);71//         let contract_call = Call::Balances(contract_transfer);7273//         let srml_address = address::Address::Index(account_index);74//         let srml_transfer = node_runtime::BalancesCall::<Runtime>::transfer(srml_address, balance);75//         let srml_call = node_runtime::Call::Balances(srml_transfer);7677//         let contract_call_encoded = contract_call.encode();78//         let srml_call_encoded = srml_call.encode();7980//         assert_eq!(srml_call_encoded, contract_call_encoded);8182//         let srml_call_decoded: node_runtime::Call =83//             Decode::decode(&mut contract_call_encoded.as_slice())84//                 .expect("Balances transfer call decodes to srml type");85//         let srml_call_encoded = srml_call_decoded.encode();86//         let contract_call_decoded: Call = Decode::decode(&mut srml_call_encoded.as_slice())87//             .expect("Balances transfer call decodes back to contract type");88//         assert!(contract_call == contract_call_decoded);89//     }90// }919293949596979899// Copyright 2019 Parity Technologies (UK) Ltd.100// This file is part of ink!.101//102// ink! is free software: you can redistribute it and/or modify103// it under the terms of the GNU General Public License as published by104// the Free Software Foundation, either version 3 of the License, or105// (at your option) any later version.106//107// ink! is distributed in the hope that it will be useful,108// but WITHOUT ANY WARRANTY; without even the implied warranty of109// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the110// GNU General Public License for more details.111//112// You should have received a copy of the GNU General Public License113// along with ink!.  If not, see <http://www.gnu.org/licenses/>.114115use ink_core::env::EnvTypes;116use scale::{Codec, Decode, Encode};117use pallet_indices::address::Address;118use sp_runtime::traits::Member;119use crate::{AccountId, Balance, NodeRuntimeTypes};120use sp_runtime::sp_std::prelude::Vec;121122/// Default runtime Call type, a subset of the runtime Call module variants123///124/// The codec indices of the  modules *MUST* match those in the concrete runtime.125#[derive(Encode, Decode)]126#[cfg_attr(feature = "std", derive(Clone, PartialEq, Eq))]127pub enum Call {128    #[codec(index = "8")]129    Nft(Nft<NodeRuntimeTypes>),130}131132impl From<Nft<NodeRuntimeTypes>> for Call {133    fn from(nft_call: Nft<NodeRuntimeTypes>) -> Call {134        Call::Nft(nft_call)135    }136}137/// Generic Balance Call, could be used with other runtimes138#[derive(Encode, Decode, Clone, PartialEq, Eq)]139pub enum Nft<T>140 where141     T: EnvTypes,142     T::AccountId: Member + Codec,143{144    #[allow(non_camel_case_types)]145    create_nft_collection(Vec<u16>, Vec<u16>, Vec<u8>, u32),146147    #[allow(non_camel_case_types)]148    add_collection_admin(u64, T::AccountId),149150    // collection_name: Vec<u16>,151    // collection_description: Vec<u16>,152    // token_prefix: Vec<u8>,153    // custom_data_sz: u32154155}156157// Construct a `Balances::transfer` call158pub fn create_collection(collection_name: Vec<u16>, collection_description: Vec<u16>, 159                        token_prefix: Vec<u8>, custom_data_sz: u32) -> Call {160    Nft::<NodeRuntimeTypes>::create_nft_collection(collection_name, collection_description, token_prefix, custom_data_sz).into()161}162163#[cfg(test)]164mod tests {165    use crate::{calls, NodeRuntimeTypes};166    use super::Call;167168    use node_runtime::{self, Runtime};169    use pallet_indices::address;170    use scale::{Decode, Encode};171172173    #[test]174    fn call_balance_transfer() {175        let balance = 10_000;176        let account_index = 0;177178        let contract_address = calls::Address::Index(account_index);179        let contract_transfer =180            calls::Balances::<NodeRuntimeTypes>::transfer(contract_address, balance);181        let contract_call = Call::Balances(contract_transfer);182183        let srml_address = address::Address::Index(account_index);184        let srml_transfer = node_runtime::BalancesCall::<Runtime>::transfer(srml_address, balance);185        let srml_call = node_runtime::Call::Balances(srml_transfer);186187        let contract_call_encoded = contract_call.encode();188        let srml_call_encoded = srml_call.encode();189190        assert_eq!(srml_call_encoded, contract_call_encoded);191192        let srml_call_decoded: node_runtime::Call =193            Decode::decode(&mut contract_call_encoded.as_slice())194                .expect("Balances transfer call decodes to srml type");195        let srml_call_encoded = srml_call_decoded.encode();196        let contract_call_decoded: Call = Decode::decode(&mut srml_call_encoded.as_slice())197            .expect("Balances transfer call decodes back to contract type");198        assert!(contract_call == contract_call_decoded);199    }200}
after · smart_contract/ink-types-node-runtime/src/calls.rs
1// // Copyright 2019 Parity Technologies (UK) Ltd.2// // This file is part of ink!.3// //4// // ink! is free software: you can redistribute it and/or modify5// // it under the terms of the GNU General Public License as published by6// // the Free Software Foundation, either version 3 of the License, or7// // (at your option) any later version.8// //9// // ink! is distributed in the hope that it will be useful,10// // but WITHOUT ANY WARRANTY; without even the implied warranty of11// // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// // GNU General Public License for more details.13// //14// // You should have received a copy of the GNU General Public License15// // along with ink!.  If not, see <http://www.gnu.org/licenses/>.1617// use ink_core::env::EnvTypes;18// use scale::{Codec, Decode, Encode};19// use sp_runtime::traits::Member;20// use crate::{AccountId, Balance, NodeRuntimeTypes};2122// /// Default runtime Call type, a subset of the runtime Call module variants23// ///24// /// The codec indices of the  modules *MUST* match those in the concrete runtime.25// #[derive(Encode, Decode)]26// #[cfg_attr(feature = "std", derive(Clone, PartialEq, Eq))]27// pub enum Call {28//     #[codec(index = "5")]29//     Balances(Balances<NodeRuntimeTypes>),30// }3132// impl From<Balances<NodeRuntimeTypes>> for Call {33//     fn from(balances_call: Balances<NodeRuntimeTypes>) -> Call {34//         Call::Balances(balances_call)35//     }36// }37// /// Generic Balance Call, could be used with other runtimes38// #[derive(Encode, Decode, Clone, PartialEq, Eq)]39// pub enum Balances<T>40// where41//     T: EnvTypes,42//     T::AccountId: Member + Codec,43// {44//     #[allow(non_camel_case_types)]45//     transfer(T::AccountId, #[codec(compact)] T::Balance),46// }4748// /// Construct a `Balances::transfer` call49// pub fn transfer_balance(account: AccountId, balance: Balance) -> Call {50//     Balances::<NodeRuntimeTypes>::transfer(account.into(), balance).into()51// }5253545556575859// Copyright 2019 Parity Technologies (UK) Ltd.60// This file is part of ink!.61//62// ink! is free software: you can redistribute it and/or modify63// it under the terms of the GNU General Public License as published by64// the Free Software Foundation, either version 3 of the License, or65// (at your option) any later version.66//67// ink! is distributed in the hope that it will be useful,68// but WITHOUT ANY WARRANTY; without even the implied warranty of69// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the70// GNU General Public License for more details.71//72// You should have received a copy of the GNU General Public License73// along with ink!.  If not, see <http://www.gnu.org/licenses/>.7475use ink_core::env::EnvTypes;76use scale::{Codec, Decode, Encode};77use sp_runtime::traits::Member;78use ink_prelude::vec::Vec;79use crate::{AccountId, Balance, NodeRuntimeTypes};808182/// Default runtime Call type, a subset of the runtime Call module variants83///84/// The codec indices of the  modules *MUST* match those in the concrete runtime.85#[derive(Encode, Decode)]86#[cfg_attr(feature = "std", derive(Clone, PartialEq, Eq))]87pub enum Call {88    #[codec(index = "7")]89    Nft(Nft<NodeRuntimeTypes>),90}9192impl From<Nft<NodeRuntimeTypes>> for Call {93    fn from(nft_call: Nft<NodeRuntimeTypes>) -> Call {94        Call::Nft(nft_call)95    }96}97/// Generic Balance Call, could be used with other runtimes98#[derive(Encode, Decode, Clone, PartialEq, Eq)]99pub enum Nft<T>100 where101     T: EnvTypes,102     T::AccountId: Member + Codec,103    {104        #[allow(non_camel_case_types)]105        create_collection(Vec<u16>, Vec<u16>, Vec<u8>, u32),106107        #[allow(non_camel_case_types)]108        destroy_collection(u64),109110        #[allow(non_camel_case_types)]111        change_collection_owner(u64, T::AccountId),112113        #[allow(non_camel_case_types)]114        add_collection_admin(u64, T::AccountId),115116        #[allow(non_camel_case_types)]117        remove_collection_admin(u64, T::AccountId),118119        #[allow(non_camel_case_types)]120        create_item(u64, Vec<u8>),121122        #[allow(non_camel_case_types)]123        burn_item(u64, u64),124125        #[allow(non_camel_case_types)]126        transfer(u64, u64, T::AccountId),127128        #[allow(non_camel_case_types)]129        nft_approve(T::AccountId, u64, u64),130131        #[allow(non_camel_case_types)]132        nft_transfer_from(u64, u64, T::AccountId),133134        #[allow(non_camel_case_types)]135        nft_safe_transfer(u64, u64, T::AccountId),136    }137138139140141pub fn transfer(collection_id: u64, item_id: u64, new_owner: AccountId) -> Call {142    Nft::<NodeRuntimeTypes>::transfer(collection_id, item_id, new_owner.into()).into()143}144145pub fn create_collection(collection_name: Vec<u16>, collection_description: Vec<u16>, 146        token_prefix: Vec<u8>, custom_data_sz: u32) -> Call {147    Nft::<NodeRuntimeTypes>::create_collection(collection_name, collection_description, token_prefix, custom_data_sz).into()148}149150// pub fn safe_transfer(collection_id: u64, item_id: u64, new_owner: AccountId) -> Call {151//     Nft::<NodeRuntimeTypes>::nft_safe_transfer(collection_id, item_id, new_owner.into()).into()152// }153154pub fn approve(approved: AccountId, collection_id: u64, item_id: u64) -> Call {155    Nft::<NodeRuntimeTypes>::nft_approve(approved.into(), collection_id, item_id).into()156}157158//GetApproved159160pub fn transfer_from(collection_id: u64, item_id: u64, new_owner: AccountId) -> Call {161    Nft::<NodeRuntimeTypes>::nft_transfer_from(collection_id, item_id, new_owner.into()).into()162}163164pub fn create_item(collection_id: u64, properties: Vec<u8>) -> Call {165    Nft::<NodeRuntimeTypes>::create_item(collection_id, properties).into()166}167168pub fn burn_item(collection_id: u64, item_id: u64) -> Call {169    Nft::<NodeRuntimeTypes>::burn_item(collection_id, item_id).into()170}171172//GetOwner173//BalanceOf
modifiedsmart_contract/ink-types-node-runtime/src/lib.rsdiffbeforeafterboth
--- a/smart_contract/ink-types-node-runtime/src/lib.rs
+++ b/smart_contract/ink-types-node-runtime/src/lib.rs
@@ -36,6 +36,7 @@
 #[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)