From 9e201d9e49becfc1ec89129d4e9f6d8cff683634 Mon Sep 17 00:00:00 2001 From: Trubnikov Sergey Date: Fri, 03 Jun 2022 10:37:17 +0000 Subject: [PATCH] Cargo fmt --- --- a/pallets/common/src/erc.rs +++ b/pallets/common/src/erc.rs @@ -47,8 +47,8 @@ } #[solidity_interface(name = "Collection")] -impl CollectionHandle -// where +impl CollectionHandle +// where // T::AccountId: From { fn set_collection_property(&mut self, caller: caller, key: string, value: bytes) -> Result<()> { @@ -207,8 +207,7 @@ self.check_is_owner_or_admin(&caller) .map_err(dispatch_to_evm::)?; let admin = T::CrossAccountId::from_eth(admin); - >::toggle_admin(&self, &caller, &admin, false) - .map_err(dispatch_to_evm::)?; + >::toggle_admin(&self, &caller, &admin, false).map_err(dispatch_to_evm::)?; Ok(()) } @@ -226,12 +225,21 @@ } #[solidity(rename_selector = "setCollectionNesting")] - fn set_nesting(&mut self, caller: caller, enable: bool, collections: Vec
) -> Result { + fn set_nesting( + &mut self, + caller: caller, + enable: bool, + collections: Vec
, + ) -> Result { if collections.is_empty() { return Err("No addresses provided".into()); } if collections.len() >= OwnerRestrictedSet::bound() { - return Err(Error::Revert(format!("Out of bound: {} >= {}", collections.len(), OwnerRestrictedSet::bound()))); + return Err(Error::Revert(format!( + "Out of bound: {} >= {}", + collections.len(), + OwnerRestrictedSet::bound() + ))); } let caller = T::CrossAccountId::from_eth(caller); self.check_is_owner_or_admin(&caller) @@ -241,12 +249,12 @@ true => { let mut bv = OwnerRestrictedSet::new(); for i in collections { - bv.try_insert( - crate::eth::map_eth_to_id(&i) - .ok_or(Error::Revert("Can't convert address into collection id".into()))? - ).map_err(|e| Error::Revert(format!("{:?}", e)))?; + bv.try_insert(crate::eth::map_eth_to_id(&i).ok_or(Error::Revert( + "Can't convert address into collection id".into(), + ))?) + .map_err(|e| Error::Revert(format!("{:?}", e)))?; } - NestingRule::OwnerRestricted (bv) + NestingRule::OwnerRestricted(bv) } }); save(self); @@ -269,16 +277,14 @@ fn add_to_collection_allow_list(&self, caller: caller, user: address) -> Result { let caller = check_is_owner_or_admin(caller, self)?; let user = T::CrossAccountId::from_eth(user); - >::toggle_allowlist(self, &caller, &user, true) - .map_err(dispatch_to_evm::)?; + >::toggle_allowlist(self, &caller, &user, true).map_err(dispatch_to_evm::)?; Ok(()) } fn remove_from_collection_allow_list(&self, caller: caller, user: address) -> Result { let caller = check_is_owner_or_admin(caller, self)?; let user = T::CrossAccountId::from_eth(user); - >::toggle_allowlist(self, &caller, &user, false) - .map_err(dispatch_to_evm::)?; + >::toggle_allowlist(self, &caller, &user, false).map_err(dispatch_to_evm::)?; Ok(()) } @@ -298,7 +304,10 @@ Ok(()) } -fn check_is_owner_or_admin(caller: caller, collection: &CollectionHandle) -> Result { +fn check_is_owner_or_admin( + caller: caller, + collection: &CollectionHandle, +) -> Result { let caller = T::CrossAccountId::from_eth(caller); collection .check_is_owner_or_admin(&caller) --- a/pallets/nonfungible/src/erc.rs +++ b/pallets/nonfungible/src/erc.rs @@ -82,8 +82,14 @@ .map_err(|_| "key too long")?; let value = value.try_into().map_err(|_| "value too long")?; - >::set_token_property(self, &caller, TokenId(token_id), Property { key, value }, false) - .map_err(dispatch_to_evm::) + >::set_token_property( + self, + &caller, + TokenId(token_id), + Property { key, value }, + false, + ) + .map_err(dispatch_to_evm::) } fn delete_property(&mut self, token_id: uint256, caller: caller, key: string) -> Result<()> { --- a/pallets/nonfungible/src/lib.rs +++ b/pallets/nonfungible/src/lib.rs @@ -449,7 +449,13 @@ property: Property, is_token_create: bool, ) -> DispatchResult { - Self::check_token_change_permission(collection, sender, token_id, &property.key, is_token_create)?; + Self::check_token_change_permission( + collection, + sender, + token_id, + &property.key, + is_token_create, + )?; >::try_mutate((collection.id, token_id), |properties| { let property = property.clone(); -- gitstuff