difftreelog
ci fix clippy warnings
in: master
13 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5996,34 +5996,34 @@
[[package]]
name = "pallet-scheduler"
version = "3.0.0"
-source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.3#c94e0cdfe5556680dca1996004751eeb114755d7"
dependencies = [
"frame-benchmarking",
"frame-support",
"frame-system",
"log",
"parity-scale-codec 2.1.3",
+ "serde",
+ "sp-core",
"sp-io",
"sp-runtime",
"sp-std",
+ "substrate-test-utils",
+ "up-sponsorship",
]
[[package]]
name = "pallet-scheduler"
version = "3.0.0"
+source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.3#c94e0cdfe5556680dca1996004751eeb114755d7"
dependencies = [
"frame-benchmarking",
"frame-support",
"frame-system",
"log",
"parity-scale-codec 2.1.3",
- "serde",
- "sp-core",
"sp-io",
"sp-runtime",
"sp-std",
- "substrate-test-utils",
- "up-sponsorship",
]
[[package]]
crates/evm-coder-macros/src/solidity_interface.rsdiffbeforeafterboth--- a/crates/evm-coder-macros/src/solidity_interface.rs
+++ b/crates/evm-coder-macros/src/solidity_interface.rs
@@ -264,7 +264,7 @@
ReturnType::Type(_, ty) => ty,
_ => return Err(syn::Error::new(value.sig.output.span(), "interface method should return Result<value>\nif there is no value to return - specify void (which is alias to unit)")),
};
- let result = parse_result_ok(&result)?;
+ let result = parse_result_ok(result)?;
let camel_name = info
.rename_selector
@@ -285,8 +285,8 @@
Ok(Self {
name: ident.clone(),
camel_name,
- pascal_name: snake_ident_to_pascal(&ident),
- screaming_name: snake_ident_to_screaming(&ident),
+ pascal_name: snake_ident_to_pascal(ident),
+ screaming_name: snake_ident_to_screaming(ident),
selector_str,
selector,
args,
@@ -433,7 +433,7 @@
found_error = true;
}
}
- TraitItem::Method(method) => methods.push(Method::try_from(&method)?),
+ TraitItem::Method(method) => methods.push(Method::try_from(method)?),
_ => {}
}
}
crates/evm-coder-macros/src/to_log.rsdiffbeforeafterboth--- a/crates/evm-coder-macros/src/to_log.rs
+++ b/crates/evm-coder-macros/src/to_log.rs
@@ -41,7 +41,7 @@
impl Event {
fn try_from(variant: &Variant) -> syn::Result<Self> {
let name = &variant.ident;
- let name_screaming = snake_ident_to_screaming(&name);
+ let name_screaming = snake_ident_to_screaming(name);
let named = match &variant.fields {
Fields::Named(named) => named,
@@ -54,7 +54,7 @@
};
let mut fields = Vec::new();
for field in &named.named {
- fields.push(EventField::try_from(&field)?);
+ fields.push(EventField::try_from(field)?);
}
let mut selector_str = format!("{}(", name);
for (i, arg) in fields.iter().enumerate() {
crates/evm-coder/src/abi.rsdiffbeforeafterboth--- a/crates/evm-coder/src/abi.rs
+++ b/crates/evm-coder/src/abi.rs
@@ -104,7 +104,7 @@
fn subresult(&mut self) -> Result<AbiReader<'i>> {
let offset = self.read_usize()?;
Ok(AbiReader {
- buf: &self.buf,
+ buf: self.buf,
offset: offset + self.offset,
})
}
@@ -252,7 +252,7 @@
impl_abi_writeable!(&str, string);
impl AbiWrite for &string {
fn abi_write(&self, writer: &mut AbiWriter) {
- writer.string(&self)
+ writer.string(self)
}
}
node/cli/src/cli.rsdiffbeforeafterboth--- a/node/cli/src/cli.rs
+++ b/node/cli/src/cli.rs
@@ -1,6 +1,4 @@
use crate::chain_spec;
-use cumulus_client_cli;
-use sc_cli;
use std::path::PathBuf;
use structopt::StructOpt;
node/cli/src/command.rsdiffbeforeafterboth--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -120,8 +120,7 @@
}
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
- polkadot_cli::Cli::from_iter([RelayChainCli::executable_name().to_string()].iter())
- .load_spec(id)
+ polkadot_cli::Cli::from_iter([RelayChainCli::executable_name()].iter()).load_spec(id)
}
fn native_runtime_version(chain_spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
@@ -129,6 +128,7 @@
}
}
+#[allow(clippy::borrowed_box)]
fn extract_genesis_wasm(chain_spec: &Box<dyn sc_service::ChainSpec>) -> Result<Vec<u8>> {
let mut storage = chain_spec.build_storage()?;
@@ -189,7 +189,7 @@
runner.sync_run(|config| {
let polkadot_cli = RelayChainCli::new(
&config,
- [RelayChainCli::executable_name().to_string()]
+ [RelayChainCli::executable_name()]
.iter()
.chain(cli.relaychain_args.iter()),
);
@@ -275,7 +275,7 @@
let polkadot_cli = RelayChainCli::new(
&config,
- [RelayChainCli::executable_name().to_string()]
+ [RelayChainCli::executable_name()]
.iter()
.chain(cli.relaychain_args.iter()),
);
node/cli/src/service.rsdiffbeforeafterboth--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -141,7 +141,7 @@
let (client, backend, keystore_container, task_manager) =
sc_service::new_full_parts::<Block, RuntimeApi, Executor>(
- &config,
+ config,
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
)?;
let client = Arc::new(client);
pallets/contract-helpers/src/lib.rsdiffbeforeafterboth--- a/pallets/contract-helpers/src/lib.rs
+++ b/pallets/contract-helpers/src/lib.rs
@@ -213,7 +213,7 @@
Ok(Some((who.clone(), *code_hash, salt.clone())))
}
Some(pallet_contracts::Call::instantiate_with_code(_, _, code, _, salt)) => {
- let code_hash = &T::Hashing::hash(&code);
+ let code_hash = &T::Hashing::hash(code);
Ok(Some((who.clone(), *code_hash, salt.clone())))
}
_ => Ok(None),
pallets/nft/src/eth/erc_impl.rsdiffbeforeafterboth1use core::char::{decode_utf16, REPLACEMENT_CHARACTER};2use evm_coder::{3 abi::{AbiWriter, StringError},4 types::*,5};6use core::convert::TryInto;7use alloc::format;8use crate::{Allowances, Module, Balance, CollectionHandle, CollectionMode, Config, NftItemList};9use frame_support::storage::StorageDoubleMap;10use pallet_evm::AddressMapping;11use super::erc::*;12use super::account::CrossAccountId;1314type Result<T> = core::result::Result<T, StringError>;1516impl<T: Config> InlineNameSymbol for CollectionHandle<T> {17 type Error = StringError;1819 fn name(&self) -> Result<string> {20 Ok(decode_utf16(self.name.iter().copied())21 .map(|r| r.unwrap_or(REPLACEMENT_CHARACTER))22 .collect::<string>())23 }2425 fn symbol(&self) -> Result<string> {26 Ok(string::from_utf8_lossy(&self.token_prefix).into())27 }28}2930impl<T: Config> InlineTotalSupply for CollectionHandle<T> {31 type Error = StringError;3233 fn total_supply(&self) -> Result<uint256> {34 // TODO: we do not track total amount of all tokens35 Ok(0.into())36 }37}3839impl<T: Config> ERC721Metadata for CollectionHandle<T> {40 type Error = StringError;4142 fn token_uri(&self, token_id: uint256) -> Result<string> {43 // TODO: We should standartize url prefix, maybe via offchain schema?44 Ok(format!("unique.network/{}/{}", self.id, token_id))45 }4647 fn call_inline_name_symbol(&mut self, c: Msg<InlineNameSymbolCall>) -> Result<AbiWriter> {48 <Self as InlineNameSymbol>::call(self, c)49 }50}5152impl<T: Config> ERC721Enumerable for CollectionHandle<T> {53 type Error = StringError;5455 fn token_by_index(&self, index: uint256) -> Result<uint256> {56 Ok(index)57 }5859 fn token_of_owner_by_index(&self, _owner: address, _index: uint256) -> Result<uint256> {60 // TODO: Not implemetable61 Err("not implemented".into())62 }6364 fn call_inline_total_supply(&mut self, c: Msg<InlineTotalSupplyCall>) -> Result<AbiWriter> {65 <Self as InlineTotalSupply>::call(self, c)66 }67}6869impl<T: Config> ERC721 for CollectionHandle<T> {70 type Error = StringError;7172 fn balance_of(&self, owner: address) -> Result<uint256> {73 let owner = T::EvmAddressMapping::into_account_id(owner);74 let balance = <Balance<T>>::get(self.id, owner);75 Ok(balance.into())76 }77 fn owner_of(&self, token_id: uint256) -> Result<address> {78 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;79 let token = <NftItemList<T>>::get(self.id, token_id).ok_or("unknown token")?;80 Ok(*token.owner.as_eth())81 }82 fn safe_transfer_from_with_data(83 &mut self,84 _from: address,85 _to: address,86 _token_id: uint256,87 _data: bytes,88 _value: value,89 ) -> Result<void> {90 // TODO: Not implemetable91 Err("not implemented".into())92 }93 fn safe_transfer_from(94 &mut self,95 _from: address,96 _to: address,97 _token_id: uint256,98 _value: value,99 ) -> Result<void> {100 // TODO: Not implemetable101 Err("not implemented".into())102 }103104 fn transfer_from(105 &mut self,106 caller: caller,107 from: address,108 to: address,109 token_id: uint256,110 _value: value,111 ) -> Result<void> {112 let caller = T::CrossAccountId::from_eth(caller);113 let from = T::CrossAccountId::from_eth(from);114 let to = T::CrossAccountId::from_eth(to);115 let token_id = token_id.try_into().map_err(|_| "token_id overflow")?;116117 <Module<T>>::transfer_from_internal(&caller, &from, &to, &self, token_id, 1)118 .map_err(|_| "transferFrom error")?;119 Ok(())120 }121122 fn approve(123 &mut self,124 caller: caller,125 approved: address,126 token_id: uint256,127 _value: value,128 ) -> Result<void> {129 let caller = T::CrossAccountId::from_eth(caller);130 let approved = T::CrossAccountId::from_eth(approved);131 let token_id = token_id.try_into().map_err(|_| "token_id overflow")?;132133 <Module<T>>::approve_internal(&caller, &approved, &self, token_id, 1)134 .map_err(|_| "approve internal")?;135 Ok(())136 }137138 fn set_approval_for_all(139 &mut self,140 _caller: caller,141 _operator: address,142 _approved: bool,143 ) -> Result<void> {144 // TODO: Not implemetable145 Err("not implemented".into())146 }147148 fn get_approved(&self, _token_id: uint256) -> Result<address> {149 // TODO: Not implemetable150 Err("not implemented".into())151 }152153 fn is_approved_for_all(&self, _owner: address, _operator: address) -> Result<address> {154 // TODO: Not implemetable155 Err("not implemented".into())156 }157158 fn call_erc165(&mut self, c: Msg<ERC165Call>) -> Result<AbiWriter> {159 let ERC165Call::SupportsInterface { interface_id } = c.call;160 Ok(evm_coder::abi_encode!(bool(161 &ERC721Call::supports_interface(interface_id)162 )))163 }164}165166impl<T: Config> ERC721UniqueExtensions for CollectionHandle<T> {167 type Error = StringError;168 fn transfer(169 &mut self,170 caller: caller,171 to: address,172 token_id: uint256,173 _value: value,174 ) -> Result<void> {175 let caller = T::CrossAccountId::from_eth(caller);176 let to = T::CrossAccountId::from_eth(to);177 let token_id = token_id.try_into().map_err(|_| "amount overflow")?;178179 <Module<T>>::transfer_internal(&caller, &to, &self, token_id, 1)180 .map_err(|_| "transfer error")?;181 Ok(())182 }183}184185impl<T: Config> UniqueNFT for CollectionHandle<T> {186 type Error = StringError;187 fn call_erc165(&mut self, c: Msg<ERC165Call>) -> Result<AbiWriter> {188 let ERC165Call::SupportsInterface { interface_id } = c.call;189 Ok(evm_coder::abi_encode!(bool(190 &UniqueNFTCall::supports_interface(interface_id)191 )))192 }193 fn call_erc721(&mut self, c: Msg<ERC721Call>) -> Result<AbiWriter> {194 <Self as ERC721>::call(self, c)195 }196 fn call_erc721_metadata(&mut self, c: Msg<ERC721MetadataCall>) -> Result<AbiWriter> {197 <Self as ERC721Metadata>::call(self, c)198 }199 fn call_erc721_enumerable(&mut self, c: Msg<ERC721EnumerableCall>) -> Result<AbiWriter> {200 <Self as ERC721Enumerable>::call(self, c)201 }202 fn call_erc721_unique_extensions(203 &mut self,204 c: Msg<ERC721UniqueExtensionsCall>,205 ) -> Result<AbiWriter> {206 <Self as ERC721UniqueExtensions>::call(self, c)207 }208}209210impl<T: Config> ERC20 for CollectionHandle<T> {211 type Error = StringError;212 fn decimals(&self) -> Result<uint8> {213 Ok(if let CollectionMode::Fungible(decimals) = &self.mode {214 *decimals215 } else {216 unreachable!()217 })218 }219 fn balance_of(&self, owner: address) -> Result<uint256> {220 let owner = T::EvmAddressMapping::into_account_id(owner);221 let balance = <Balance<T>>::get(self.id, owner);222 Ok(balance.into())223 }224 fn transfer(&mut self, caller: caller, to: address, amount: uint256) -> Result<bool> {225 let caller = T::CrossAccountId::from_eth(caller);226 let to = T::CrossAccountId::from_eth(to);227 let amount = amount.try_into().map_err(|_| "amount overflow")?;228229 <Module<T>>::transfer_internal(&caller, &to, &self, 1, amount)230 .map_err(|_| "transfer error")?;231 Ok(true)232 }233 fn transfer_from(234 &mut self,235 caller: caller,236 from: address,237 to: address,238 amount: uint256,239 ) -> Result<bool> {240 let caller = T::CrossAccountId::from_eth(caller);241 let from = T::CrossAccountId::from_eth(from);242 let to = T::CrossAccountId::from_eth(to);243 let amount = amount.try_into().map_err(|_| "amount overflow")?;244245 <Module<T>>::transfer_from_internal(&caller, &from, &to, &self, 1, amount)246 .map_err(|_| "transferFrom error")?;247 Ok(true)248 }249 fn approve(&mut self, caller: caller, spender: address, amount: uint256) -> Result<bool> {250 let caller = T::CrossAccountId::from_eth(caller);251 let spender = T::CrossAccountId::from_eth(spender);252 let amount = amount.try_into().map_err(|_| "amount overflow")?;253254 <Module<T>>::approve_internal(&caller, &spender, &self, 1, amount)255 .map_err(|_| "approve internal")?;256 Ok(true)257 }258 fn allowance(&self, owner: address, spender: address) -> Result<uint256> {259 let owner = T::CrossAccountId::from_eth(owner);260 let spender = T::CrossAccountId::from_eth(spender);261262 Ok(<Allowances<T>>::get(self.id, (1, owner.as_sub(), spender.as_sub())).into())263 }264 fn call_inline_name_symbol(&mut self, c: Msg<InlineNameSymbolCall>) -> Result<AbiWriter> {265 <Self as InlineNameSymbol>::call(self, c)266 }267 fn call_inline_total_supply(&mut self, c: Msg<InlineTotalSupplyCall>) -> Result<AbiWriter> {268 <Self as InlineTotalSupply>::call(self, c)269 }270}271272impl<T: Config> UniqueFungible for CollectionHandle<T> {273 type Error = StringError;274 fn call_erc165(&mut self, c: Msg<ERC165Call>) -> Result<AbiWriter> {275 let ERC165Call::SupportsInterface { interface_id } = c.call;276 Ok(evm_coder::abi_encode!(bool(277 &UniqueNFTCall::supports_interface(interface_id)278 )))279 }280 fn call_erc20(&mut self, c: Msg<ERC20Call>) -> Result<AbiWriter> {281 <Self as ERC20>::call(self, c)282 }283}pallets/nft/src/eth/mod.rsdiffbeforeafterboth--- a/pallets/nft/src/eth/mod.rs
+++ b/pallets/nft/src/eth/mod.rs
@@ -108,7 +108,7 @@
.unwrap_or(false)
}
fn get_code(target: &H160) -> Option<Vec<u8>> {
- map_eth_to_id(&target)
+ map_eth_to_id(target)
.and_then(<CollectionById<T>>::get)
.map(|collection| {
match collection.mode {
@@ -127,7 +127,7 @@
input: &[u8],
value: U256,
) -> Option<PrecompileOutput> {
- let mut collection = map_eth_to_id(&target)
+ let mut collection = map_eth_to_id(target)
.and_then(|id| <CollectionHandle<T>>::get_with_gas_limit(id, gas_limit))?;
let (method_id, input) = AbiReader::new_call(input).unwrap();
let result = call_internal(&mut collection, *source, method_id, input, value);
pallets/nft/src/eth/sponsoring.rsdiffbeforeafterboth--- a/pallets/nft/src/eth/sponsoring.rs
+++ b/pallets/nft/src/eth/sponsoring.rs
@@ -132,10 +132,10 @@
) -> Result<Self::LiquidityInfo, pallet_evm::Error<T>> {
let mut who_pays_fee = *who;
if let WithdrawReason::Call { target, input } = &reason {
- if let Some(collection_id) = crate::eth::map_eth_to_id(&target) {
+ if let Some(collection_id) = crate::eth::map_eth_to_id(target) {
if let Some(collection) = <CollectionById<T>>::get(collection_id) {
if let Some(sponsor) = collection.sponsorship.sponsor() {
- if try_sponsor(who, collection_id, &collection, &input).is_ok() {
+ if try_sponsor(who, collection_id, &collection, input).is_ok() {
who_pays_fee =
T::EvmBackwardsAddressMapping::from_account_id(sponsor.clone());
}
pallets/nft/src/lib.rsdiffbeforeafterboth--- a/pallets/nft/src/lib.rs
+++ b/pallets/nft/src/lib.rs
@@ -1232,7 +1232,7 @@
) -> DispatchResult {
let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
let mut target_collection = Self::get_collection(collection_id)?;
- Self::check_owner_permissions(&target_collection, &sender.as_sub())?;
+ Self::check_owner_permissions(&target_collection, sender.as_sub())?;
let old_limits = &target_collection.limits;
let chain_limits = ChainLimit::get();
@@ -1267,9 +1267,9 @@
owner: &T::CrossAccountId,
data: CreateItemData,
) -> DispatchResult {
- Self::can_create_items_in_collection(&collection, &sender, &owner, 1)?;
- Self::validate_create_item_args(&collection, &data)?;
- Self::create_item_no_validation(&collection, owner, data)?;
+ Self::can_create_items_in_collection(collection, sender, owner, 1)?;
+ Self::validate_create_item_args(collection, &data)?;
+ Self::create_item_no_validation(collection, owner, data)?;
Ok(())
}
@@ -1283,18 +1283,18 @@
) -> DispatchResult {
target_collection.consume_gas(2000000)?;
// Limits check
- Self::is_correct_transfer(target_collection, &recipient)?;
+ Self::is_correct_transfer(target_collection, recipient)?;
// Transfer permissions check
ensure!(
- Self::is_item_owner(&sender, target_collection, item_id)
- || Self::is_owner_or_admin_permissions(target_collection, &sender),
+ Self::is_item_owner(sender, target_collection, item_id)
+ || Self::is_owner_or_admin_permissions(target_collection, sender),
Error::<T>::NoPermission
);
if target_collection.access == AccessMode::WhiteList {
- Self::check_white_list(target_collection, &sender)?;
- Self::check_white_list(target_collection, &recipient)?;
+ Self::check_white_list(target_collection, sender)?;
+ Self::check_white_list(target_collection, recipient)?;
}
match target_collection.mode {
@@ -1305,7 +1305,7 @@
recipient.clone(),
)?,
CollectionMode::Fungible(_) => {
- Self::transfer_fungible(target_collection, value, &sender, &recipient)?
+ Self::transfer_fungible(target_collection, value, sender, recipient)?
}
CollectionMode::ReFungible => Self::transfer_refungible(
target_collection,
@@ -1336,23 +1336,23 @@
amount: u128,
) -> DispatchResult {
collection.consume_gas(2000000)?;
- Self::token_exists(&collection, item_id)?;
+ Self::token_exists(collection, item_id)?;
// Transfer permissions check
let bypasses_limits = collection.limits.owner_can_transfer
- && Self::is_owner_or_admin_permissions(&collection, &sender);
+ && Self::is_owner_or_admin_permissions(collection, sender);
let allowance_limit = if bypasses_limits {
None
- } else if let Some(amount) = Self::owned_amount(&sender, &collection, item_id) {
+ } else if let Some(amount) = Self::owned_amount(sender, collection, item_id) {
Some(amount)
} else {
fail!(Error::<T>::NoPermission);
};
if collection.access == AccessMode::WhiteList {
- Self::check_white_list(&collection, &sender)?;
- Self::check_white_list(&collection, &spender)?;
+ Self::check_white_list(collection, sender)?;
+ Self::check_white_list(collection, spender)?;
}
let allowance: u128 = amount
@@ -1412,19 +1412,19 @@
<Allowances<T>>::get(collection.id, (item_id, from.as_sub(), sender.as_sub()));
// Limits check
- Self::is_correct_transfer(&collection, &recipient)?;
+ Self::is_correct_transfer(collection, recipient)?;
// Transfer permissions check
ensure!(
approval >= amount
|| (collection.limits.owner_can_transfer
- && Self::is_owner_or_admin_permissions(&collection, &sender)),
+ && Self::is_owner_or_admin_permissions(collection, sender)),
Error::<T>::NoPermission
);
if collection.access == AccessMode::WhiteList {
- Self::check_white_list(&collection, &sender)?;
- Self::check_white_list(&collection, &recipient)?;
+ Self::check_white_list(collection, sender)?;
+ Self::check_white_list(collection, recipient)?;
}
// Reduce approval by transferred amount or remove if remaining approval drops to 0
@@ -1441,13 +1441,13 @@
match collection.mode {
CollectionMode::NFT => {
- Self::transfer_nft(&collection, item_id, from.clone(), recipient.clone())?
+ Self::transfer_nft(collection, item_id, from.clone(), recipient.clone())?
}
CollectionMode::Fungible(_) => {
- Self::transfer_fungible(&collection, amount, &from, &recipient)?
+ Self::transfer_fungible(collection, amount, from, recipient)?
}
CollectionMode::ReFungible => Self::transfer_refungible(
- &collection,
+ collection,
item_id,
amount,
from.clone(),
@@ -1473,7 +1473,7 @@
item_id: TokenId,
data: Vec<u8>,
) -> DispatchResult {
- Self::token_exists(&collection, item_id)?;
+ Self::token_exists(collection, item_id)?;
ensure!(
ChainLimit::get().custom_data_limit >= data.len() as u32,
@@ -1482,15 +1482,15 @@
// Modify permissions check
ensure!(
- Self::is_item_owner(&sender, &collection, item_id)
- || Self::is_owner_or_admin_permissions(&collection, &sender),
+ Self::is_item_owner(sender, collection, item_id)
+ || Self::is_owner_or_admin_permissions(collection, sender),
Error::<T>::NoPermission
);
match collection.mode {
- CollectionMode::NFT => Self::set_nft_variable_data(&collection, item_id, data)?,
+ CollectionMode::NFT => Self::set_nft_variable_data(collection, item_id, data)?,
CollectionMode::ReFungible => {
- Self::set_re_fungible_variable_data(&collection, item_id, data)?
+ Self::set_re_fungible_variable_data(collection, item_id, data)?
}
CollectionMode::Fungible(_) => fail!(Error::<T>::CantStoreMetadataInFungibleTokens),
_ => fail!(Error::<T>::UnexpectedCollectionType),
@@ -1505,18 +1505,13 @@
owner: &T::CrossAccountId,
items_data: Vec<CreateItemData>,
) -> DispatchResult {
- Self::can_create_items_in_collection(
- &collection,
- &sender,
- &owner,
- items_data.len() as u32,
- )?;
+ Self::can_create_items_in_collection(collection, sender, owner, items_data.len() as u32)?;
for data in &items_data {
- Self::validate_create_item_args(&collection, data)?;
+ Self::validate_create_item_args(collection, data)?;
}
for data in &items_data {
- Self::create_item_no_validation(&collection, owner, data.clone())?;
+ Self::create_item_no_validation(collection, owner, data.clone())?;
}
Ok(())
@@ -1529,22 +1524,20 @@
value: u128,
) -> DispatchResult {
ensure!(
- Self::is_item_owner(&sender, &collection, item_id)
+ Self::is_item_owner(sender, collection, item_id)
|| (collection.limits.owner_can_transfer
- && Self::is_owner_or_admin_permissions(&collection, &sender)),
+ && Self::is_owner_or_admin_permissions(collection, sender)),
Error::<T>::NoPermission
);
if collection.access == AccessMode::WhiteList {
- Self::check_white_list(&collection, &sender)?;
+ Self::check_white_list(collection, sender)?;
}
match collection.mode {
- CollectionMode::NFT => Self::burn_nft_item(&collection, item_id)?,
- CollectionMode::Fungible(_) => Self::burn_fungible_item(&sender, &collection, value)?,
- CollectionMode::ReFungible => {
- Self::burn_refungible_item(&collection, item_id, &sender)?
- }
+ CollectionMode::NFT => Self::burn_nft_item(collection, item_id)?,
+ CollectionMode::Fungible(_) => Self::burn_fungible_item(sender, collection, value)?,
+ CollectionMode::ReFungible => Self::burn_refungible_item(collection, item_id, sender)?,
_ => (),
};
@@ -1557,7 +1550,7 @@
address: &T::CrossAccountId,
whitelisted: bool,
) -> DispatchResult {
- Self::check_owner_or_admin_permissions(&collection, &sender)?;
+ Self::check_owner_or_admin_permissions(collection, sender)?;
if whitelisted {
<WhiteList<T>>::insert(collection.id, address.as_sub(), true);
@@ -1610,7 +1603,7 @@
Error::<T>::AccountTokenLimitExceeded
);
- if !Self::is_owner_or_admin_permissions(collection, &sender) {
+ if !Self::is_owner_or_admin_permissions(collection, sender) {
ensure!(collection.mint_mode, Error::<T>::PublicMintingNotAllowed);
Self::check_white_list(collection, owner)?;
Self::check_white_list(collection, sender)?;
@@ -1691,7 +1684,7 @@
Self::add_nft_item(collection, item)?;
}
CreateItemData::Fungible(data) => {
- Self::add_fungible_item(collection, &owner, data.value)?;
+ Self::add_fungible_item(collection, owner, data.value)?;
}
CreateItemData::ReFungible(data) => {
let owner_list = vec![Ownership {
@@ -1934,7 +1927,7 @@
subject: &T::CrossAccountId,
) -> bool {
*subject.as_sub() == collection.owner
- || <AdminList<T>>::get(collection.id).contains(&subject)
+ || <AdminList<T>>::get(collection.id).contains(subject)
}
fn check_owner_or_admin_permissions(
@@ -1979,7 +1972,7 @@
) -> bool {
match target_collection.mode {
CollectionMode::Fungible(_) => true,
- _ => Self::owned_amount(&subject, target_collection, item_id).is_some(),
+ _ => Self::owned_amount(subject, target_collection, item_id).is_some(),
}
}
pallets/nft/src/sponsorship.rsdiffbeforeafterboth--- a/pallets/nft/src/sponsorship.rs
+++ b/pallets/nft/src/sponsorship.rs
@@ -179,14 +179,14 @@
{
fn get_sponsor(who: &T::AccountId, call: &C) -> Option<T::AccountId> {
match IsSubType::<Call<T>>::is_sub_type(call)? {
- Call::create_item(collection_id, _owner, _properties) => {
- Self::withdraw_create_item(who, collection_id, &_properties)
+ Call::create_item(collection_id, _owner, properties) => {
+ Self::withdraw_create_item(who, collection_id, properties)
}
Call::transfer(_new_owner, collection_id, item_id, _value) => {
Self::withdraw_transfer(who, collection_id, item_id)
}
Call::set_variable_meta_data(collection_id, item_id, data) => {
- Self::withdraw_set_variable_meta_data(collection_id, item_id, &data)
+ Self::withdraw_set_variable_meta_data(collection_id, item_id, data)
}
_ => None,
}