git.delta.rocks / unique-network / refs/commits / 905f9b3923e7

difftreelog

refactor fix complex value type support in evm-coder

Yaroslav Bolyukin2023-08-29parent: #1a4aa2d.patch.diff
in: master

14 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2653,8 +2653,9 @@
 
 [[package]]
 name = "evm-coder"
-version = "0.3.6"
-source = "git+https://github.com/uniquenetwork/evm-coder?tag=v0.3.6#be59ae41a5d2ec9389bae22d54f81122b6ba55a4"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b88ae5a449e7e9dfef59c0dd2df396bc56d81a6f4e297490c0c64aa73f7f7ad4"
 dependencies = [
  "ethereum",
  "evm-coder-procedural",
@@ -2665,8 +2666,9 @@
 
 [[package]]
 name = "evm-coder-procedural"
-version = "0.3.6"
-source = "git+https://github.com/uniquenetwork/evm-coder?tag=v0.3.6#be59ae41a5d2ec9389bae22d54f81122b6ba55a4"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6223c1063c1f53380b4b9aaf2e4d82eba4808c661c61265619b804b09b7a6b1a"
 dependencies = [
  "Inflector",
  "hex",
modifiedCargo.tomldiffbeforeafterboth
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -27,7 +27,7 @@
 [workspace.dependencies]
 # Unique
 app-promotion-rpc = { path = "primitives/app_promotion_rpc", default-features = false }
-evm-coder = { git = "https://github.com/uniquenetwork/evm-coder", tag = "v0.3.6", default-features = false, features = [
+evm-coder = { version = "0.4.2", default-features = false, features = [
 	'bondrewd',
 ] }
 pallet-app-promotion = { path = "pallets/app-promotion", default-features = false }
modifiedpallets/common/Cargo.tomldiffbeforeafterboth
--- a/pallets/common/Cargo.toml
+++ b/pallets/common/Cargo.toml
@@ -35,7 +35,8 @@
 	"sp-std/std",
 	"up-data-structs/std",
 	"up-pov-estimate-rpc/std",
+	"evm-coder/std",
 ]
-stubgen = ["evm-coder/stubgen"]
+stubgen = ["evm-coder/stubgen", "up-data-structs/stubgen"]
 tests = []
 try-runtime = ["frame-support/try-runtime"]
modifiedpallets/common/src/eth.rsdiffbeforeafterboth
--- a/pallets/common/src/eth.rs
+++ b/pallets/common/src/eth.rs
@@ -549,8 +549,6 @@
 /// Collection properties
 #[derive(Debug, Default, AbiCoder)]
 pub struct CreateCollectionData {
-	/// Collection sponsor
-	pub pending_sponsor: CrossAddress,
 	/// Collection name
 	pub name: String,
 	/// Collection description
@@ -571,6 +569,8 @@
 	pub nesting_settings: CollectionNestingAndPermission,
 	/// Collection limits
 	pub limits: Vec<CollectionLimitValue>,
+	/// Collection sponsor
+	pub pending_sponsor: CrossAddress,
 	/// Extra collection flags
 	pub flags: CollectionFlags,
 }
modifiedpallets/evm-coder-substrate/src/lib.rsdiffbeforeafterboth
--- a/pallets/evm-coder-substrate/src/lib.rs
+++ b/pallets/evm-coder-substrate/src/lib.rs
@@ -26,7 +26,7 @@
 use frame_support::dispatch::Weight;
 
 use core::marker::PhantomData;
-use sp_std::cell::RefCell;
+use sp_std::{cell::RefCell, vec::Vec};
 
 use codec::Decode;
 use frame_support::pallet_prelude::DispatchError;
@@ -46,8 +46,8 @@
 pub use spez::spez;
 
 use evm_coder::{
-	abi::{AbiReader, AbiWrite, AbiWriter},
 	types::{Msg, Value},
+	AbiEncode,
 };
 
 pub use pallet::*;
@@ -168,7 +168,7 @@
 	pub fn evm_to_precompile_output(
 		self,
 		handle: &mut impl PrecompileHandle,
-		result: execution::Result<Option<AbiWriter>>,
+		result: execution::Result<Option<Vec<u8>>>,
 	) -> Option<PrecompileResult> {
 		use execution::Error;
 		// We ignore error here, as it should not occur, as we have our own bookkeeping of gas
@@ -176,18 +176,13 @@
 		Some(match result {
 			Ok(Some(v)) => Ok(PrecompileOutput {
 				exit_status: ExitSucceed::Returned,
-				output: v.finish(),
+				output: v,
 			}),
 			Ok(None) => return None,
-			Err(Error::Revert(e)) => {
-				let mut writer = AbiWriter::new_call(evm_coder::fn_selector!(Error(string)));
-				(&e as &str).abi_write(&mut writer);
-
-				Err(PrecompileFailure::Revert {
-					exit_status: ExitRevert::Reverted,
-					output: writer.finish(),
-				})
-			}
+			Err(Error::Revert(e)) => Err(PrecompileFailure::Revert {
+				exit_status: ExitRevert::Reverted,
+				output: (&e as &str,).abi_encode_call(evm_coder::fn_selector!(Error(string))),
+			}),
 			Err(Error::Fatal(f)) => Err(PrecompileFailure::Fatal { exit_status: f }),
 			Err(Error::Error(e)) => Err(e.into()),
 		})
@@ -266,7 +261,7 @@
 	C: evm_coder::Call + PreDispatch,
 	E: evm_coder::Callable<C> + WithRecorder<T>,
 	H: PrecompileHandle,
-	execution::ResultWithPostInfo<AbiWriter>: From<ResultWithPostInfoOf<E, AbiWriter>>,
+	execution::ResultWithPostInfo<Vec<u8>>: From<ResultWithPostInfoOf<E, Vec<u8>>>,
 {
 	let result = call_internal(
 		handle.context().caller,
@@ -282,18 +277,16 @@
 	e: &mut E,
 	value: Value,
 	input: &[u8],
-) -> execution::Result<Option<AbiWriter>>
+) -> execution::Result<Option<Vec<u8>>>
 where
 	T: Config,
 	C: evm_coder::Call + PreDispatch,
 	E: Contract + evm_coder::Callable<C> + WithRecorder<T>,
-	execution::ResultWithPostInfo<AbiWriter>: From<ResultWithPostInfoOf<E, AbiWriter>>,
+	execution::ResultWithPostInfo<Vec<u8>>: From<ResultWithPostInfoOf<E, Vec<u8>>>,
 {
-	let (selector, mut reader) = AbiReader::new_call(input)?;
-	let call = C::parse(selector, &mut reader)?;
+	let call = C::parse_full(input)?;
 	if call.is_none() {
-		let selector = u32::from_be_bytes(selector);
-		return Err(format!("unrecognized selector: 0x{selector:0<8x}").into());
+		return Err("unrecognized selector".into());
 	}
 	let call = call.unwrap();
 
modifiedpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -19,7 +19,7 @@
 extern crate alloc;
 use core::marker::PhantomData;
 use evm_coder::{
-	abi::{AbiWriter, AbiType},
+	abi::{AbiType, AbiEncode},
 	generate_stubgen, solidity_interface,
 	types::*,
 	ToLog,
@@ -370,11 +370,8 @@
 		{
 			return Some(Err(PrecompileFailure::Revert {
 				exit_status: ExitRevert::Reverted,
-				output: {
-					let mut writer = AbiWriter::new_call(evm_coder::fn_selector!(Error(string)));
-					writer.string("Target contract is allowlisted");
-					writer.finish()
-				},
+				output: ("target contract is allowlisted",)
+					.abi_encode_call(evm_coder::fn_selector!(Error(string))),
 			}));
 		}
 
modifiedpallets/gov-origins/src/lib.rsdiffbeforeafterboth
--- a/pallets/gov-origins/src/lib.rs
+++ b/pallets/gov-origins/src/lib.rs
@@ -31,6 +31,7 @@
 
 	#[derive(PartialEq, Eq, Clone, MaxEncodedLen, Encode, Decode, TypeInfo, RuntimeDebug)]
 	#[pallet::origin]
+	#[non_exhaustive]
 	pub enum Origin {
 		/// Origin able to send proposal from fellowship collective to democracy pallet.
 		FellowshipProposition,
modifiedpallets/unique/src/eth/mod.rsdiffbeforeafterboth
--- a/pallets/unique/src/eth/mod.rs
+++ b/pallets/unique/src/eth/mod.rs
@@ -139,116 +139,114 @@
 	T: Config + pallet_common::Config + pallet_nonfungible::Config + pallet_refungible::Config,
 	T::AccountId: From<[u8; 32]>,
 {
-	/*
-		/// Create a collection
-		/// @return address Address of the newly created collection
-		#[weight(<SelfWeightOf<T>>::create_collection())]
-		#[solidity(rename_selector = "createCollection")]
-		fn create_collection(
-			&mut self,
-			caller: Caller,
-			value: Value,
-			data: eth::CreateCollectionData,
-		) -> Result<Address> {
-			let (caller, name, description, token_prefix) =
-				convert_data::<T>(caller, data.name, data.description, data.token_prefix)?;
-			if data.mode != eth::CollectionMode::Fungible && data.decimals != 0 {
-				return Err("decimals are only supported for NFT and RFT collections".into());
-			}
-			let mode = match data.mode {
-				eth::CollectionMode::Fungible => CollectionMode::Fungible(data.decimals),
-				eth::CollectionMode::Nonfungible => CollectionMode::NFT,
-				eth::CollectionMode::Refungible => CollectionMode::ReFungible,
-			};
+	/// Create a collection
+	/// @return address Address of the newly created collection
+	#[weight(<SelfWeightOf<T>>::create_collection())]
+	#[solidity(rename_selector = "createCollection")]
+	fn create_collection(
+		&mut self,
+		caller: Caller,
+		value: Value,
+		data: eth::CreateCollectionData,
+	) -> Result<Address> {
+		let (caller, name, description, token_prefix) =
+			convert_data::<T>(caller, data.name, data.description, data.token_prefix)?;
+		if data.mode != eth::CollectionMode::Fungible && data.decimals != 0 {
+			return Err("decimals are only supported for NFT and RFT collections".into());
+		}
+		let mode = match data.mode {
+			eth::CollectionMode::Fungible => CollectionMode::Fungible(data.decimals),
+			eth::CollectionMode::Nonfungible => CollectionMode::NFT,
+			eth::CollectionMode::Refungible => CollectionMode::ReFungible,
+		};
 
-			let properties: BoundedVec<_, _> = data
-				.properties
-				.into_iter()
-				.map(eth::Property::try_into)
-				.collect::<Result<Vec<_>>>()?
-				.try_into()
-				.map_err(|_| "too many properties")?;
+		let properties: BoundedVec<_, _> = data
+			.properties
+			.into_iter()
+			.map(eth::Property::try_into)
+			.collect::<Result<Vec<_>>>()?
+			.try_into()
+			.map_err(|_| "too many properties")?;
 
-			let token_property_permissions =
-				eth::TokenPropertyPermission::into_property_key_permissions(
-					data.token_property_permissions,
-				)?
-				.try_into()
-				.map_err(|_| "too many property permissions")?;
+		let token_property_permissions =
+			eth::TokenPropertyPermission::into_property_key_permissions(
+				data.token_property_permissions,
+			)?
+			.try_into()
+			.map_err(|_| "too many property permissions")?;
 
-			let limits = if !data.limits.is_empty() {
-				Some(
-					data.limits
-						.into_iter()
-						.collect::<Result<up_data_structs::CollectionLimits>>()?,
-				)
-			} else {
-				None
-			};
+		let limits = if !data.limits.is_empty() {
+			Some(
+				data.limits
+					.into_iter()
+					.collect::<Result<up_data_structs::CollectionLimits>>()?,
+			)
+		} else {
+			None
+		};
 
-			let pending_sponsor = data.pending_sponsor.into_option_sub_cross_account::<T>()?;
+		let pending_sponsor = data.pending_sponsor.into_option_sub_cross_account::<T>()?;
 
-			let restricted = if !data.nesting_settings.restricted.is_empty() {
-				Some(
-					data.nesting_settings
-						.restricted
-						.iter()
-						.map(map_eth_to_id)
-						.collect::<Option<BTreeSet<_>>>()
-						.ok_or("can't convert address into collection id")?
-						.try_into()
-						.map_err(|_| "too many collections")?,
-				)
-			} else {
-				None
-			};
+		let restricted = if !data.nesting_settings.restricted.is_empty() {
+			Some(
+				data.nesting_settings
+					.restricted
+					.iter()
+					.map(map_eth_to_id)
+					.collect::<Option<BTreeSet<_>>>()
+					.ok_or("can't convert address into collection id")?
+					.try_into()
+					.map_err(|_| "too many collections")?,
+			)
+		} else {
+			None
+		};
 
-			let admin_list = data
-				.admin_list
-				.into_iter()
-				.map(|admin| admin.into_sub_cross_account::<T>())
-				.collect::<Result<Vec<_>>>()?;
+		let admin_list = data
+			.admin_list
+			.into_iter()
+			.map(|admin| admin.into_sub_cross_account::<T>())
+			.collect::<Result<Vec<_>>>()?;
 
-			let flags = data.flags;
-			if !flags.is_allowed_for_user() {
-				return Err("internal flags were used".into());
-			}
+		let flags = data.flags;
+		if !flags.is_allowed_for_user() {
+			return Err("internal flags were used".into());
+		}
 
-			let data = CreateCollectionData {
-				name,
-				mode,
-				description,
-				token_prefix,
-				properties,
-				token_property_permissions,
-				limits,
-				pending_sponsor,
+		let data = CreateCollectionData {
+			name,
+			mode,
+			description,
+			token_prefix,
+			properties,
+			token_property_permissions,
+			limits,
+			pending_sponsor,
+			access: None,
+			permissions: Some(CollectionPermissions {
 				access: None,
-				permissions: Some(CollectionPermissions {
-					access: None,
-					mint_mode: None,
-					nesting: Some(NestingPermissions {
-						token_owner: data.nesting_settings.token_owner,
-						collection_admin: data.nesting_settings.collection_admin,
-						restricted,
-						#[cfg(feature = "runtime-benchmarks")]
-						permissive: true,
-					}),
+				mint_mode: None,
+				nesting: Some(NestingPermissions {
+					token_owner: data.nesting_settings.token_owner,
+					collection_admin: data.nesting_settings.collection_admin,
+					restricted,
+					#[cfg(feature = "runtime-benchmarks")]
+					permissive: true,
 				}),
-				admin_list,
-				flags,
-			};
-			check_sent_amount_equals_collection_creation_price::<T>(value)?;
-			let collection_helpers_address =
-				T::CrossAccountId::from_eth(<T as pallet_common::Config>::ContractAddress::get());
+			}),
+			admin_list,
+			flags,
+		};
+		check_sent_amount_equals_collection_creation_price::<T>(value)?;
+		let collection_helpers_address =
+			T::CrossAccountId::from_eth(<T as pallet_common::Config>::ContractAddress::get());
 
-			let collection_id = T::CollectionDispatch::create(caller, collection_helpers_address, data)
-				.map_err(dispatch_to_evm::<T>)?;
+		let collection_id = T::CollectionDispatch::create(caller, collection_helpers_address, data)
+			.map_err(dispatch_to_evm::<T>)?;
 
-			let address = pallet_common::eth::collection_id_to_address(collection_id);
-			Ok(address)
-		}
-	*/
+		let address = pallet_common::eth::collection_id_to_address(collection_id);
+		Ok(address)
+	}
 
 	/// Create an NFT collection
 	/// @param name Name of the collection
modifiedprimitives/data-structs/Cargo.tomldiffbeforeafterboth
--- a/primitives/data-structs/Cargo.toml
+++ b/primitives/data-structs/Cargo.toml
@@ -39,3 +39,4 @@
 	"sp-runtime/std",
 	"sp-std/std",
 ]
+stubgen = ["evm-coder/stubgen"]
modifiedruntime/common/config/pallets/mod.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/mod.rs
+++ b/runtime/common/config/pallets/mod.rs
@@ -24,7 +24,7 @@
 		weights::CommonWeights,
 		RelayChainBlockNumberProvider,
 	},
-	Runtime, RuntimeEvent, RuntimeCall, RuntimeOrigin, RUNTIME_NAME, TOKEN_SYMBOL, DECIMALS,
+	Runtime, RuntimeEvent, RuntimeCall, RUNTIME_NAME, TOKEN_SYMBOL, DECIMALS,
 	Balances,
 };
 use frame_support::traits::{ConstU32, ConstU64, Currency};
modifiedruntime/common/ethereum/sponsoring.rsdiffbeforeafterboth
--- a/runtime/common/ethereum/sponsoring.rs
+++ b/runtime/common/ethereum/sponsoring.rs
@@ -17,7 +17,7 @@
 //! Implements EVM sponsoring logic via TransactionValidityHack
 
 use core::{convert::TryInto, marker::PhantomData};
-use evm_coder::{Call, abi::AbiReader};
+use evm_coder::{Call};
 use pallet_common::{CollectionHandle, eth::map_eth_to_id};
 use pallet_evm::account::CrossAccountId;
 use pallet_evm_transaction_payment::CallContext;
@@ -66,11 +66,11 @@
 		if let Some(collection_id) = map_eth_to_id(&call_context.contract_address) {
 			let collection = <CollectionHandle<T>>::new(collection_id)?;
 			let sponsor = collection.sponsorship.sponsor()?.clone();
-			let (method_id, mut reader) = AbiReader::new_call(&call_context.input).ok()?;
+			// let (method_id, mut reader) = AbiReader::new_call(&call_context.input).ok()?;
 			Some(T::CrossAccountId::from_sub(match &collection.mode {
 				CollectionMode::NFT => {
 					let collection = NonfungibleHandle::cast(collection);
-					let call = <UniqueNFTCall<T>>::parse(method_id, &mut reader).ok()??;
+					let call = <UniqueNFTCall<T>>::parse_full(&call_context.input).ok()??;
 					match call {
 						UniqueNFTCall::TokenProperties(call) => match call {
 							TokenPropertiesCall::SetProperty {
@@ -161,11 +161,11 @@
 					}
 				}
 				CollectionMode::ReFungible => {
-					let call = <UniqueRefungibleCall<T>>::parse(method_id, &mut reader).ok()??;
+					let call = <UniqueRefungibleCall<T>>::parse_full(&call_context.input).ok()??;
 					refungible::call_sponsor(call, collection, who).map(|()| sponsor)
 				}
 				CollectionMode::Fungible(_) => {
-					let call = <UniqueFungibleCall<T>>::parse(method_id, &mut reader).ok()??;
+					let call = <UniqueFungibleCall<T>>::parse_full(&call_context.input).ok()??;
 					match call {
 						UniqueFungibleCall::ERC20(ERC20Call::Transfer { .. }) => {
 							withdraw_transfer::<T>(&collection, who, &TokenId::default())
@@ -196,8 +196,7 @@
 			// Token existance isn't checked at this point and should be checked in `withdraw` method.
 			let token = RefungibleTokenHandle(rft_collection, token_id);
 
-			let (method_id, mut reader) = AbiReader::new_call(&call_context.input).ok()?;
-			let call = <UniqueRefungibleTokenCall<T>>::parse(method_id, &mut reader).ok()??;
+			let call = <UniqueRefungibleTokenCall<T>>::parse_full(&call_context.input).ok()??;
 			Some(T::CrossAccountId::from_sub(
 				refungible::token_call_sponsor(call, token, who).map(|()| sponsor)?,
 			))
modifiedtests/src/eth/abi/collectionHelpers.jsondiffbeforeafterboth
before · tests/src/eth/abi/collectionHelpers.json
1[2  {3    "anonymous": false,4    "inputs": [5      {6        "indexed": true,7        "internalType": "address",8        "name": "collectionId",9        "type": "address"10      }11    ],12    "name": "CollectionChanged",13    "type": "event"14  },15  {16    "anonymous": false,17    "inputs": [18      {19        "indexed": true,20        "internalType": "address",21        "name": "owner",22        "type": "address"23      },24      {25        "indexed": true,26        "internalType": "address",27        "name": "collectionId",28        "type": "address"29      }30    ],31    "name": "CollectionCreated",32    "type": "event"33  },34  {35    "anonymous": false,36    "inputs": [37      {38        "indexed": true,39        "internalType": "address",40        "name": "collectionId",41        "type": "address"42      }43    ],44    "name": "CollectionDestroyed",45    "type": "event"46  },47  {48    "inputs": [49      { "internalType": "uint32", "name": "collectionId", "type": "uint32" }50    ],51    "name": "collectionAddress",52    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],53    "stateMutability": "view",54    "type": "function"55  },56  {57    "inputs": [],58    "name": "collectionCreationFee",59    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],60    "stateMutability": "view",61    "type": "function"62  },63  {64    "inputs": [65      {66        "internalType": "address",67        "name": "collectionAddress",68        "type": "address"69      }70    ],71    "name": "collectionId",72    "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }],73    "stateMutability": "view",74    "type": "function"75  },76  {77    "inputs": [78      {79        "components": [80          {81            "components": [82              { "internalType": "address", "name": "eth", "type": "address" },83              { "internalType": "uint256", "name": "sub", "type": "uint256" }84            ],85            "internalType": "struct CrossAddress",86            "name": "pending_sponsor",87            "type": "tuple"88          },89          { "internalType": "string", "name": "name", "type": "string" },90          { "internalType": "string", "name": "description", "type": "string" },91          {92            "internalType": "string",93            "name": "token_prefix",94            "type": "string"95          },96          {97            "internalType": "enum CollectionMode",98            "name": "mode",99            "type": "uint8"100          },101          { "internalType": "uint8", "name": "decimals", "type": "uint8" },102          {103            "components": [104              { "internalType": "string", "name": "key", "type": "string" },105              { "internalType": "bytes", "name": "value", "type": "bytes" }106            ],107            "internalType": "struct Property[]",108            "name": "properties",109            "type": "tuple[]"110          },111          {112            "components": [113              { "internalType": "string", "name": "key", "type": "string" },114              {115                "components": [116                  {117                    "internalType": "enum TokenPermissionField",118                    "name": "code",119                    "type": "uint8"120                  },121                  { "internalType": "bool", "name": "value", "type": "bool" }122                ],123                "internalType": "struct PropertyPermission[]",124                "name": "permissions",125                "type": "tuple[]"126              }127            ],128            "internalType": "struct TokenPropertyPermission[]",129            "name": "token_property_permissions",130            "type": "tuple[]"131          },132          {133            "components": [134              { "internalType": "address", "name": "eth", "type": "address" },135              { "internalType": "uint256", "name": "sub", "type": "uint256" }136            ],137            "internalType": "struct CrossAddress[]",138            "name": "admin_list",139            "type": "tuple[]"140          },141          {142            "components": [143              { "internalType": "bool", "name": "token_owner", "type": "bool" },144              {145                "internalType": "bool",146                "name": "collection_admin",147                "type": "bool"148              },149              {150                "internalType": "address[]",151                "name": "restricted",152                "type": "address[]"153              }154            ],155            "internalType": "struct CollectionNestingAndPermission",156            "name": "nesting_settings",157            "type": "tuple"158          },159          {160            "components": [161              {162                "internalType": "enum CollectionLimitField",163                "name": "field",164                "type": "uint8"165              },166              { "internalType": "uint256", "name": "value", "type": "uint256" }167            ],168            "internalType": "struct CollectionLimitValue[]",169            "name": "limits",170            "type": "tuple[]"171          },172          {173            "internalType": "CollectionFlags",174            "name": "flags",175            "type": "uint8"176          }177        ],178        "internalType": "struct CreateCollectionData",179        "name": "data",180        "type": "tuple"181      }182    ],183    "name": "createCollection",184    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],185    "stateMutability": "payable",186    "type": "function"187  },188  {189    "inputs": [190      { "internalType": "string", "name": "name", "type": "string" },191      { "internalType": "uint8", "name": "decimals", "type": "uint8" },192      { "internalType": "string", "name": "description", "type": "string" },193      { "internalType": "string", "name": "tokenPrefix", "type": "string" }194    ],195    "name": "createFTCollection",196    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],197    "stateMutability": "payable",198    "type": "function"199  },200  {201    "inputs": [202      { "internalType": "string", "name": "name", "type": "string" },203      { "internalType": "string", "name": "description", "type": "string" },204      { "internalType": "string", "name": "tokenPrefix", "type": "string" }205    ],206    "name": "createNFTCollection",207    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],208    "stateMutability": "payable",209    "type": "function"210  },211  {212    "inputs": [213      { "internalType": "string", "name": "name", "type": "string" },214      { "internalType": "string", "name": "description", "type": "string" },215      { "internalType": "string", "name": "tokenPrefix", "type": "string" }216    ],217    "name": "createRFTCollection",218    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],219    "stateMutability": "payable",220    "type": "function"221  },222  {223    "inputs": [224      {225        "internalType": "address",226        "name": "collectionAddress",227        "type": "address"228      }229    ],230    "name": "destroyCollection",231    "outputs": [],232    "stateMutability": "nonpayable",233    "type": "function"234  },235  {236    "inputs": [237      {238        "internalType": "address",239        "name": "collectionAddress",240        "type": "address"241      }242    ],243    "name": "isCollectionExist",244    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],245    "stateMutability": "view",246    "type": "function"247  },248  {249    "inputs": [250      { "internalType": "address", "name": "collection", "type": "address" },251      { "internalType": "string", "name": "baseUri", "type": "string" }252    ],253    "name": "makeCollectionERC721MetadataCompatible",254    "outputs": [],255    "stateMutability": "nonpayable",256    "type": "function"257  },258  {259    "inputs": [260      { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }261    ],262    "name": "supportsInterface",263    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],264    "stateMutability": "view",265    "type": "function"266  }267]
after · tests/src/eth/abi/collectionHelpers.json
1[2  {3    "anonymous": false,4    "inputs": [5      {6        "indexed": true,7        "internalType": "address",8        "name": "collectionId",9        "type": "address"10      }11    ],12    "name": "CollectionChanged",13    "type": "event"14  },15  {16    "anonymous": false,17    "inputs": [18      {19        "indexed": true,20        "internalType": "address",21        "name": "owner",22        "type": "address"23      },24      {25        "indexed": true,26        "internalType": "address",27        "name": "collectionId",28        "type": "address"29      }30    ],31    "name": "CollectionCreated",32    "type": "event"33  },34  {35    "anonymous": false,36    "inputs": [37      {38        "indexed": true,39        "internalType": "address",40        "name": "collectionId",41        "type": "address"42      }43    ],44    "name": "CollectionDestroyed",45    "type": "event"46  },47  {48    "inputs": [49      { "internalType": "uint32", "name": "collectionId", "type": "uint32" }50    ],51    "name": "collectionAddress",52    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],53    "stateMutability": "view",54    "type": "function"55  },56  {57    "inputs": [],58    "name": "collectionCreationFee",59    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],60    "stateMutability": "view",61    "type": "function"62  },63  {64    "inputs": [65      {66        "internalType": "address",67        "name": "collectionAddress",68        "type": "address"69      }70    ],71    "name": "collectionId",72    "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }],73    "stateMutability": "view",74    "type": "function"75  },76  {77    "inputs": [78      {79        "components": [80          { "internalType": "string", "name": "name", "type": "string" },81          { "internalType": "string", "name": "description", "type": "string" },82          {83            "internalType": "string",84            "name": "token_prefix",85            "type": "string"86          },87          {88            "internalType": "enum CollectionMode",89            "name": "mode",90            "type": "uint8"91          },92          { "internalType": "uint8", "name": "decimals", "type": "uint8" },93          {94            "components": [95              { "internalType": "string", "name": "key", "type": "string" },96              { "internalType": "bytes", "name": "value", "type": "bytes" }97            ],98            "internalType": "struct Property[]",99            "name": "properties",100            "type": "tuple[]"101          },102          {103            "components": [104              { "internalType": "string", "name": "key", "type": "string" },105              {106                "components": [107                  {108                    "internalType": "enum TokenPermissionField",109                    "name": "code",110                    "type": "uint8"111                  },112                  { "internalType": "bool", "name": "value", "type": "bool" }113                ],114                "internalType": "struct PropertyPermission[]",115                "name": "permissions",116                "type": "tuple[]"117              }118            ],119            "internalType": "struct TokenPropertyPermission[]",120            "name": "token_property_permissions",121            "type": "tuple[]"122          },123          {124            "components": [125              { "internalType": "address", "name": "eth", "type": "address" },126              { "internalType": "uint256", "name": "sub", "type": "uint256" }127            ],128            "internalType": "struct CrossAddress[]",129            "name": "admin_list",130            "type": "tuple[]"131          },132          {133            "components": [134              { "internalType": "bool", "name": "token_owner", "type": "bool" },135              {136                "internalType": "bool",137                "name": "collection_admin",138                "type": "bool"139              },140              {141                "internalType": "address[]",142                "name": "restricted",143                "type": "address[]"144              }145            ],146            "internalType": "struct CollectionNestingAndPermission",147            "name": "nesting_settings",148            "type": "tuple"149          },150          {151            "components": [152              {153                "internalType": "enum CollectionLimitField",154                "name": "field",155                "type": "uint8"156              },157              { "internalType": "uint256", "name": "value", "type": "uint256" }158            ],159            "internalType": "struct CollectionLimitValue[]",160            "name": "limits",161            "type": "tuple[]"162          },163          {164            "components": [165              { "internalType": "address", "name": "eth", "type": "address" },166              { "internalType": "uint256", "name": "sub", "type": "uint256" }167            ],168            "internalType": "struct CrossAddress",169            "name": "pending_sponsor",170            "type": "tuple"171          },172          {173            "internalType": "CollectionFlags",174            "name": "flags",175            "type": "uint8"176          }177        ],178        "internalType": "struct CreateCollectionData",179        "name": "data",180        "type": "tuple"181      }182    ],183    "name": "createCollection",184    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],185    "stateMutability": "payable",186    "type": "function"187  },188  {189    "inputs": [190      { "internalType": "string", "name": "name", "type": "string" },191      { "internalType": "uint8", "name": "decimals", "type": "uint8" },192      { "internalType": "string", "name": "description", "type": "string" },193      { "internalType": "string", "name": "tokenPrefix", "type": "string" }194    ],195    "name": "createFTCollection",196    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],197    "stateMutability": "payable",198    "type": "function"199  },200  {201    "inputs": [202      { "internalType": "string", "name": "name", "type": "string" },203      { "internalType": "string", "name": "description", "type": "string" },204      { "internalType": "string", "name": "tokenPrefix", "type": "string" }205    ],206    "name": "createNFTCollection",207    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],208    "stateMutability": "payable",209    "type": "function"210  },211  {212    "inputs": [213      { "internalType": "string", "name": "name", "type": "string" },214      { "internalType": "string", "name": "description", "type": "string" },215      { "internalType": "string", "name": "tokenPrefix", "type": "string" }216    ],217    "name": "createRFTCollection",218    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],219    "stateMutability": "payable",220    "type": "function"221  },222  {223    "inputs": [224      {225        "internalType": "address",226        "name": "collectionAddress",227        "type": "address"228      }229    ],230    "name": "destroyCollection",231    "outputs": [],232    "stateMutability": "nonpayable",233    "type": "function"234  },235  {236    "inputs": [237      {238        "internalType": "address",239        "name": "collectionAddress",240        "type": "address"241      }242    ],243    "name": "isCollectionExist",244    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],245    "stateMutability": "view",246    "type": "function"247  },248  {249    "inputs": [250      { "internalType": "address", "name": "collection", "type": "address" },251      { "internalType": "string", "name": "baseUri", "type": "string" }252    ],253    "name": "makeCollectionERC721MetadataCompatible",254    "outputs": [],255    "stateMutability": "nonpayable",256    "type": "function"257  },258  {259    "inputs": [260      { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }261    ],262    "name": "supportsInterface",263    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],264    "stateMutability": "view",265    "type": "function"266  }267]
modifiedtests/src/eth/util/playgrounds/types.tsdiffbeforeafterboth
--- a/tests/src/eth/util/playgrounds/types.ts
+++ b/tests/src/eth/util/playgrounds/types.ts
@@ -59,8 +59,8 @@
 }
 
 export enum CollectionMode {
+	Nonfungible,
 	Fungible,
-	Nonfungible,
 	Refungible,
 }
 
@@ -129,4 +129,4 @@
     else
       this.decimals = 0;
   }
-}
\ No newline at end of file
+}
modifiedtests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth
--- a/tests/src/eth/util/playgrounds/unique.dev.ts
+++ b/tests/src/eth/util/playgrounds/unique.dev.ts
@@ -216,7 +216,6 @@
     }
 
     const tx = collectionHelper.methods.createCollection([
-      this.data.pendingSponsor,
       this.data.name,
       this.data.description,
       this.data.tokenPrefix,
@@ -227,6 +226,7 @@
       this.data.adminList,
       this.data.nestingSettings,
       this.data.limits,
+      this.data.pendingSponsor,
       this.data.flags,
     ]);
     return tx;