git.delta.rocks / unique-network / refs/commits / 251ea62d352e

difftreelog

fix unbroke ink contract build substrate v0.9.8

Yaroslav Bolyukin2021-08-06parent: #d49b9b4.patch.diff
in: master

7 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4935,12 +4935,15 @@
 name = "nft-data-structs"
 version = "0.9.0"
 dependencies = [
+ "derivative",
  "frame-support",
  "frame-system",
+ "max-encoded-len",
  "parity-scale-codec",
  "serde",
  "sp-core",
  "sp-runtime",
+ "sp-std",
 ]
 
 [[package]]
@@ -4999,6 +5002,7 @@
  "cumulus-primitives-core",
  "cumulus-primitives-timestamp",
  "cumulus-primitives-utility",
+ "derivative",
  "fp-rpc",
  "frame-benchmarking",
  "frame-executive",
@@ -5007,6 +5011,7 @@
  "frame-system-benchmarking",
  "frame-system-rpc-runtime-api",
  "hex-literal",
+ "max-encoded-len",
  "nft-data-structs",
  "pallet-aura",
  "pallet-balances",
modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
--- a/pallets/nft/src/lib.rs
+++ b/pallets/nft/src/lib.rs
@@ -1675,8 +1675,8 @@
 			CreateItemData::NFT(data) => {
 				let item = NftItemType {
 					owner: owner.clone(),
-					const_data: data.const_data,
-					variable_data: data.variable_data,
+					const_data: data.const_data.into_inner(),
+					variable_data: data.variable_data.into_inner(),
 				};
 
 				Self::add_nft_item(collection, item)?;
@@ -1692,8 +1692,8 @@
 
 				let item = ReFungibleItemType {
 					owner: owner_list,
-					const_data: data.const_data,
-					variable_data: data.variable_data,
+					const_data: data.const_data.into_inner(),
+					variable_data: data.variable_data.into_inner(),
 				};
 
 				Self::add_refungible_item(collection, item)?;
modifiedprimitives/nft/Cargo.tomldiffbeforeafterboth
--- a/primitives/nft/Cargo.toml
+++ b/primitives/nft/Cargo.toml
@@ -9,20 +9,25 @@
 version = '0.9.0'
 
 [dependencies]
-codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ['derive'] }
+codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false, features = ['derive'] }
 serde = { version = "1.0.119", features = ['derive'], default-features = false }
+max-encoded-len = { default-features = false, features = ['derive'], version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }
 frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }
 frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }
 sp-core = { version = "3.0.0", default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }
+sp-std = { version = "3.0.0", default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }
 sp-runtime = { version = "3.0.0", default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }
+derivative = "2.2.0"
 
 [features]
 default = ["std"]
 std = [
   "serde/std",
   "codec/std",
+  "max-encoded-len/std",
   "frame-system/std",
   "frame-support/std",
   "sp-runtime/std",
   "sp-core/std",
+  "sp-std/std",
 ]
\ No newline at end of file
modifiedprimitives/nft/src/lib.rsdiffbeforeafterboth
--- a/primitives/nft/src/lib.rs
+++ b/primitives/nft/src/lib.rs
@@ -4,8 +4,9 @@
 
 use sp_runtime::sp_std::prelude::Vec;
 use codec::{Decode, Encode};
+use max_encoded_len::MaxEncodedLen;
 pub use frame_support::{
-	construct_runtime, decl_event, decl_module, decl_storage, decl_error,
+	BoundedVec, construct_runtime, decl_event, decl_module, decl_storage, decl_error,
 	dispatch::DispatchResult,
 	ensure, fail, parameter_types,
 	traits::{
@@ -19,18 +20,26 @@
 	},
 	StorageValue, transactional,
 };
+use derivative::Derivative;
 
 pub const MAX_DECIMAL_POINTS: DecimalPoints = 30;
 pub const MAX_REFUNGIBLE_PIECES: u128 = 1_000_000_000_000_000_000_000;
 pub const MAX_SPONSOR_TIMEOUT: u32 = 10_368_000;
 pub const MAX_TOKEN_OWNERSHIP: u32 = 10_000_000;
 
+// TODO: Somehow use ChainLimits for BoundedVec len calculation?
+// Do we need ChainLimits anyway, if we can change them via forkless upgrades?
+parameter_types! {
+pub const MaxDataSize: u32 = 2048;
+// TODO: This limit isn't checked for substrate create_multiple_items call
+pub const MaxItemsPerBatch: u32 = 200;
+}
+
 pub type CollectionId = u32;
 pub type TokenId = u32;
 pub type DecimalPoints = u8;
 
-#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
+#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq, Serialize, Deserialize)]
 pub enum CollectionMode {
 	Invalid,
 	NFT,
@@ -60,8 +69,7 @@
 	fn resolve(who: &AccountId, call: &Call) -> Option<AccountId>;
 }
 
-#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
+#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq, Serialize, Deserialize)]
 pub enum AccessMode {
 	Normal,
 	WhiteList,
@@ -72,8 +80,7 @@
 	}
 }
 
-#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
+#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq, Serialize, Deserialize)]
 pub enum SchemaVersion {
 	ImageURL,
 	Unique,
@@ -84,15 +91,13 @@
 	}
 }
 
-#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
+#[derive(Encode, Decode, Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
 pub struct Ownership<AccountId> {
 	pub owner: AccountId,
 	pub fraction: u128,
 }
 
-#[derive(Encode, Decode, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
+#[derive(Encode, Decode, Debug, Clone, PartialEq, Serialize, Deserialize)]
 pub enum SponsorshipState<AccountId> {
 	/// The fees are applied to the transaction sender
 	Disabled,
@@ -147,30 +152,26 @@
 	pub transfers_enabled: bool,
 }
 
-#[derive(Encode, Decode, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
+#[derive(Encode, Decode, Debug, Clone, PartialEq, Serialize, Deserialize)]
 pub struct NftItemType<AccountId> {
 	pub owner: AccountId,
 	pub const_data: Vec<u8>,
 	pub variable_data: Vec<u8>,
 }
 
-#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
+#[derive(Encode, Decode, Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
 pub struct FungibleItemType {
 	pub value: u128,
 }
 
-#[derive(Encode, Decode, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
+#[derive(Encode, Decode, Debug, Clone, PartialEq, Serialize, Deserialize)]
 pub struct ReFungibleItemType<AccountId> {
 	pub owner: Vec<Ownership<AccountId>>,
 	pub const_data: Vec<u8>,
 	pub variable_data: Vec<u8>,
 }
 
-#[derive(Encode, Decode, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
+#[derive(Encode, Decode, Debug, Clone, PartialEq, Serialize, Deserialize)]
 pub struct CollectionLimits<BlockNumber: Encode + Decode> {
 	pub account_token_ownership_limit: u32,
 	pub sponsored_data_size: u32,
@@ -200,8 +201,7 @@
 	}
 }
 
-#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
+#[derive(Encode, Decode, Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
 pub struct ChainLimits {
 	pub collection_numbers_limit: u32,
 	pub account_token_ownership_limit: u32,
@@ -219,29 +219,73 @@
 	pub const_on_chain_schema_limit: u32,
 }
 
-#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
+/// BoundedVec doesn't supports serde
+mod bounded_serde {
+	use core::convert::TryFrom;
+	use frame_support::{BoundedVec, traits::Get};
+	use serde::{
+		ser::{self, Serialize},
+		de::{self, Deserialize, Error},
+	};
+	use sp_std::vec::Vec;
+
+	pub fn serialize<D, V, S>(value: &BoundedVec<V, S>, serializer: D) -> Result<D::Ok, D::Error>
+	where
+		D: ser::Serializer,
+		V: Serialize,
+	{
+		let vec: &Vec<_> = &value;
+		vec.serialize(serializer)
+	}
+
+	pub fn deserialize<'de, D, V, S>(deserializer: D) -> Result<BoundedVec<V, S>, D::Error>
+	where
+		D: de::Deserializer<'de>,
+		V: de::Deserialize<'de>,
+		S: Get<u32>,
+	{
+		// TODO: Implement custom visitor, which will limit vec size at parse time? Will serde only be used by chainspec?
+		let vec = <Vec<V>>::deserialize(deserializer)?;
+		let len = vec.len();
+		TryFrom::try_from(vec).map_err(|_| D::Error::invalid_length(len, &"lesser size"))
+	}
+}
+
+#[derive(
+	Encode, Decode, MaxEncodedLen, Default, Derivative, Clone, PartialEq, Serialize, Deserialize,
+)]
+#[derivative(Debug)]
 pub struct CreateNftData {
-	pub const_data: Vec<u8>,
-	pub variable_data: Vec<u8>,
+	#[serde(with = "bounded_serde")]
+	#[derivative(Debug="ignore")]
+	pub const_data: BoundedVec<u8, MaxDataSize>,
+	#[serde(with = "bounded_serde")]
+	#[derivative(Debug="ignore")]
+	pub variable_data: BoundedVec<u8, MaxDataSize>,
 }
 
-#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
+#[derive(
+	Encode, Decode, MaxEncodedLen, Default, Debug, Clone, PartialEq, Serialize, Deserialize,
+)]
 pub struct CreateFungibleData {
 	pub value: u128,
 }
 
-#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
+#[derive(
+	Encode, Decode, MaxEncodedLen, Default, Derivative, Clone, PartialEq, Serialize, Deserialize,
+)]
+#[derivative(Debug)]
 pub struct CreateReFungibleData {
-	pub const_data: Vec<u8>,
-	pub variable_data: Vec<u8>,
+	#[serde(with = "bounded_serde")]
+	#[derivative(Debug="ignore")]
+	pub const_data: BoundedVec<u8, MaxDataSize>,
+	#[serde(with = "bounded_serde")]
+	#[derivative(Debug="ignore")]
+	pub variable_data: BoundedVec<u8, MaxDataSize>,
 	pub pieces: u128,
 }
 
-#[derive(Encode, Decode, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
+#[derive(Encode, Decode, MaxEncodedLen, Debug, Clone, PartialEq, Serialize, Deserialize)]
 pub enum CreateItemData {
 	NFT(CreateNftData),
 	Fungible(CreateFungibleData),
modifiedruntime/Cargo.tomldiffbeforeafterboth
--- a/runtime/Cargo.toml
+++ b/runtime/Cargo.toml
@@ -31,6 +31,7 @@
 ]
 std = [
     'codec/std',
+    'max-encoded-len/std',
     'cumulus-pallet-aura-ext/std',
     'cumulus-pallet-parachain-system/std',
     'cumulus-pallet-xcm/std',
@@ -378,6 +379,8 @@
 # local dependencies
 
 [dependencies]
+max-encoded-len = { default-features = false, features = ['derive'], version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.8' }
+derivative = "2.2.0"
 pallet-nft = { path = '../pallets/nft', default-features = false, version = '3.0.0' }
 pallet-inflation = { path = '../pallets/inflation', default-features = false, version = '3.0.0' }
 nft-data-structs = { path = '../primitives/nft', default-features = false, version = '0.9.0' }
modifiedruntime/src/chain_extension.rsdiffbeforeafterboth
6//6//
77
8use codec::{Decode, Encode};8use codec::{Decode, Encode};
9use max_encoded_len::MaxEncodedLen;
10use derivative::Derivative;
911
10pub use pallet_contracts::chain_extension::RetVal;12pub use pallet_contracts::chain_extension::RetVal;
11use pallet_contracts::chain_extension::{13use pallet_contracts::chain_extension::{
20use pallet_nft::CrossAccountId;22use pallet_nft::CrossAccountId;
21use nft_data_structs::*;23use nft_data_structs::*;
22
23use crate::Vec;
2424
25/// Create item parameters25/// Create item parameters
26#[derive(Debug, PartialEq, Encode, Decode)]26#[derive(Debug, PartialEq, Encode, Decode, MaxEncodedLen)]
27pub struct NFTExtCreateItem<E: Ext> {27pub struct NFTExtCreateItem<AccountId> {
28 pub owner: <E::T as SysConfig>::AccountId,28 pub owner: AccountId,
29 pub collection_id: u32,29 pub collection_id: u32,
30 pub data: CreateItemData,30 pub data: CreateItemData,
31}31}
3232
33/// Transfer parameters33/// Transfer parameters
34#[derive(Debug, PartialEq, Encode, Decode)]34#[derive(Debug, PartialEq, Encode, Decode, MaxEncodedLen)]
35pub struct NFTExtTransfer<E: Ext> {35pub struct NFTExtTransfer<AccountId> {
36 pub recipient: <E::T as SysConfig>::AccountId,36 pub recipient: AccountId,
37 pub collection_id: u32,37 pub collection_id: u32,
38 pub token_id: u32,38 pub token_id: u32,
39 pub amount: u128,39 pub amount: u128,
40}40}
4141
42#[derive(Debug, PartialEq, Encode, Decode)]42#[derive(Derivative, PartialEq, Encode, Decode, MaxEncodedLen)]
43#[derivative(Debug)]
43pub struct NFTExtCreateMultipleItems<E: Ext> {44pub struct NFTExtCreateMultipleItems<AccountId> {
44 pub owner: <E::T as SysConfig>::AccountId,45 pub owner: AccountId,
45 pub collection_id: u32,46 pub collection_id: u32,
47 #[derivative(Debug = "ignore")]
46 pub data: Vec<CreateItemData>,48 pub data: BoundedVec<CreateItemData, MaxItemsPerBatch>,
47}49}
4850
49#[derive(Debug, PartialEq, Encode, Decode)]51#[derive(Debug, PartialEq, Encode, Decode, MaxEncodedLen)]
50pub struct NFTExtApprove<E: Ext> {52pub struct NFTExtApprove<AccountId> {
51 pub spender: <E::T as SysConfig>::AccountId,53 pub spender: AccountId,
52 pub collection_id: u32,54 pub collection_id: u32,
53 pub item_id: u32,55 pub item_id: u32,
54 pub amount: u128,56 pub amount: u128,
55}57}
5658
57#[derive(Debug, PartialEq, Encode, Decode)]59#[derive(Debug, PartialEq, Encode, Decode, MaxEncodedLen)]
58pub struct NFTExtTransferFrom<E: Ext> {60pub struct NFTExtTransferFrom<AccountId> {
59 pub owner: <E::T as SysConfig>::AccountId,61 pub owner: AccountId,
60 pub recipient: <E::T as SysConfig>::AccountId,62 pub recipient: AccountId,
61 pub collection_id: u32,63 pub collection_id: u32,
62 pub item_id: u32,64 pub item_id: u32,
63 pub amount: u128,65 pub amount: u128,
64}66}
6567
66#[derive(Debug, PartialEq, Encode, Decode)]68#[derive(Derivative, PartialEq, Encode, Decode, MaxEncodedLen)]
69#[derivative(Debug)]
67pub struct NFTExtSetVariableMetaData {70pub struct NFTExtSetVariableMetaData {
68 pub collection_id: u32,71 pub collection_id: u32,
69 pub item_id: u32,72 pub item_id: u32,
73 #[derivative(Debug = "ignore")]
70 pub data: Vec<u8>,74 pub data: BoundedVec<u8, MaxDataSize>,
71}75}
7276
73#[derive(Debug, PartialEq, Encode, Decode)]77#[derive(Debug, PartialEq, Encode, Decode, MaxEncodedLen)]
74pub struct NFTExtToggleWhiteList<E: Ext> {78pub struct NFTExtToggleWhiteList<AccountId> {
75 pub collection_id: u32,79 pub collection_id: u32,
76 pub address: <E::T as SysConfig>::AccountId,80 pub address: AccountId,
77 pub whitelisted: bool,81 pub whitelisted: bool,
78}82}
7983
8286
83pub type NftWeightInfoOf<C> = <C as pallet_nft::Config>::WeightInfo;87pub type NftWeightInfoOf<C> = <C as pallet_nft::Config>::WeightInfo;
88
89pub type AccountIdOf<C> = <C as SysConfig>::AccountId;
8490
85impl<C: Config + pallet_contracts::Config> ChainExtension<C> for NFTExtension {91impl<C: Config + pallet_contracts::Config> ChainExtension<C> for NFTExtension {
86 fn call<E: Ext>(func_id: u32, env: Environment<E, InitState>) -> Result<RetVal, DispatchError>92 fn call<E: Ext>(func_id: u32, env: Environment<E, InitState>) -> Result<RetVal, DispatchError>
93 match func_id {99 match func_id {
94 0 => {100 0 => {
95 let mut env = env.buf_in_buf_out();101 let mut env = env.buf_in_buf_out();
96 let input: NFTExtTransfer<E> = env.read_as()?;102 let input: NFTExtTransfer<AccountIdOf<C>> = env.read_as()?;
97 env.charge_weight(NftWeightInfoOf::<C>::transfer())?;103 env.charge_weight(NftWeightInfoOf::<C>::transfer())?;
98104
99 let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;105 let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;
106 input.amount,112 input.amount,
107 )?;113 )?;
108114
109 pallet_nft::Module::<C>::submit_logs(collection)?;115 collection.submit_logs()?;
110 Ok(RetVal::Converging(0))116 Ok(RetVal::Converging(0))
111 }117 }
112 1 => {118 1 => {
113 // Create Item119 // Create Item
114 let mut env = env.buf_in_buf_out();120 let mut env = env.buf_in_buf_out();
115 let input: NFTExtCreateItem<E> = env.read_as()?;121 let input: NFTExtCreateItem<AccountIdOf<C>> = env.read_as()?;
116 env.charge_weight(NftWeightInfoOf::<C>::create_item(input.data.data_size()))?;122 env.charge_weight(NftWeightInfoOf::<C>::create_item(input.data.data_size()))?;
117123
118 let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;124 let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;
124 input.data,130 input.data,
125 )?;131 )?;
126132
127 pallet_nft::Module::<C>::submit_logs(collection)?;133 collection.submit_logs()?;
128 Ok(RetVal::Converging(0))134 Ok(RetVal::Converging(0))
129 }135 }
130 2 => {136 2 => {
131 // Create multiple items137 // Create multiple items
132 let mut env = env.buf_in_buf_out();138 let mut env = env.buf_in_buf_out();
133 let input: NFTExtCreateMultipleItems<E> = env.read_as()?;139 let input: NFTExtCreateMultipleItems<AccountIdOf<C>> = env.read_as()?;
134 env.charge_weight(NftWeightInfoOf::<C>::create_item(140 env.charge_weight(NftWeightInfoOf::<C>::create_item(
135 input.data.iter().map(|i| i.data_size()).sum(),141 input.data.iter().map(|i| i.data_size()).sum(),
136 ))?;142 ))?;
141 &C::CrossAccountId::from_sub(env.ext().address().clone()),147 &C::CrossAccountId::from_sub(env.ext().address().clone()),
142 &collection,148 &collection,
143 &C::CrossAccountId::from_sub(input.owner),149 &C::CrossAccountId::from_sub(input.owner),
144 input.data,150 input.data.into_inner(),
145 )?;151 )?;
146152
147 pallet_nft::Module::<C>::submit_logs(collection)?;153 collection.submit_logs()?;
148 Ok(RetVal::Converging(0))154 Ok(RetVal::Converging(0))
149 }155 }
150 3 => {156 3 => {
151 // Approve157 // Approve
152 let mut env = env.buf_in_buf_out();158 let mut env = env.buf_in_buf_out();
153 let input: NFTExtApprove<E> = env.read_as()?;159 let input: NFTExtApprove<AccountIdOf<C>> = env.read_as()?;
154 env.charge_weight(NftWeightInfoOf::<C>::approve())?;160 env.charge_weight(NftWeightInfoOf::<C>::approve())?;
155161
156 let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;162 let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;
163 input.amount,169 input.amount,
164 )?;170 )?;
165171
166 pallet_nft::Module::<C>::submit_logs(collection)?;172 collection.submit_logs()?;
167 Ok(RetVal::Converging(0))173 Ok(RetVal::Converging(0))
168 }174 }
169 4 => {175 4 => {
170 // Transfer from176 // Transfer from
171 let mut env = env.buf_in_buf_out();177 let mut env = env.buf_in_buf_out();
172 let input: NFTExtTransferFrom<E> = env.read_as()?;178 let input: NFTExtTransferFrom<AccountIdOf<C>> = env.read_as()?;
173 env.charge_weight(NftWeightInfoOf::<C>::transfer_from())?;179 env.charge_weight(NftWeightInfoOf::<C>::transfer_from())?;
174180
175 let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;181 let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;
183 input.amount,189 input.amount,
184 )?;190 )?;
185191
186 pallet_nft::Module::<C>::submit_logs(collection)?;192 collection.submit_logs()?;
187 Ok(RetVal::Converging(0))193 Ok(RetVal::Converging(0))
188 }194 }
189 5 => {195 5 => {
198 &C::CrossAccountId::from_sub(env.ext().address().clone()),204 &C::CrossAccountId::from_sub(env.ext().address().clone()),
199 &collection,205 &collection,
200 input.item_id,206 input.item_id,
201 input.data,207 input.data.into_inner(),
202 )?;208 )?;
203209
204 pallet_nft::Module::<C>::submit_logs(collection)?;210 collection.submit_logs()?;
205 Ok(RetVal::Converging(0))211 Ok(RetVal::Converging(0))
206 }212 }
207 6 => {213 6 => {
208 // Toggle whitelist214 // Toggle whitelist
209 let mut env = env.buf_in_buf_out();215 let mut env = env.buf_in_buf_out();
210 let input: NFTExtToggleWhiteList<E> = env.read_as()?;216 let input: NFTExtToggleWhiteList<AccountIdOf<C>> = env.read_as()?;
211 env.charge_weight(NftWeightInfoOf::<C>::add_to_white_list())?;217 env.charge_weight(NftWeightInfoOf::<C>::add_to_white_list())?;
212218
213 let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;219 let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;
219 input.whitelisted,225 input.whitelisted,
220 )?;226 )?;
221227
222 pallet_nft::Module::<C>::submit_logs(collection)?;228 collection.submit_logs()?;
223 Ok(RetVal::Converging(0))229 Ok(RetVal::Converging(0))
224 }230 }
225 _ => Err(DispatchError::Other("unknown chain_extension func_id")),231 _ => Err(DispatchError::Other("unknown chain_extension func_id")),
modifiedruntime/src/lib.rsdiffbeforeafterboth
--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -72,7 +72,6 @@
 use sp_runtime::{
 	traits::{Dispatchable},
 };
-// use pallet_contracts::chain_extension::UncheckedFrom;
 
 // pub use pallet_timestamp::Call as TimestampCall;
 pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
@@ -419,7 +418,7 @@
 	type DepositPerStorageItem = DepositPerStorageItem;
 	type RentFraction = RentFraction;
 	type SurchargeReward = SurchargeReward;
-	type WeightPrice = pallet_transaction_payment::Module<Self>;
+	type WeightPrice = pallet_transaction_payment::Pallet<Self>;
 	type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;
 	type ChainExtension = NFTExtension;
 	type DeletionQueueDepth = DeletionQueueDepth;