difftreelog
CArgo fmt
in: master
6 files changed
pallets/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
+}
pallets/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::{
pallets/nonfungible/src/common.rsdiffbeforeafterboth23};23};24use pallet_common::{24use pallet_common::{25 CommonCollectionOperations, CommonWeightInfo, with_weight, weights::WeightInfo as _,25 CommonCollectionOperations, CommonWeightInfo, with_weight, weights::WeightInfo as _,26 PropertyKeyPermission,26};27};27use sp_runtime::DispatchError;28use sp_runtime::DispatchError;28use sp_std::vec::Vec;29use sp_std::vec::Vec;pallets/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)
pallets/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,
runtime/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,