git.delta.rocks / unique-network / refs/commits / 58de5ce0e935

difftreelog

CArgo fmt

Trubnikov Sergey2022-05-27parent: #dbc2fd5.patch.diff
in: master

6 files changed

modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -14,7 +14,11 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-use evm_coder::{solidity_interface, types::*, execution::{Result, Error}};
+use evm_coder::{
+	solidity_interface,
+	types::*,
+	execution::{Result, Error},
+};
 pub use pallet_evm::{PrecompileOutput, PrecompileResult, account::CrossAccountId};
 use pallet_evm_coder_substrate::dispatch_to_evm;
 use sp_core::{H160, U256};
@@ -66,11 +70,7 @@
 		Ok(prop.to_vec())
 	}
 
-	fn eth_set_sponsor(
-		&mut self,
-		caller: caller,
-		sponsor: address,
-	) -> Result<void> {
+	fn eth_set_sponsor(&mut self, caller: caller, sponsor: address) -> Result<void> {
 		check_is_owner(caller, self)?;
 
 		let sponsor = T::CrossAccountId::from_eth(sponsor);
@@ -88,44 +88,40 @@
 		Ok(())
 	}
 
-	fn set_limit(
-		&mut self,
-		caller: caller,
-		limit: string,
-		value: string,
-	) -> Result<void> {
+	fn set_limit(&mut self, caller: caller, limit: string, value: string) -> Result<void> {
 		check_is_owner(caller, self)?;
 		let mut limits = self.limits.clone();
 
 		match limit.as_str() {
 			"accountTokenOwnershipLimit" => {
 				limits.account_token_ownership_limit = parse_int(value)?;
-			},
+			}
 			"sponsoredDataSize" => {
 				limits.sponsored_data_size = parse_int(value)?;
-			},
+			}
 			"sponsoredDataRateLimit" => {
-				limits.sponsored_data_rate_limit = Some(SponsoringRateLimit::Blocks(parse_int(value)?.unwrap()));
-			},
+				limits.sponsored_data_rate_limit =
+					Some(SponsoringRateLimit::Blocks(parse_int(value)?.unwrap()));
+			}
 			"tokenLimit" => {
 				limits.token_limit = parse_int(value)?;
-			},
+			}
 			"sponsorTransferTimeout" => {
 				limits.sponsor_transfer_timeout = parse_int(value)?;
-			},
+			}
 			"sponsorApproveTimeout" => {
 				limits.sponsor_approve_timeout = parse_int(value)?;
-			},
+			}
 			"ownerCanTransfer" => {
 				limits.owner_can_transfer = parse_bool(value)?;
-			},
+			}
 			"ownerCanDestroy" => {
 				limits.owner_can_destroy = parse_bool(value)?;
-			},
+			}
 			"transfersEnabled" => {
 				limits.transfers_enabled = parse_bool(value)?;
-			},
-			_ => return Err(Error::Revert(format!("Unknown limit \"{}\"", limit)))
+			}
+			_ => return Err(Error::Revert(format!("Unknown limit \"{}\"", limit))),
 		}
 		self.limits = limits;
 		save(self);
@@ -150,13 +146,15 @@
 }
 
 fn parse_int(value: string) -> Result<Option<u32>> {
-	value.parse::<u32>()
+	value
+		.parse::<u32>()
 		.map_err(|e| Error::Revert(format!("Int value \"{}\" parse error: {}", value, e)))
 		.map(|value| Some(value))
 }
 
 fn parse_bool(value: string) -> Result<Option<bool>> {
-	value.parse::<bool>()
+	value
+		.parse::<bool>()
 		.map_err(|e| Error::Revert(format!("Bool value \"{}\" parse error: {}", value, e)))
 		.map(|value| Some(value))
-}
\ No newline at end of file
+}
modifiedpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth
20use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};20use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
21use pallet_evm::{21use pallet_evm::{
22 ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure,22 ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure,
23 account::CrossAccountId23 account::CrossAccountId,
24};24};
25use sp_core::H160;25use sp_core::H160;
26use crate::{26use crate::{
modifiedpallets/nonfungible/src/common.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -23,6 +23,7 @@
 };
 use pallet_common::{
 	CommonCollectionOperations, CommonWeightInfo, with_weight, weights::WeightInfo as _,
+	PropertyKeyPermission,
 };
 use sp_runtime::DispatchError;
 use sp_std::vec::Vec;
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -21,7 +21,10 @@
 };
 use evm_coder::{ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*, weight};
 use frame_support::BoundedVec;
-use up_data_structs::{TokenId, SchemaVersion, PropertyPermission, PropertyKeyPermission, Property, CollectionId, PropertyKey, CollectionPropertiesVec};
+use up_data_structs::{
+	TokenId, SchemaVersion, PropertyPermission, PropertyKeyPermission, Property, CollectionId,
+	PropertyKey, CollectionPropertiesVec,
+};
 use pallet_evm_coder_substrate::dispatch_to_evm;
 use sp_core::{H160, U256};
 use sp_std::vec::Vec;
@@ -382,11 +385,15 @@
 		}
 
 		let mut properties = CollectionPropertiesVec::default();
-		properties.try_push(Property{
-			key,
-			value: token_uri.into_bytes().try_into()
-				.map_err(|_| "token uri is too long")?
-		}).map_err(|e| Error::Revert(alloc::format!("Can't add property: {:?}", e)))?;
+		properties
+			.try_push(Property {
+				key,
+				value: token_uri
+					.into_bytes()
+					.try_into()
+					.map_err(|_| "token uri is too long")?,
+			})
+			.map_err(|e| Error::Revert(alloc::format!("Can't add property: {:?}", e)))?;
 
 		<Pallet<T>>::create_item(
 			self,
@@ -407,10 +414,14 @@
 	}
 }
 
-fn get_token_permission<T: Config>(collection_id: CollectionId, key: &PropertyKey) -> Result<PropertyPermission> {
+fn get_token_permission<T: Config>(
+	collection_id: CollectionId,
+	key: &PropertyKey,
+) -> Result<PropertyPermission> {
 	let token_property_permissions = CollectionPropertyPermissions::<T>::try_get(collection_id)
 		.map_err(|_| Error::Revert("No permissions for collection".into()))?;
-	let a = token_property_permissions.get(key)
+	let a = token_property_permissions
+		.get(key)
 		.map(|p| p.clone())
 		.ok_or_else(|| Error::Revert("No permission for tokenURI".into()))?;
 	Ok(a)
modifiedpallets/unique/src/eth/mod.rsdiffbeforeafterboth
--- a/pallets/unique/src/eth/mod.rs
+++ b/pallets/unique/src/eth/mod.rs
@@ -83,11 +83,11 @@
 			collection_admin: true,
 			token_owner: false,
 		};
-		let mut token_property_permissions = up_data_structs::CollectionPropertiesPermissionsVec::default();
-		token_property_permissions.try_push(up_data_structs::PropertyKeyPermission{
-			key,
-			permission,
-		}).map_err(|e| Error::Revert(format!("{:?}", e)))?;
+		let mut token_property_permissions =
+			up_data_structs::CollectionPropertiesPermissionsVec::default();
+		token_property_permissions
+			.try_push(up_data_structs::PropertyKeyPermission { key, permission })
+			.map_err(|e| Error::Revert(format!("{:?}", e)))?;
 
 		let data = CreateCollectionData {
 			name,
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -49,8 +49,8 @@
 // A few exports that help ease life for downstream crates.
 pub use pallet_balances::Call as BalancesCall;
 pub use pallet_evm::{
-	EnsureAddressTruncated, HashedAddressMapping, Runner, account::CrossAccountId as _, OnMethodCall,
-	Account as EVMAccount, FeeCalculator, GasWeightMapping,
+	EnsureAddressTruncated, HashedAddressMapping, Runner, account::CrossAccountId as _,
+	OnMethodCall, Account as EVMAccount, FeeCalculator, GasWeightMapping,
 };
 pub use frame_support::{
 	construct_runtime, match_types,