difftreelog
chore fix code review requests
in: master
2 files changed
crates/evm-coder/procedural/src/solidity_interface.rsdiffbeforeafterboth--- a/crates/evm-coder/procedural/src/solidity_interface.rs
+++ b/crates/evm-coder/procedural/src/solidity_interface.rs
@@ -648,20 +648,15 @@
.unwrap_or_else(|| cases::camelcase::to_camel_case(&ident.to_string()));
let mut selector_str = camel_name.clone();
selector_str.push('(');
- let mut normal_args_count = 0u32;
- let mut has_value_args = false;
- for arg in args.iter() {
- if arg.is_value() {
- has_value_args = true;
- } else if !arg.is_special() {
- if normal_args_count != 0 {
- selector_str.push(',');
- }
- write!(selector_str, "{}", arg.selector_ty()).unwrap();
- normal_args_count = normal_args_count.saturating_add(1);
+ let mut has_normal_args = false;
+ for (i, arg) in args.iter().filter(|arg| !arg.is_special()).enumerate() {
+ if i != 0 {
+ selector_str.push(',');
}
+ write!(selector_str, "{}", arg.selector_ty()).unwrap();
+ has_normal_args = true;
}
- let has_normal_args = normal_args_count > 0;
+ let has_value_args = args.iter().any(|a| a.is_value());
selector_str.push(')');
let selector = fn_selector_str(&selector_str);
pallets/unique/src/eth/mod.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network 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.89// Unique Network 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.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617//! Implementation of CollectionHelpers contract.1819use core::marker::PhantomData;20use ethereum as _;21use evm_coder::{execution::*, generate_stubgen, solidity_interface, solidity, weight, types::*};22use frame_support::traits::Get;23use pallet_common::{24 CollectionById,25 dispatch::CollectionDispatch,26 erc::{27 CollectionHelpersEvents,28 static_property::{key, value as property_value},29 },30};31use pallet_evm_coder_substrate::{dispatch_to_evm, SubstrateRecorder, WithRecorder};32use pallet_evm::{account::CrossAccountId, OnMethodCall, PrecompileHandle, PrecompileResult};33use up_data_structs::{34 CollectionName, CollectionDescription, CollectionTokenPrefix, CreateCollectionData,35 CollectionMode, PropertyValue,36};3738use crate::{Config, SelfWeightOf, weights::WeightInfo};3940use sp_std::vec::Vec;41use alloc::format;4243/// See [`CollectionHelpersCall`]44pub struct EvmCollectionHelpers<T: Config>(SubstrateRecorder<T>);45impl<T: Config> WithRecorder<T> for EvmCollectionHelpers<T> {46 fn recorder(&self) -> &SubstrateRecorder<T> {47 &self.048 }4950 fn into_recorder(self) -> SubstrateRecorder<T> {51 self.052 }53}5455fn convert_data<T: Config>(56 caller: caller,57 name: string,58 description: string,59 token_prefix: string,60 base_uri: string,61) -> Result<(62 T::CrossAccountId,63 CollectionName,64 CollectionDescription,65 CollectionTokenPrefix,66 PropertyValue,67)> {68 let caller = T::CrossAccountId::from_eth(caller);69 let name = name70 .encode_utf16()71 .collect::<Vec<u16>>()72 .try_into()73 .map_err(|_| error_field_too_long(stringify!(name), CollectionName::bound()))?;74 let description = description75 .encode_utf16()76 .collect::<Vec<u16>>()77 .try_into()78 .map_err(|_| {79 error_field_too_long(stringify!(description), CollectionDescription::bound())80 })?;81 let token_prefix = token_prefix.into_bytes().try_into().map_err(|_| {82 error_field_too_long(stringify!(token_prefix), CollectionTokenPrefix::bound())83 })?;84 let base_uri_value = base_uri85 .into_bytes()86 .try_into()87 .map_err(|_| error_field_too_long(stringify!(token_prefix), PropertyValue::bound()))?;88 Ok((caller, name, description, token_prefix, base_uri_value))89}9091fn make_data<T: Config>(92 name: CollectionName,93 mode: CollectionMode,94 description: CollectionDescription,95 token_prefix: CollectionTokenPrefix,96 base_uri_value: PropertyValue,97 add_properties: bool,98) -> Result<CreateCollectionData<T::AccountId>> {99 let mut properties = up_data_structs::CollectionPropertiesVec::default();100 let mut token_property_permissions =101 up_data_structs::CollectionPropertiesPermissionsVec::default();102103 token_property_permissions104 .try_push(up_data_structs::PropertyKeyPermission {105 key: key::url(),106 permission: up_data_structs::PropertyPermission {107 mutable: false,108 collection_admin: true,109 token_owner: false,110 },111 })112 .map_err(|e| Error::Revert(format!("{:?}", e)))?;113114 if add_properties {115 token_property_permissions116 .try_push(up_data_structs::PropertyKeyPermission {117 key: key::suffix(),118 permission: up_data_structs::PropertyPermission {119 mutable: false,120 collection_admin: true,121 token_owner: false,122 },123 })124 .map_err(|e| Error::Revert(format!("{:?}", e)))?;125126 properties127 .try_push(up_data_structs::Property {128 key: key::schema_name(),129 value: property_value::erc721(),130 })131 .map_err(|e| Error::Revert(format!("{:?}", e)))?;132133 if !base_uri_value.is_empty() {134 properties135 .try_push(up_data_structs::Property {136 key: key::base_uri(),137 value: base_uri_value,138 })139 .map_err(|e| Error::Revert(format!("{:?}", e)))?;140 }141 }142143 let data = CreateCollectionData {144 name,145 mode,146 description,147 token_prefix,148 token_property_permissions,149 properties,150 ..Default::default()151 };152 Ok(data)153}154155fn create_refungible_collection_internal<156 T: Config + pallet_nonfungible::Config + pallet_refungible::Config,157>(158 caller: caller,159 value: value,160 name: string,161 description: string,162 token_prefix: string,163 base_uri: string,164 add_properties: bool,165) -> Result<address> {166 let (caller, name, description, token_prefix, base_uri_value) =167 convert_data::<T>(caller, name, description, token_prefix, base_uri)?;168 let data = make_data::<T>(169 name,170 CollectionMode::ReFungible,171 description,172 token_prefix,173 base_uri_value,174 add_properties,175 )?;176 let value = value.as_u128();177 let creation_price: Result<u128> = T::CollectionCreationPrice::get()178 .try_into()179 .map_err(|_| "collection creation price should be convertible to u128".into());180 if value != creation_price? {181 return Err("Sent amount not equals to collection creation price".into());182 }183 let collection_helpers_address = T::CrossAccountId::from_eth(<T as pallet_common::Config>::ContractAddress::get());184185 let collection_id = T::CollectionDispatch::create(caller.clone(), collection_helpers_address, data)186 .map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;187 let address = pallet_common::eth::collection_id_to_address(collection_id);188 Ok(address)189}190191/// @title Contract, which allows users to operate with collections192#[solidity_interface(name = CollectionHelpers, events(CollectionHelpersEvents))]193impl<T> EvmCollectionHelpers<T>194where195 T: Config + pallet_common::Config + pallet_nonfungible::Config + pallet_refungible::Config,196{197 /// Create an NFT collection198 /// @param name Name of the collection199 /// @param description Informative description of the collection200 /// @param tokenPrefix Token prefix to represent the collection tokens in UI and user applications201 /// @return address Address of the newly created collection202 #[weight(<SelfWeightOf<T>>::create_collection())]203 fn create_nonfungible_collection(204 &mut self,205 caller: caller,206 value: value,207 name: string,208 description: string,209 token_prefix: string,210 ) -> Result<address> {211 let (caller, name, description, token_prefix, _base_uri_value) =212 convert_data::<T>(caller, name, description, token_prefix, "".into())?;213 let data = make_data::<T>(214 name,215 CollectionMode::NFT,216 description,217 token_prefix,218 Default::default(),219 false,220 )?;221 let value = value.as_u128();222 let creation_price: Result<u128> = T::CollectionCreationPrice::get()223 .try_into()224 .map_err(|_| "collection creation price should be convertible to u128".into());225 let creation_price = creation_price?;226 if value != creation_price {227 return Err(format!("Sent amount not equals to collection creation price ({0})", creation_price).into());228 }229 let collection_helpers_address = T::CrossAccountId::from_eth(<T as pallet_common::Config>::ContractAddress::get());230 let collection_id =231 T::CollectionDispatch::create(caller, collection_helpers_address, data).map_err(dispatch_to_evm::<T>)?;232233 let address = pallet_common::eth::collection_id_to_address(collection_id);234 Ok(address)235 }236237 #[weight(<SelfWeightOf<T>>::create_collection())]238 #[solidity(rename_selector = "createERC721MetadataCompatibleCollection")]239 fn create_nonfungible_collection_with_properties(240 &mut self,241 caller: caller,242 value: value,243 name: string,244 description: string,245 token_prefix: string,246 base_uri: string,247 ) -> Result<address> {248 let (caller, name, description, token_prefix, base_uri_value) =249 convert_data::<T>(caller, name, description, token_prefix, base_uri)?;250 let data = make_data::<T>(251 name,252 CollectionMode::NFT,253 description,254 token_prefix,255 base_uri_value,256 true,257 )?;258 let value = value.as_u128();259 let creation_price: Result<u128> = T::CollectionCreationPrice::get()260 .try_into()261 .map_err(|_| "collection creation price should be convertible to u128".into());262 if value != creation_price? {263 return Err("Sent amount not equals to collection creation price".into());264 }265 let collection_helpers_address = T::CrossAccountId::from_eth(<T as pallet_common::Config>::ContractAddress::get());266 let collection_id = T::CollectionDispatch::create(caller, collection_helpers_address, data)267 .map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;268269 let address = pallet_common::eth::collection_id_to_address(collection_id);270 Ok(address)271 }272273 #[weight(<SelfWeightOf<T>>::create_collection())]274 #[solidity(rename_selector = "createRFTCollection")]275 fn create_refungible_collection(276 &mut self,277 caller: caller,278 value: value,279 name: string,280 description: string,281 token_prefix: string,282 ) -> Result<address> {283 create_refungible_collection_internal::<T>(284 caller,285 value,286 name,287 description,288 token_prefix,289 Default::default(),290 false,291 )292 }293294 #[weight(<SelfWeightOf<T>>::create_collection())]295 #[solidity(rename_selector = "createERC721MetadataCompatibleRFTCollection")]296 fn create_refungible_collection_with_properties(297 &mut self,298 caller: caller,299 value: value,300 name: string,301 description: string,302 token_prefix: string,303 base_uri: string,304 ) -> Result<address> {305 create_refungible_collection_internal::<T>(306 caller,307 value,308 name,309 description,310 token_prefix,311 base_uri,312 true,313 )314 }315316 /// Check if a collection exists317 /// @param collectionAddress Address of the collection in question318 /// @return bool Does the collection exist?319 fn is_collection_exist(&self, _caller: caller, collection_address: address) -> Result<bool> {320 if let Some(id) = pallet_common::eth::map_eth_to_id(&collection_address) {321 let collection_id = id;322 return Ok(<CollectionById<T>>::contains_key(collection_id));323 }324325 Ok(false)326 }327}328329/// Implements [`OnMethodCall`], which delegates call to [`EvmCollectionHelpers`]330pub struct CollectionHelpersOnMethodCall<T: Config>(PhantomData<*const T>);331impl<T: Config + pallet_nonfungible::Config + pallet_refungible::Config> OnMethodCall<T>332 for CollectionHelpersOnMethodCall<T>333{334 fn is_reserved(contract: &sp_core::H160) -> bool {335 contract == &T::ContractAddress::get()336 }337338 fn is_used(contract: &sp_core::H160) -> bool {339 contract == &T::ContractAddress::get()340 }341342 fn call(handle: &mut impl PrecompileHandle) -> Option<PrecompileResult> {343 if handle.code_address() != T::ContractAddress::get() {344 return None;345 }346347 let helpers =348 EvmCollectionHelpers::<T>(SubstrateRecorder::<T>::new(handle.remaining_gas()));349 pallet_evm_coder_substrate::call(handle, helpers)350 }351352 fn get_code(contract: &sp_core::H160) -> Option<Vec<u8>> {353 (contract == &T::ContractAddress::get())354 .then(|| include_bytes!("./stubs/CollectionHelpers.raw").to_vec())355 }356}357358generate_stubgen!(collection_helper_impl, CollectionHelpersCall<()>, true);359generate_stubgen!(collection_helper_iface, CollectionHelpersCall<()>, false);360361fn error_field_too_long(feild: &str, bound: usize) -> Error {362 Error::Revert(format!("{} is too long. Max length is {}.", feild, bound))363}1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network 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.89// Unique Network 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.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617//! Implementation of CollectionHelpers contract.1819use core::marker::PhantomData;20use ethereum as _;21use evm_coder::{execution::*, generate_stubgen, solidity_interface, solidity, weight, types::*};22use frame_support::traits::Get;23use pallet_common::{24 CollectionById,25 dispatch::CollectionDispatch,26 erc::{27 CollectionHelpersEvents,28 static_property::{key, value as property_value},29 },30};31use pallet_evm_coder_substrate::{dispatch_to_evm, SubstrateRecorder, WithRecorder};32use pallet_evm::{account::CrossAccountId, OnMethodCall, PrecompileHandle, PrecompileResult};33use up_data_structs::{34 CollectionName, CollectionDescription, CollectionTokenPrefix, CreateCollectionData,35 CollectionMode, PropertyValue,36};3738use crate::{Config, SelfWeightOf, weights::WeightInfo};3940use sp_std::vec::Vec;41use alloc::format;4243/// See [`CollectionHelpersCall`]44pub struct EvmCollectionHelpers<T: Config>(SubstrateRecorder<T>);45impl<T: Config> WithRecorder<T> for EvmCollectionHelpers<T> {46 fn recorder(&self) -> &SubstrateRecorder<T> {47 &self.048 }4950 fn into_recorder(self) -> SubstrateRecorder<T> {51 self.052 }53}5455fn convert_data<T: Config>(56 caller: caller,57 name: string,58 description: string,59 token_prefix: string,60 base_uri: string,61) -> Result<(62 T::CrossAccountId,63 CollectionName,64 CollectionDescription,65 CollectionTokenPrefix,66 PropertyValue,67)> {68 let caller = T::CrossAccountId::from_eth(caller);69 let name = name70 .encode_utf16()71 .collect::<Vec<u16>>()72 .try_into()73 .map_err(|_| error_field_too_long(stringify!(name), CollectionName::bound()))?;74 let description = description75 .encode_utf16()76 .collect::<Vec<u16>>()77 .try_into()78 .map_err(|_| {79 error_field_too_long(stringify!(description), CollectionDescription::bound())80 })?;81 let token_prefix = token_prefix.into_bytes().try_into().map_err(|_| {82 error_field_too_long(stringify!(token_prefix), CollectionTokenPrefix::bound())83 })?;84 let base_uri_value = base_uri85 .into_bytes()86 .try_into()87 .map_err(|_| error_field_too_long(stringify!(token_prefix), PropertyValue::bound()))?;88 Ok((caller, name, description, token_prefix, base_uri_value))89}9091fn make_data<T: Config>(92 name: CollectionName,93 mode: CollectionMode,94 description: CollectionDescription,95 token_prefix: CollectionTokenPrefix,96 base_uri_value: PropertyValue,97 add_properties: bool,98) -> Result<CreateCollectionData<T::AccountId>> {99 let mut properties = up_data_structs::CollectionPropertiesVec::default();100 let mut token_property_permissions =101 up_data_structs::CollectionPropertiesPermissionsVec::default();102103 token_property_permissions104 .try_push(up_data_structs::PropertyKeyPermission {105 key: key::url(),106 permission: up_data_structs::PropertyPermission {107 mutable: false,108 collection_admin: true,109 token_owner: false,110 },111 })112 .map_err(|e| Error::Revert(format!("{:?}", e)))?;113114 if add_properties {115 token_property_permissions116 .try_push(up_data_structs::PropertyKeyPermission {117 key: key::suffix(),118 permission: up_data_structs::PropertyPermission {119 mutable: false,120 collection_admin: true,121 token_owner: false,122 },123 })124 .map_err(|e| Error::Revert(format!("{:?}", e)))?;125126 properties127 .try_push(up_data_structs::Property {128 key: key::schema_name(),129 value: property_value::erc721(),130 })131 .map_err(|e| Error::Revert(format!("{:?}", e)))?;132133 if !base_uri_value.is_empty() {134 properties135 .try_push(up_data_structs::Property {136 key: key::base_uri(),137 value: base_uri_value,138 })139 .map_err(|e| Error::Revert(format!("{:?}", e)))?;140 }141 }142143 let data = CreateCollectionData {144 name,145 mode,146 description,147 token_prefix,148 token_property_permissions,149 properties,150 ..Default::default()151 };152 Ok(data)153}154155fn create_refungible_collection_internal<156 T: Config + pallet_nonfungible::Config + pallet_refungible::Config,157>(158 caller: caller,159 value: value,160 name: string,161 description: string,162 token_prefix: string,163 base_uri: string,164 add_properties: bool,165) -> Result<address> {166 let (caller, name, description, token_prefix, base_uri_value) =167 convert_data::<T>(caller, name, description, token_prefix, base_uri)?;168 let data = make_data::<T>(169 name,170 CollectionMode::ReFungible,171 description,172 token_prefix,173 base_uri_value,174 add_properties,175 )?;176 check_sent_amount_equals_collection_creation_price::<T>(value)?;177 let collection_helpers_address = T::CrossAccountId::from_eth(<T as pallet_common::Config>::ContractAddress::get());178179 let collection_id = T::CollectionDispatch::create(caller.clone(), collection_helpers_address, data)180 .map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;181 let address = pallet_common::eth::collection_id_to_address(collection_id);182 Ok(address)183}184185fn check_sent_amount_equals_collection_creation_price<T: Config>(value: value) -> Result<()> {186 let value = value.as_u128();187 let creation_price: u128 = T::CollectionCreationPrice::get()188 .try_into()189 .map_err(|_| ()) // workaround for `expect` requiring `Debug` trait190 .expect("Collection creation price should be convertible to u128");191 if value != creation_price {192 return Err(format!("Sent amount not equals to collection creation price ({0})", creation_price).into());193 }194 Ok(())195}196197/// @title Contract, which allows users to operate with collections198#[solidity_interface(name = CollectionHelpers, events(CollectionHelpersEvents))]199impl<T> EvmCollectionHelpers<T>200where201 T: Config + pallet_common::Config + pallet_nonfungible::Config + pallet_refungible::Config,202{203 /// Create an NFT collection204 /// @param name Name of the collection205 /// @param description Informative description of the collection206 /// @param tokenPrefix Token prefix to represent the collection tokens in UI and user applications207 /// @return address Address of the newly created collection208 #[weight(<SelfWeightOf<T>>::create_collection())]209 fn create_nonfungible_collection(210 &mut self,211 caller: caller,212 value: value,213 name: string,214 description: string,215 token_prefix: string,216 ) -> Result<address> {217 let (caller, name, description, token_prefix, _base_uri_value) =218 convert_data::<T>(caller, name, description, token_prefix, "".into())?;219 let data = make_data::<T>(220 name,221 CollectionMode::NFT,222 description,223 token_prefix,224 Default::default(),225 false,226 )?;227 check_sent_amount_equals_collection_creation_price::<T>(value)?;228 let collection_helpers_address = T::CrossAccountId::from_eth(<T as pallet_common::Config>::ContractAddress::get());229 let collection_id =230 T::CollectionDispatch::create(caller, collection_helpers_address, data).map_err(dispatch_to_evm::<T>)?;231232 let address = pallet_common::eth::collection_id_to_address(collection_id);233 Ok(address)234 }235236 #[weight(<SelfWeightOf<T>>::create_collection())]237 #[solidity(rename_selector = "createERC721MetadataCompatibleCollection")]238 fn create_nonfungible_collection_with_properties(239 &mut self,240 caller: caller,241 value: value,242 name: string,243 description: string,244 token_prefix: string,245 base_uri: string,246 ) -> Result<address> {247 let (caller, name, description, token_prefix, base_uri_value) =248 convert_data::<T>(caller, name, description, token_prefix, base_uri)?;249 let data = make_data::<T>(250 name,251 CollectionMode::NFT,252 description,253 token_prefix,254 base_uri_value,255 true,256 )?;257 check_sent_amount_equals_collection_creation_price::<T>(value)?;258 let collection_helpers_address = T::CrossAccountId::from_eth(<T as pallet_common::Config>::ContractAddress::get());259 let collection_id = T::CollectionDispatch::create(caller, collection_helpers_address, data)260 .map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;261262 let address = pallet_common::eth::collection_id_to_address(collection_id);263 Ok(address)264 }265266 #[weight(<SelfWeightOf<T>>::create_collection())]267 #[solidity(rename_selector = "createRFTCollection")]268 fn create_refungible_collection(269 &mut self,270 caller: caller,271 value: value,272 name: string,273 description: string,274 token_prefix: string,275 ) -> Result<address> {276 create_refungible_collection_internal::<T>(277 caller,278 value,279 name,280 description,281 token_prefix,282 Default::default(),283 false,284 )285 }286287 #[weight(<SelfWeightOf<T>>::create_collection())]288 #[solidity(rename_selector = "createERC721MetadataCompatibleRFTCollection")]289 fn create_refungible_collection_with_properties(290 &mut self,291 caller: caller,292 value: value,293 name: string,294 description: string,295 token_prefix: string,296 base_uri: string,297 ) -> Result<address> {298 create_refungible_collection_internal::<T>(299 caller,300 value,301 name,302 description,303 token_prefix,304 base_uri,305 true,306 )307 }308309 /// Check if a collection exists310 /// @param collectionAddress Address of the collection in question311 /// @return bool Does the collection exist?312 fn is_collection_exist(&self, _caller: caller, collection_address: address) -> Result<bool> {313 if let Some(id) = pallet_common::eth::map_eth_to_id(&collection_address) {314 let collection_id = id;315 return Ok(<CollectionById<T>>::contains_key(collection_id));316 }317318 Ok(false)319 }320}321322/// Implements [`OnMethodCall`], which delegates call to [`EvmCollectionHelpers`]323pub struct CollectionHelpersOnMethodCall<T: Config>(PhantomData<*const T>);324impl<T: Config + pallet_nonfungible::Config + pallet_refungible::Config> OnMethodCall<T>325 for CollectionHelpersOnMethodCall<T>326{327 fn is_reserved(contract: &sp_core::H160) -> bool {328 contract == &T::ContractAddress::get()329 }330331 fn is_used(contract: &sp_core::H160) -> bool {332 contract == &T::ContractAddress::get()333 }334335 fn call(handle: &mut impl PrecompileHandle) -> Option<PrecompileResult> {336 if handle.code_address() != T::ContractAddress::get() {337 return None;338 }339340 let helpers =341 EvmCollectionHelpers::<T>(SubstrateRecorder::<T>::new(handle.remaining_gas()));342 pallet_evm_coder_substrate::call(handle, helpers)343 }344345 fn get_code(contract: &sp_core::H160) -> Option<Vec<u8>> {346 (contract == &T::ContractAddress::get())347 .then(|| include_bytes!("./stubs/CollectionHelpers.raw").to_vec())348 }349}350351generate_stubgen!(collection_helper_impl, CollectionHelpersCall<()>, true);352generate_stubgen!(collection_helper_iface, CollectionHelpersCall<()>, false);353354fn error_field_too_long(feild: &str, bound: usize) -> Error {355 Error::Revert(format!("{} is too long. Max length is {}.", feild, bound))356}