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
17use evm_coder::{solidity_interface, types::*, execution::{Result, Error}};17use evm_coder::{
18 solidity_interface,
19 types::*,
20 execution::{Result, Error},
21};
18pub use pallet_evm::{PrecompileOutput, PrecompileResult, account::CrossAccountId};22pub use pallet_evm::{PrecompileOutput, PrecompileResult, account::CrossAccountId};
19use pallet_evm_coder_substrate::dispatch_to_evm;23use pallet_evm_coder_substrate::dispatch_to_evm;
100 match limit.as_str() {95 match limit.as_str() {
101 "accountTokenOwnershipLimit" => {96 "accountTokenOwnershipLimit" => {
102 limits.account_token_ownership_limit = parse_int(value)?;97 limits.account_token_ownership_limit = parse_int(value)?;
103 },98 }
104 "sponsoredDataSize" => {99 "sponsoredDataSize" => {
105 limits.sponsored_data_size = parse_int(value)?;100 limits.sponsored_data_size = parse_int(value)?;
106 },101 }
107 "sponsoredDataRateLimit" => {102 "sponsoredDataRateLimit" => {
108 limits.sponsored_data_rate_limit = Some(SponsoringRateLimit::Blocks(parse_int(value)?.unwrap()));103 limits.sponsored_data_rate_limit =
104 Some(SponsoringRateLimit::Blocks(parse_int(value)?.unwrap()));
109 },105 }
110 "tokenLimit" => {106 "tokenLimit" => {
111 limits.token_limit = parse_int(value)?;107 limits.token_limit = parse_int(value)?;
112 },108 }
113 "sponsorTransferTimeout" => {109 "sponsorTransferTimeout" => {
114 limits.sponsor_transfer_timeout = parse_int(value)?;110 limits.sponsor_transfer_timeout = parse_int(value)?;
115 },111 }
116 "sponsorApproveTimeout" => {112 "sponsorApproveTimeout" => {
117 limits.sponsor_approve_timeout = parse_int(value)?;113 limits.sponsor_approve_timeout = parse_int(value)?;
118 },114 }
119 "ownerCanTransfer" => {115 "ownerCanTransfer" => {
120 limits.owner_can_transfer = parse_bool(value)?;116 limits.owner_can_transfer = parse_bool(value)?;
121 },117 }
122 "ownerCanDestroy" => {118 "ownerCanDestroy" => {
123 limits.owner_can_destroy = parse_bool(value)?;119 limits.owner_can_destroy = parse_bool(value)?;
124 },120 }
125 "transfersEnabled" => {121 "transfersEnabled" => {
126 limits.transfers_enabled = parse_bool(value)?;122 limits.transfers_enabled = parse_bool(value)?;
127 },123 }
128 _ => return Err(Error::Revert(format!("Unknown limit \"{}\"", limit)))124 _ => return Err(Error::Revert(format!("Unknown limit \"{}\"", limit))),
129 }125 }
130 self.limits = limits;126 self.limits = limits;
131 save(self);127 save(self);
modifiedpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -20,7 +20,7 @@
 use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
 use pallet_evm::{
 	ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure,
-	account::CrossAccountId
+	account::CrossAccountId,
 };
 use sp_core::H160;
 use 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,