difftreelog
Cleanup chain extension
in: master
2 files changed
runtime/src/chain_extension.rsdiffbeforeafterboth--- a/runtime/src/chain_extension.rs
+++ b/runtime/src/chain_extension.rs
@@ -34,25 +34,6 @@
/// The chain Extension of NFT pallet
pub struct NFTExtension;
-// pub trait ToAccount32 {
-// fn to_account32<E: Ext>(addr: <E::T as SysConfig>::AccountId);
-// }
-
-// impl ToAccount32 for NFTExtension {
-// fn to_account32<E: Ext>(addr: <E::T as SysConfig>::AccountId)
-// where
-// <E::T as SysConfig>::AccountId: UncheckedFrom<<E::T as SysConfig>::Hash> + AsRef<[u8]>,
-// {
-// let mut bytes: [u8; 32];
-// let addrVec: Vec<u8> = addr.encode();
-// for i in 0..32 {
-// bytes[i] = addrVec[i];
-// }
-// AccountId32::from(bytes)
-// }
-
-// }
-
impl ChainExtension for NFTExtension {
fn call<E: Ext>(func_id: u32, env: Environment<E, InitState>) -> Result<RetVal, DispatchError>
where
@@ -79,15 +60,11 @@
bytesRec[i] = addrVecRec[i];
}
let recipient = AccountId32::from(bytesRec);
-
-
match pallet_nft::Module::<Runtime>::transfer_internal(sender, recipient, input.collection_id, input.token_id, input.amount) {
Ok(_) => Ok(RetVal::Converging(func_id)),
DispatchError => Err(DispatchError::Other("Transfer error"))
}
-
-
},
_ => {
panic!("Passed unknown func_id to test chain extension: {}", func_id);
smart_contracs/transfer/Cargo.tomldiffbeforeafterboth1[package]2name = "nft_transfer"3version = "0.1.0"4authors = ["[Greg Zaitsev] <[your_email]>"]5edition = "2018"67[dependencies]8ink_primitives = { git = "https://github.com/usetech-llc/ink", branch = "unique", default-features = false }9ink_metadata = { git = "https://github.com/usetech-llc/ink", branch = "unique", default-features = false, features = ["derive"], optional = true }10ink_env = { git = "https://github.com/usetech-llc/ink", branch = "unique", default-features = false }11ink_storage = { git = "https://github.com/usetech-llc/ink", branch = "unique", default-features = false }12ink_lang = { git = "https://github.com/usetech-llc/ink", branch = "unique", default-features = false }1314scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }15scale-info = { version = "0.4.1", default-features = false, features = ["derive"], optional = true }1617[lib]18name = "nft_transfer"19path = "lib.rs"20crate-type = [21 # Used for normal contract Wasm blobs.22 "cdylib",23]2425[features]26default = ["std"]27std = [28 "ink_metadata/std",29 "ink_env/std",30 "ink_storage/std",31 "ink_primitives/std",32 "scale/std",33 "scale-info/std",34]35ink-as-dependency = []