git.delta.rocks / unique-network / refs/commits / 77bb9d1b095d

difftreelog

cargo fmt

Trubnikov Sergey2022-03-22parent: #310b60e.patch.diff
in: master

10 files changed

modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -168,7 +168,9 @@
 	use scale_info::TypeInfo;
 
 	#[pallet::config]
-	pub trait Config: frame_system::Config + pallet_evm_coder_substrate::Config + TypeInfo + account::Config {
+	pub trait Config:
+		frame_system::Config + pallet_evm_coder_substrate::Config + TypeInfo + account::Config
+	{
 		type Event: IsType<<Self as frame_system::Config>::Event> + From<Event<Self>>;
 
 		type Currency: Currency<Self::AccountId>;
modifiedpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -18,7 +18,8 @@
 use evm_coder::{abi::AbiWriter, execution::Result, generate_stubgen, solidity_interface, types::*};
 use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
 use pallet_evm::{
-	ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure, account::CrossAccountId
+	ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure,
+	account::CrossAccountId,
 };
 use sp_core::H160;
 use crate::{
@@ -179,7 +180,9 @@
 }
 
 pub struct HelpersContractSponsoring<T: Config>(PhantomData<*const T>);
-impl<T: Config> SponsorshipHandler<T::CrossAccountId, (H160, Vec<u8>)> for HelpersContractSponsoring<T> {
+impl<T: Config> SponsorshipHandler<T::CrossAccountId, (H160, Vec<u8>)>
+	for HelpersContractSponsoring<T>
+{
 	fn get_sponsor(who: &T::CrossAccountId, call: &(H160, Vec<u8>)) -> Option<T::CrossAccountId> {
 		let mode = <Pallet<T>>::sponsoring_mode(call.0);
 		if mode == SponsoringModeT::Disabled {
modifiedpallets/evm-contract-helpers/src/lib.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/lib.rs
+++ b/pallets/evm-contract-helpers/src/lib.rs
@@ -30,7 +30,9 @@
 	use sp_core::H160;
 
 	#[pallet::config]
-	pub trait Config: frame_system::Config + pallet_evm_coder_substrate::Config + pallet_evm::account::Config {
+	pub trait Config:
+		frame_system::Config + pallet_evm_coder_substrate::Config + pallet_evm::account::Config
+	{
 		type ContractAddress: Get<H160>;
 		type DefaultSponsoringRateLimit: Get<Self::BlockNumber>;
 	}
modifiedpallets/evm-transaction-payment/src/lib.rsdiffbeforeafterboth
--- a/pallets/evm-transaction-payment/src/lib.rs
+++ b/pallets/evm-transaction-payment/src/lib.rs
@@ -87,7 +87,8 @@
 		fee: U256,
 	) -> core::result::Result<Self::LiquidityInfo, pallet_evm::Error<T>> {
 		let who_pays_fee = if let WithdrawReason::Call { target, input } = &reason {
-			T::EvmSponsorshipHandler::get_sponsor(who, &(*target, input.clone())).unwrap_or(who.clone())
+			T::EvmSponsorshipHandler::get_sponsor(who, &(*target, input.clone()))
+				.unwrap_or(who.clone())
 		} else {
 			who.clone()
 		};
modifiedpallets/fungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/fungible/src/lib.rs
+++ b/pallets/fungible/src/lib.rs
@@ -19,9 +19,7 @@
 use core::ops::Deref;
 use frame_support::{ensure};
 use up_data_structs::{AccessMode, CollectionId, TokenId, CreateCollectionData};
-use pallet_common::{
-	Error as CommonError, Event as CommonEvent, Pallet as PalletCommon,
-};
+use pallet_common::{Error as CommonError, Event as CommonEvent, Pallet as PalletCommon};
 use pallet_evm::account::CrossAccountId;
 use pallet_evm_coder_substrate::WithRecorder;
 use sp_core::H160;
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -21,9 +21,7 @@
 use up_data_structs::{
 	AccessMode, CollectionId, CustomDataLimit, TokenId, CreateCollectionData, CreateNftExData,
 };
-use pallet_common::{
-	Error as CommonError, Pallet as PalletCommon, Event as CommonEvent,
-};
+use pallet_common::{Error as CommonError, Pallet as PalletCommon, Event as CommonEvent};
 use pallet_evm::account::CrossAccountId;
 use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
 use sp_core::H160;
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -21,9 +21,7 @@
 	AccessMode, CollectionId, CustomDataLimit, MAX_REFUNGIBLE_PIECES, TokenId,
 	CreateCollectionData, CreateRefungibleExData,
 };
-use pallet_common::{
-	Error as CommonError, Event as CommonEvent, Pallet as PalletCommon,
-};
+use pallet_common::{Error as CommonError, Event as CommonEvent, Pallet as PalletCommon};
 use pallet_evm::account::CrossAccountId;
 use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};
 use sp_std::{vec::Vec, vec, collections::btree_map::BTreeMap};
modifiedpallets/unique/src/eth/sponsoring.rsdiffbeforeafterboth
60 }62 }
61 UniqueNFTCall::ERC721Mintable(call) => match call {63 UniqueNFTCall::ERC721Mintable(call) => match call {
62 pallet_nonfungible::erc::ERC721MintableCall::Mint { .. } |64 pallet_nonfungible::erc::ERC721MintableCall::Mint { .. }
63 pallet_nonfungible::erc::ERC721MintableCall::MintWithTokenUri { .. } => {65 | pallet_nonfungible::erc::ERC721MintableCall::MintWithTokenUri {
66 ..
64 withdraw_create_item(67 } => withdraw_create_item(
65 &collection, 68 &collection,
66 who.as_sub(), 69 who.as_sub(),
67 &CreateItemData::NFT(CreateNftData::default()))70 &CreateItemData::NFT(CreateNftData::default()),
71 )
68 .map(|()| sponsor)72 .map(|()| sponsor),
69 }
70 _ => None,73 _ => None,
71 }74 },
72 _ => None,75 _ => None,
73 }76 }
74 }77 }
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -53,10 +53,7 @@
 	CollectionMode, TokenId, SchemaVersion, SponsorshipState, MetaUpdatePermission,
 	CreateCollectionData, CustomDataLimit, CreateItemExData,
 };
-use pallet_common::{
-	CollectionHandle, Pallet as PalletCommon, Error as CommonError,
-	CommonWeightInfo,
-};
+use pallet_common::{CollectionHandle, Pallet as PalletCommon, Error as CommonError, CommonWeightInfo};
 use pallet_evm::account::CrossAccountId;
 use pallet_refungible::{Pallet as PalletRefungible, RefungibleHandle};
 use pallet_fungible::{Pallet as PalletFungible, FungibleHandle};
modifiedpallets/unique/src/tests.rsdiffbeforeafterboth
--- a/pallets/unique/src/tests.rs
+++ b/pallets/unique/src/tests.rs
@@ -2865,18 +2865,49 @@
 		let origin1 = Origin::signed(user1);
 		let origin2 = Origin::signed(user2);
 		let account2 = account(user2);
-		
-		let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, user1, CollectionId(1));
-		assert_ok!(TemplateModule::set_collection_sponsor(origin1.clone(), collection_id, user1));
-		assert_ok!(TemplateModule::confirm_sponsorship(origin1.clone(), collection_id));
 
+		let collection_id =
+			create_test_collection_for_owner(&CollectionMode::NFT, user1, CollectionId(1));
+		assert_ok!(TemplateModule::set_collection_sponsor(
+			origin1.clone(),
+			collection_id,
+			user1
+		));
+		assert_ok!(TemplateModule::confirm_sponsorship(
+			origin1.clone(),
+			collection_id
+		));
+
 		// Expect error while have no permissions
-		assert!(TemplateModule::create_item(origin2.clone(), collection_id, account2.clone(), default_nft_data().into()).is_err());
+		assert!(TemplateModule::create_item(
+			origin2.clone(),
+			collection_id,
+			account2.clone(),
+			default_nft_data().into()
+		)
+		.is_err());
 
-		assert_ok!(TemplateModule::set_public_access_mode(origin1.clone(), collection_id, AccessMode::AllowList));
-		assert_ok!(TemplateModule::add_to_allow_list(origin1.clone(), collection_id, account2.clone()));
-		assert_ok!(TemplateModule::set_mint_permission(origin1.clone(), collection_id, true));
-		
-		assert_ok!(TemplateModule::create_item(origin2, collection_id, account2, default_nft_data().into()));
+		assert_ok!(TemplateModule::set_public_access_mode(
+			origin1.clone(),
+			collection_id,
+			AccessMode::AllowList
+		));
+		assert_ok!(TemplateModule::add_to_allow_list(
+			origin1.clone(),
+			collection_id,
+			account2.clone()
+		));
+		assert_ok!(TemplateModule::set_mint_permission(
+			origin1.clone(),
+			collection_id,
+			true
+		));
+
+		assert_ok!(TemplateModule::create_item(
+			origin2,
+			collection_id,
+			account2,
+			default_nft_data().into()
+		));
 	});
-}
\ No newline at end of file
+}