From 45404723cf23203ef3572a4a92e52a2205634d53 Mon Sep 17 00:00:00 2001 From: Trubnikov Sergey Date: Wed, 18 Jan 2023 08:56:20 +0000 Subject: [PATCH] refac: rename caller -> Caller --- --- a/crates/evm-coder/procedural/src/solidity_interface.rs +++ b/crates/evm-coder/procedural/src/solidity_interface.rs @@ -354,7 +354,7 @@ fn is_caller(&self) -> bool { if let Ok(ident) = self.plain() { - return ident == "caller"; + return ident == "Caller"; } false } --- a/crates/evm-coder/src/lib.rs +++ b/crates/evm-coder/src/lib.rs @@ -147,7 +147,7 @@ /// Makes function payable pub type Value = U256; /// Makes function caller-sensitive - pub type caller = Address; + pub type Caller = Address; //#endregion /// Ethereum typed call message, similar to solidity --- a/crates/evm-coder/tests/random.rs +++ b/crates/evm-coder/tests/random.rs @@ -64,7 +64,7 @@ unreachable!() } - fn caller_sensitive(&self, _caller: caller) -> Result { + fn caller_sensitive(&self, _caller: Caller) -> Result { unreachable!() } fn payable(&mut self, _value: Value) -> Result { --- a/crates/evm-coder/tests/solidity_generation.rs +++ b/crates/evm-coder/tests/solidity_generation.rs @@ -28,19 +28,19 @@ fn balance_of(&self, _owner: Address) -> Result { unreachable!() } - fn transfer(&mut self, _caller: caller, _to: Address, _value: U256) -> Result { + fn transfer(&mut self, _caller: Caller, _to: Address, _value: U256) -> Result { unreachable!() } fn transfer_from( &mut self, - _caller: caller, + _caller: Caller, _from: Address, _to: Address, _value: U256, ) -> Result { unreachable!() } - fn approve(&mut self, _caller: caller, _spender: Address, _value: U256) -> Result { + fn approve(&mut self, _caller: Caller, _spender: Address, _value: U256) -> Result { unreachable!() } fn allowance(&self, _owner: Address, _spender: Address) -> Result { --- a/pallets/common/src/erc.rs +++ b/pallets/common/src/erc.rs @@ -94,7 +94,7 @@ /// @param value Propery value. #[solidity(hide)] #[weight(>::set_collection_properties(1))] - fn set_collection_property(&mut self, caller: caller, key: String, value: Bytes) -> Result<()> { + fn set_collection_property(&mut self, caller: Caller, key: String, value: Bytes) -> Result<()> { let caller = T::CrossAccountId::from_eth(caller); let key = >::from(key) .try_into() @@ -111,7 +111,7 @@ #[weight(>::set_collection_properties(properties.len() as u32))] fn set_collection_properties( &mut self, - caller: caller, + caller: Caller, properties: Vec, ) -> Result<()> { let caller = T::CrossAccountId::from_eth(caller); @@ -130,7 +130,7 @@ /// @param key Property key. #[solidity(hide)] #[weight(>::delete_collection_properties(1))] - fn delete_collection_property(&mut self, caller: caller, key: String) -> Result<()> { + fn delete_collection_property(&mut self, caller: Caller, key: String) -> Result<()> { let caller = T::CrossAccountId::from_eth(caller); let key = >::from(key) .try_into() @@ -143,7 +143,7 @@ /// /// @param keys Properties keys. #[weight(>::delete_collection_properties(keys.len() as u32))] - fn delete_collection_properties(&mut self, caller: caller, keys: Vec) -> Result<()> { + fn delete_collection_properties(&mut self, caller: Caller, keys: Vec) -> Result<()> { let caller = T::CrossAccountId::from_eth(caller); let keys = keys .into_iter() @@ -208,7 +208,7 @@ /// /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract. #[solidity(hide)] - fn set_collection_sponsor(&mut self, caller: caller, sponsor: Address) -> Result<()> { + fn set_collection_sponsor(&mut self, caller: Caller, sponsor: Address) -> Result<()> { self.consume_store_reads_and_writes(1, 1)?; let caller = T::CrossAccountId::from_eth(caller); @@ -225,7 +225,7 @@ /// @param sponsor Cross account address of the sponsor from whose account funds will be debited for operations with the contract. fn set_collection_sponsor_cross( &mut self, - caller: caller, + caller: Caller, sponsor: eth::CrossAddress, ) -> Result<()> { self.consume_store_reads_and_writes(1, 1)?; @@ -248,7 +248,7 @@ /// Collection sponsorship confirmation. /// /// @dev After setting the sponsor for the collection, it must be confirmed with this function. - fn confirm_collection_sponsorship(&mut self, caller: caller) -> Result<()> { + fn confirm_collection_sponsorship(&mut self, caller: Caller) -> Result<()> { self.consume_store_writes(1)?; let caller = T::CrossAccountId::from_eth(caller); @@ -257,7 +257,7 @@ } /// Remove collection sponsor. - fn remove_collection_sponsor(&mut self, caller: caller) -> Result<()> { + fn remove_collection_sponsor(&mut self, caller: Caller) -> Result<()> { self.consume_store_reads_and_writes(1, 1)?; let caller = T::CrossAccountId::from_eth(caller); self.remove_sponsor(&caller).map_err(dispatch_to_evm::) @@ -339,7 +339,7 @@ /// @dev Throws error if limit not found. /// @param limit Some limit. #[solidity(rename_selector = "setCollectionLimit")] - fn set_collection_limit(&mut self, caller: caller, limit: eth::CollectionLimit) -> Result<()> { + fn set_collection_limit(&mut self, caller: Caller, limit: eth::CollectionLimit) -> Result<()> { self.consume_store_reads_and_writes(1, 1)?; if !limit.has_value() { @@ -359,7 +359,7 @@ /// @param newAdmin Cross account administrator address. fn add_collection_admin_cross( &mut self, - caller: caller, + caller: Caller, new_admin: eth::CrossAddress, ) -> Result<()> { self.consume_store_reads_and_writes(2, 2)?; @@ -374,7 +374,7 @@ /// @param admin Cross account administrator address. fn remove_collection_admin_cross( &mut self, - caller: caller, + caller: Caller, admin: eth::CrossAddress, ) -> Result<()> { self.consume_store_reads_and_writes(2, 2)?; @@ -388,7 +388,7 @@ /// Add collection admin. /// @param newAdmin Address of the added administrator. #[solidity(hide)] - fn add_collection_admin(&mut self, caller: caller, new_admin: Address) -> Result<()> { + fn add_collection_admin(&mut self, caller: Caller, new_admin: Address) -> Result<()> { self.consume_store_reads_and_writes(2, 2)?; let caller = T::CrossAccountId::from_eth(caller); @@ -401,7 +401,7 @@ /// /// @param admin Address of the removed administrator. #[solidity(hide)] - fn remove_collection_admin(&mut self, caller: caller, admin: Address) -> Result<()> { + fn remove_collection_admin(&mut self, caller: Caller, admin: Address) -> Result<()> { self.consume_store_reads_and_writes(2, 2)?; let caller = T::CrossAccountId::from_eth(caller); @@ -414,7 +414,7 @@ /// /// @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled' #[solidity(rename_selector = "setCollectionNesting")] - fn set_nesting_bool(&mut self, caller: caller, enable: bool) -> Result<()> { + fn set_nesting_bool(&mut self, caller: Caller, enable: bool) -> Result<()> { self.consume_store_reads_and_writes(1, 1)?; let caller = T::CrossAccountId::from_eth(caller); @@ -435,7 +435,7 @@ #[solidity(rename_selector = "setCollectionNesting")] fn set_nesting( &mut self, - caller: caller, + caller: Caller, enable: bool, collections: Vec
, ) -> Result<()> { @@ -503,7 +503,7 @@ } /// Set the collection access method. /// @param mode Access mode - fn set_collection_access(&mut self, caller: caller, mode: eth::AccessMode) -> Result<()> { + fn set_collection_access(&mut self, caller: Caller, mode: eth::AccessMode) -> Result<()> { self.consume_store_reads_and_writes(1, 1)?; let caller = T::CrossAccountId::from_eth(caller); @@ -526,7 +526,7 @@ /// /// @param user Address of a trusted user. #[solidity(hide)] - fn add_to_collection_allow_list(&mut self, caller: caller, user: Address) -> Result<()> { + fn add_to_collection_allow_list(&mut self, caller: Caller, user: Address) -> Result<()> { self.consume_store_writes(1)?; let caller = T::CrossAccountId::from_eth(caller); @@ -540,7 +540,7 @@ /// @param user User cross account address. fn add_to_collection_allow_list_cross( &mut self, - caller: caller, + caller: Caller, user: eth::CrossAddress, ) -> Result<()> { self.consume_store_writes(1)?; @@ -555,7 +555,7 @@ /// /// @param user Address of a removed user. #[solidity(hide)] - fn remove_from_collection_allow_list(&mut self, caller: caller, user: Address) -> Result<()> { + fn remove_from_collection_allow_list(&mut self, caller: Caller, user: Address) -> Result<()> { self.consume_store_writes(1)?; let caller = T::CrossAccountId::from_eth(caller); @@ -569,7 +569,7 @@ /// @param user User cross account address. fn remove_from_collection_allow_list_cross( &mut self, - caller: caller, + caller: Caller, user: eth::CrossAddress, ) -> Result<()> { self.consume_store_writes(1)?; @@ -583,7 +583,7 @@ /// Switch permission for minting. /// /// @param mode Enable if "true". - fn set_collection_mint_mode(&mut self, caller: caller, mode: bool) -> Result<()> { + fn set_collection_mint_mode(&mut self, caller: Caller, mode: bool) -> Result<()> { self.consume_store_reads_and_writes(1, 1)?; let caller = T::CrossAccountId::from_eth(caller); @@ -640,7 +640,7 @@ /// @dev Owner can be changed only by current owner /// @param newOwner new owner account #[solidity(hide, rename_selector = "changeCollectionOwner")] - fn set_owner(&mut self, caller: caller, new_owner: Address) -> Result<()> { + fn set_owner(&mut self, caller: Caller, new_owner: Address) -> Result<()> { self.consume_store_writes(1)?; let caller = T::CrossAccountId::from_eth(caller); @@ -666,7 +666,7 @@ /// @param newOwner new owner cross account fn change_collection_owner_cross( &mut self, - caller: caller, + caller: Caller, new_owner: eth::CrossAddress, ) -> Result<()> { self.consume_store_writes(1)?; --- a/pallets/evm-contract-helpers/src/eth.rs +++ b/pallets/evm-contract-helpers/src/eth.rs @@ -105,7 +105,7 @@ /// @param sponsor User address who set as pending sponsor. fn set_sponsor( &mut self, - caller: caller, + caller: Caller, contract_address: Address, sponsor: Address, ) -> Result<()> { @@ -125,7 +125,7 @@ /// Set contract as self sponsored. /// /// @param contractAddress Contract for which a self sponsoring is being enabled. - fn self_sponsored_enable(&mut self, caller: caller, contract_address: Address) -> Result<()> { + fn self_sponsored_enable(&mut self, caller: Caller, contract_address: Address) -> Result<()> { self.recorder().consume_sload()?; self.recorder().consume_sstore()?; @@ -146,7 +146,7 @@ /// Remove sponsor. /// /// @param contractAddress Contract for which a sponsorship is being removed. - fn remove_sponsor(&mut self, caller: caller, contract_address: Address) -> Result<()> { + fn remove_sponsor(&mut self, caller: Caller, contract_address: Address) -> Result<()> { self.recorder().consume_sload()?; self.recorder().consume_sstore()?; @@ -161,7 +161,7 @@ /// @dev Caller must be same that set via [`setSponsor`]. /// /// @param contractAddress Сontract for which need to confirm sponsorship. - fn confirm_sponsorship(&mut self, caller: caller, contract_address: Address) -> Result<()> { + fn confirm_sponsorship(&mut self, caller: Caller, contract_address: Address) -> Result<()> { self.recorder().consume_sload()?; self.recorder().consume_sstore()?; @@ -207,7 +207,7 @@ fn set_sponsoring_mode( &mut self, - caller: caller, + caller: Caller, contract_address: Address, mode: SponsoringModeT, ) -> Result<()> { @@ -239,7 +239,7 @@ /// @dev Only contract owner can change this setting fn set_sponsoring_rate_limit( &mut self, - caller: caller, + caller: Caller, contract_address: Address, rate_limit: u32, ) -> Result<()> { @@ -259,7 +259,7 @@ /// @dev Only contract owner can change this setting fn set_sponsoring_fee_limit( &mut self, - caller: caller, + caller: Caller, contract_address: Address, fee_limit: U256, ) -> Result<()> { @@ -300,7 +300,7 @@ /// @dev Only contract owner can change this setting fn toggle_allowed( &mut self, - caller: caller, + caller: Caller, contract_address: Address, user: Address, is_allowed: bool, @@ -329,7 +329,7 @@ /// @param enabled Should allowlist access to be enabled? fn toggle_allowlist( &mut self, - caller: caller, + caller: Caller, contract_address: Address, enabled: bool, ) -> Result<()> { --- a/pallets/fungible/src/erc.rs +++ b/pallets/fungible/src/erc.rs @@ -86,7 +86,7 @@ Ok(balance.into()) } #[weight(>::transfer())] - fn transfer(&mut self, caller: caller, to: Address, amount: U256) -> Result { + fn transfer(&mut self, caller: Caller, to: Address, amount: U256) -> Result { let caller = T::CrossAccountId::from_eth(caller); let to = T::CrossAccountId::from_eth(to); let amount = amount.try_into().map_err(|_| "amount overflow")?; @@ -101,7 +101,7 @@ #[weight(>::transfer_from())] fn transfer_from( &mut self, - caller: caller, + caller: Caller, from: Address, to: Address, amount: U256, @@ -119,7 +119,7 @@ Ok(true) } #[weight(>::approve())] - fn approve(&mut self, caller: caller, spender: Address, amount: U256) -> Result { + fn approve(&mut self, caller: Caller, spender: Address, amount: U256) -> Result { let caller = T::CrossAccountId::from_eth(caller); let spender = T::CrossAccountId::from_eth(spender); let amount = amount.try_into().map_err(|_| "amount overflow")?; @@ -148,7 +148,7 @@ /// @param to account that will receive minted tokens /// @param amount amount of tokens to mint #[weight(>::create_item())] - fn mint(&mut self, caller: caller, to: Address, amount: U256) -> Result { + fn mint(&mut self, caller: Caller, to: Address, amount: U256) -> Result { let caller = T::CrossAccountId::from_eth(caller); let to = T::CrossAccountId::from_eth(to); let amount = amount.try_into().map_err(|_| "amount overflow")?; @@ -176,7 +176,7 @@ #[weight(>::create_item())] fn mint_cross( &mut self, - caller: caller, + caller: Caller, to: pallet_common::eth::CrossAddress, amount: U256, ) -> Result { @@ -194,7 +194,7 @@ #[weight(>::approve())] fn approve_cross( &mut self, - caller: caller, + caller: Caller, spender: pallet_common::eth::CrossAddress, amount: U256, ) -> Result { @@ -214,7 +214,7 @@ /// @param amount The amount that will be burnt. #[solidity(hide)] #[weight(>::burn_from())] - fn burn_from(&mut self, caller: caller, from: Address, amount: U256) -> Result { + fn burn_from(&mut self, caller: Caller, from: Address, amount: U256) -> Result { let caller = T::CrossAccountId::from_eth(caller); let from = T::CrossAccountId::from_eth(from); let amount = amount.try_into().map_err(|_| "amount overflow")?; @@ -235,7 +235,7 @@ #[weight(>::burn_from())] fn burn_from_cross( &mut self, - caller: caller, + caller: Caller, from: pallet_common::eth::CrossAddress, amount: U256, ) -> Result { @@ -254,7 +254,7 @@ /// Mint tokens for multiple accounts. /// @param amounts array of pairs of account address and amount #[weight(>::create_multiple_items_ex(amounts.len() as u32))] - fn mint_bulk(&mut self, caller: caller, amounts: Vec<(Address, U256)>) -> Result { + fn mint_bulk(&mut self, caller: Caller, amounts: Vec<(Address, U256)>) -> Result { let caller = T::CrossAccountId::from_eth(caller); let budget = self .recorder @@ -277,7 +277,7 @@ #[weight(>::transfer())] fn transfer_cross( &mut self, - caller: caller, + caller: Caller, to: pallet_common::eth::CrossAddress, amount: U256, ) -> Result { @@ -295,7 +295,7 @@ #[weight(>::transfer_from())] fn transfer_from_cross( &mut self, - caller: caller, + caller: Caller, from: pallet_common::eth::CrossAddress, to: pallet_common::eth::CrossAddress, amount: U256, --- a/pallets/nonfungible/src/erc.rs +++ b/pallets/nonfungible/src/erc.rs @@ -63,7 +63,7 @@ #[solidity(hide)] fn set_token_property_permission( &mut self, - caller: caller, + caller: Caller, key: String, is_mutable: bool, collection_admin: bool, @@ -93,7 +93,7 @@ #[weight(>::set_token_property_permissions(permissions.len() as u32))] fn set_token_property_permissions( &mut self, - caller: caller, + caller: Caller, permissions: Vec, ) -> Result<()> { let caller = T::CrossAccountId::from_eth(caller); @@ -121,7 +121,7 @@ #[weight(>::set_token_properties(1))] fn set_property( &mut self, - caller: caller, + caller: Caller, token_id: U256, key: String, value: Bytes, @@ -154,7 +154,7 @@ #[weight(>::set_token_properties(properties.len() as u32))] fn set_properties( &mut self, - caller: caller, + caller: Caller, token_id: U256, properties: Vec, ) -> Result<()> { @@ -187,7 +187,7 @@ /// @param key Property key. #[solidity(hide)] #[weight(>::delete_token_properties(1))] - fn delete_property(&mut self, token_id: U256, caller: caller, key: String) -> Result<()> { + fn delete_property(&mut self, token_id: U256, caller: Caller, key: String) -> Result<()> { let caller = T::CrossAccountId::from_eth(caller); let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?; let key = >::from(key) @@ -210,7 +210,7 @@ fn delete_properties( &mut self, token_id: U256, - caller: caller, + caller: Caller, keys: Vec, ) -> Result<()> { let caller = T::CrossAccountId::from_eth(caller); @@ -445,7 +445,7 @@ #[weight(>::transfer_from())] fn transfer_from( &mut self, - caller: caller, + caller: Caller, from: Address, to: Address, token_id: U256, @@ -470,7 +470,7 @@ /// @param approved The new approved NFT controller /// @param tokenId The NFT to approve #[weight(>::approve())] - fn approve(&mut self, caller: caller, approved: Address, token_id: U256) -> Result<()> { + fn approve(&mut self, caller: Caller, approved: Address, token_id: U256) -> Result<()> { let caller = T::CrossAccountId::from_eth(caller); let approved = T::CrossAccountId::from_eth(approved); let token = token_id.try_into()?; @@ -487,7 +487,7 @@ #[weight(>::set_allowance_for_all())] fn set_approval_for_all( &mut self, - caller: caller, + caller: Caller, operator: Address, approved: bool, ) -> Result<()> { @@ -523,7 +523,7 @@ /// operator of the current owner. /// @param tokenId The NFT to approve #[weight(>::burn_item())] - fn burn(&mut self, caller: caller, token_id: U256) -> Result<()> { + fn burn(&mut self, caller: Caller, token_id: U256) -> Result<()> { let caller = T::CrossAccountId::from_eth(caller); let token = token_id.try_into()?; @@ -539,7 +539,7 @@ /// @param to The new owner /// @return uint256 The id of the newly minted token #[weight(>::create_item())] - fn mint(&mut self, caller: caller, to: Address) -> Result { + fn mint(&mut self, caller: Caller, to: Address) -> Result { let token_id: U256 = >::get(self.id) .checked_add(1) .ok_or("item id overflow")? @@ -555,7 +555,7 @@ /// @param tokenId ID of the minted NFT #[solidity(hide, rename_selector = "mint")] #[weight(>::create_item())] - fn mint_check_id(&mut self, caller: caller, to: Address, token_id: U256) -> Result { + fn mint_check_id(&mut self, caller: Caller, to: Address, token_id: U256) -> Result { let caller = T::CrossAccountId::from_eth(caller); let to = T::CrossAccountId::from_eth(to); let token_id: u32 = token_id.try_into()?; @@ -593,7 +593,7 @@ #[weight(>::create_item())] fn mint_with_token_uri( &mut self, - caller: caller, + caller: Caller, to: Address, token_uri: String, ) -> Result { @@ -615,7 +615,7 @@ #[weight(>::create_item())] fn mint_with_token_uri_check_id( &mut self, - caller: caller, + caller: Caller, to: Address, token_id: U256, token_uri: String, @@ -765,7 +765,7 @@ #[weight(>::approve())] fn approve_cross( &mut self, - caller: caller, + caller: Caller, approved: eth::CrossAddress, token_id: U256, ) -> Result<()> { @@ -784,7 +784,7 @@ /// @param to The new owner /// @param tokenId The NFT to transfer #[weight(>::transfer())] - fn transfer(&mut self, caller: caller, to: Address, token_id: U256) -> Result<()> { + fn transfer(&mut self, caller: Caller, to: Address, token_id: U256) -> Result<()> { let caller = T::CrossAccountId::from_eth(caller); let to = T::CrossAccountId::from_eth(to); let token = token_id.try_into()?; @@ -804,7 +804,7 @@ #[weight(>::transfer())] fn transfer_cross( &mut self, - caller: caller, + caller: Caller, to: eth::CrossAddress, token_id: U256, ) -> Result<()> { @@ -828,7 +828,7 @@ #[weight(>::transfer())] fn transfer_from_cross( &mut self, - caller: caller, + caller: Caller, from: eth::CrossAddress, to: eth::CrossAddress, token_id: U256, @@ -853,7 +853,7 @@ /// @param tokenId The NFT to transfer #[solidity(hide)] #[weight(>::burn_from())] - fn burn_from(&mut self, caller: caller, from: Address, token_id: U256) -> Result<()> { + fn burn_from(&mut self, caller: Caller, from: Address, token_id: U256) -> Result<()> { let caller = T::CrossAccountId::from_eth(caller); let from = T::CrossAccountId::from_eth(from); let token = token_id.try_into()?; @@ -875,7 +875,7 @@ #[weight(>::burn_from())] fn burn_from_cross( &mut self, - caller: caller, + caller: Caller, from: eth::CrossAddress, token_id: U256, ) -> Result<()> { @@ -907,7 +907,7 @@ /// @param tokenIds IDs of the minted NFTs #[solidity(hide)] #[weight(>::create_multiple_items(token_ids.len() as u32))] - fn mint_bulk(&mut self, caller: caller, to: Address, token_ids: Vec) -> Result { + fn mint_bulk(&mut self, caller: Caller, to: Address, token_ids: Vec) -> Result { let caller = T::CrossAccountId::from_eth(caller); let to = T::CrossAccountId::from_eth(to); let mut expected_index = >::get(self.id) @@ -946,7 +946,7 @@ #[weight(>::create_multiple_items(tokens.len() as u32))] fn mint_bulk_with_token_uri( &mut self, - caller: caller, + caller: Caller, to: Address, tokens: Vec<(U256, String)>, ) -> Result { @@ -997,7 +997,7 @@ #[weight(>::create_item())] fn mint_cross( &mut self, - caller: caller, + caller: Caller, to: eth::CrossAddress, properties: Vec, ) -> Result { --- a/pallets/refungible/src/erc.rs +++ b/pallets/refungible/src/erc.rs @@ -66,7 +66,7 @@ #[solidity(hide)] fn set_token_property_permission( &mut self, - caller: caller, + caller: Caller, key: String, is_mutable: bool, collection_admin: bool, @@ -96,7 +96,7 @@ #[weight(>::set_token_property_permissions(permissions.len() as u32))] fn set_token_property_permissions( &mut self, - caller: caller, + caller: Caller, permissions: Vec, ) -> Result<()> { let caller = T::CrossAccountId::from_eth(caller); @@ -124,7 +124,7 @@ #[weight(>::set_token_properties(1))] fn set_property( &mut self, - caller: caller, + caller: Caller, token_id: U256, key: String, value: Bytes, @@ -157,7 +157,7 @@ #[weight(>::set_token_properties(properties.len() as u32))] fn set_properties( &mut self, - caller: caller, + caller: Caller, token_id: U256, properties: Vec, ) -> Result<()> { @@ -190,7 +190,7 @@ /// @param key Property key. #[solidity(hide)] #[weight(>::delete_token_properties(1))] - fn delete_property(&mut self, token_id: U256, caller: caller, key: String) -> Result<()> { + fn delete_property(&mut self, token_id: U256, caller: Caller, key: String) -> Result<()> { let caller = T::CrossAccountId::from_eth(caller); let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?; let key = >::from(key) @@ -213,7 +213,7 @@ fn delete_properties( &mut self, token_id: U256, - caller: caller, + caller: Caller, keys: Vec, ) -> Result<()> { let caller = T::CrossAccountId::from_eth(caller); @@ -449,7 +449,7 @@ #[weight(>::transfer_from_creating_removing())] fn transfer_from( &mut self, - caller: caller, + caller: Caller, from: Address, to: Address, token_id: U256, @@ -472,7 +472,7 @@ } /// @dev Not implemented - fn approve(&mut self, _caller: caller, _approved: Address, _token_id: U256) -> Result<()> { + fn approve(&mut self, _caller: Caller, _approved: Address, _token_id: U256) -> Result<()> { Err("not implemented".into()) } @@ -483,7 +483,7 @@ #[weight(>::set_allowance_for_all())] fn set_approval_for_all( &mut self, - caller: caller, + caller: Caller, operator: Address, approved: bool, ) -> Result<()> { @@ -551,7 +551,7 @@ /// operator of the current owner. /// @param tokenId The RFT to approve #[weight(>::burn_item_fully())] - fn burn(&mut self, caller: caller, token_id: U256) -> Result<()> { + fn burn(&mut self, caller: Caller, token_id: U256) -> Result<()> { let caller = T::CrossAccountId::from_eth(caller); let token = token_id.try_into()?; @@ -570,7 +570,7 @@ /// @param to The new owner /// @return uint256 The id of the newly minted token #[weight(>::create_item())] - fn mint(&mut self, caller: caller, to: Address) -> Result { + fn mint(&mut self, caller: Caller, to: Address) -> Result { let token_id: U256 = >::get(self.id) .checked_add(1) .ok_or("item id overflow")? @@ -586,7 +586,7 @@ /// @param tokenId ID of the minted RFT #[solidity(hide, rename_selector = "mint")] #[weight(>::create_item())] - fn mint_check_id(&mut self, caller: caller, to: Address, token_id: U256) -> Result { + fn mint_check_id(&mut self, caller: Caller, to: Address, token_id: U256) -> Result { let caller = T::CrossAccountId::from_eth(caller); let to = T::CrossAccountId::from_eth(to); let token_id: u32 = token_id.try_into()?; @@ -629,7 +629,7 @@ #[weight(>::create_item())] fn mint_with_token_uri( &mut self, - caller: caller, + caller: Caller, to: Address, token_uri: String, ) -> Result { @@ -651,7 +651,7 @@ #[weight(>::create_item())] fn mint_with_token_uri_check_id( &mut self, - caller: caller, + caller: Caller, to: Address, token_id: U256, token_uri: String, @@ -800,7 +800,7 @@ /// @param to The new owner /// @param tokenId The RFT to transfer #[weight(>::transfer_creating_removing())] - fn transfer(&mut self, caller: caller, to: Address, token_id: U256) -> Result<()> { + fn transfer(&mut self, caller: Caller, to: Address, token_id: U256) -> Result<()> { let caller = T::CrossAccountId::from_eth(caller); let to = T::CrossAccountId::from_eth(to); let token = token_id.try_into()?; @@ -825,7 +825,7 @@ #[weight(>::transfer_creating_removing())] fn transfer_cross( &mut self, - caller: caller, + caller: Caller, to: eth::CrossAddress, token_id: U256, ) -> Result<()> { @@ -853,7 +853,7 @@ #[weight(>::transfer_creating_removing())] fn transfer_from_cross( &mut self, - caller: caller, + caller: Caller, from: eth::CrossAddress, to: eth::CrossAddress, token_id: U256, @@ -883,7 +883,7 @@ /// @param tokenId The RFT to transfer #[solidity(hide)] #[weight(>::burn_from())] - fn burn_from(&mut self, caller: caller, from: Address, token_id: U256) -> Result<()> { + fn burn_from(&mut self, caller: Caller, from: Address, token_id: U256) -> Result<()> { let caller = T::CrossAccountId::from_eth(caller); let from = T::CrossAccountId::from_eth(from); let token = token_id.try_into()?; @@ -909,7 +909,7 @@ #[weight(>::burn_from())] fn burn_from_cross( &mut self, - caller: caller, + caller: Caller, from: eth::CrossAddress, token_id: U256, ) -> Result<()> { @@ -944,7 +944,7 @@ /// @param tokenIds IDs of the minted RFTs #[solidity(hide)] #[weight(>::create_multiple_items(token_ids.len() as u32))] - fn mint_bulk(&mut self, caller: caller, to: Address, token_ids: Vec) -> Result { + fn mint_bulk(&mut self, caller: Caller, to: Address, token_ids: Vec) -> Result { let caller = T::CrossAccountId::from_eth(caller); let to = T::CrossAccountId::from_eth(to); let mut expected_index = >::get(self.id) @@ -989,7 +989,7 @@ #[weight(>::create_multiple_items(tokens.len() as u32))] fn mint_bulk_with_token_uri( &mut self, - caller: caller, + caller: Caller, to: Address, tokens: Vec<(U256, String)>, ) -> Result { @@ -1046,7 +1046,7 @@ #[weight(>::create_item())] fn mint_cross( &mut self, - caller: caller, + caller: Caller, to: eth::CrossAddress, properties: Vec, ) -> Result { --- a/pallets/refungible/src/erc_token.rs +++ b/pallets/refungible/src/erc_token.rs @@ -129,7 +129,7 @@ /// @param to The address to transfer to. /// @param amount The amount to be transferred. #[weight(>::transfer())] - fn transfer(&mut self, caller: caller, to: Address, amount: U256) -> Result { + fn transfer(&mut self, caller: Caller, to: Address, amount: U256) -> Result { let caller = T::CrossAccountId::from_eth(caller); let to = T::CrossAccountId::from_eth(to); let amount = amount.try_into().map_err(|_| "amount overflow")?; @@ -149,7 +149,7 @@ #[weight(>::transfer_from())] fn transfer_from( &mut self, - caller: caller, + caller: Caller, from: Address, to: Address, amount: U256, @@ -175,7 +175,7 @@ /// @param spender The address which will spend the funds. /// @param amount The amount of tokens to be spent. #[weight(>::approve())] - fn approve(&mut self, caller: caller, spender: Address, amount: U256) -> Result { + fn approve(&mut self, caller: Caller, spender: Address, amount: U256) -> Result { let caller = T::CrossAccountId::from_eth(caller); let spender = T::CrossAccountId::from_eth(spender); let amount = amount.try_into().map_err(|_| "amount overflow")?; @@ -209,7 +209,7 @@ /// @param amount The amount that will be burnt. #[weight(>::burn_from())] #[solidity(hide)] - fn burn_from(&mut self, caller: caller, from: Address, amount: U256) -> Result { + fn burn_from(&mut self, caller: Caller, from: Address, amount: U256) -> Result { let caller = T::CrossAccountId::from_eth(caller); let from = T::CrossAccountId::from_eth(from); let amount = amount.try_into().map_err(|_| "amount overflow")?; @@ -229,7 +229,7 @@ #[weight(>::burn_from())] fn burn_from_cross( &mut self, - caller: caller, + caller: Caller, from: pallet_common::eth::CrossAddress, amount: U256, ) -> Result { @@ -255,7 +255,7 @@ #[weight(>::approve())] fn approve_cross( &mut self, - caller: caller, + caller: Caller, spender: pallet_common::eth::CrossAddress, amount: U256, ) -> Result { @@ -271,7 +271,7 @@ /// Throws if `msg.sender` doesn't owns all of the tokens. /// @param amount New total amount of the tokens. #[weight(>::repartition_item())] - fn repartition(&mut self, caller: caller, amount: U256) -> Result { + fn repartition(&mut self, caller: Caller, amount: U256) -> Result { let caller = T::CrossAccountId::from_eth(caller); let amount = amount.try_into().map_err(|_| "amount overflow")?; @@ -285,7 +285,7 @@ #[weight(>::transfer())] fn transfer_cross( &mut self, - caller: caller, + caller: Caller, to: pallet_common::eth::CrossAddress, amount: U256, ) -> Result { @@ -308,7 +308,7 @@ #[weight(>::transfer_from())] fn transfer_from_cross( &mut self, - caller: caller, + caller: Caller, from: pallet_common::eth::CrossAddress, to: pallet_common::eth::CrossAddress, amount: U256, --- a/pallets/unique/src/eth/mod.rs +++ b/pallets/unique/src/eth/mod.rs @@ -56,7 +56,7 @@ } fn convert_data( - caller: caller, + caller: Caller, name: String, description: String, token_prefix: String, @@ -87,7 +87,7 @@ #[inline(always)] fn create_collection_internal( - caller: caller, + caller: Caller, value: Value, name: String, collection_mode: CollectionMode, @@ -149,7 +149,7 @@ #[solidity(rename_selector = "createNFTCollection")] fn create_nft_collection( &mut self, - caller: caller, + caller: Caller, value: Value, name: String, description: String, @@ -188,7 +188,7 @@ #[solidity(hide)] fn create_nonfungible_collection( &mut self, - caller: caller, + caller: Caller, value: Value, name: String, description: String, @@ -208,7 +208,7 @@ #[solidity(rename_selector = "createRFTCollection")] fn create_rft_collection( &mut self, - caller: caller, + caller: Caller, value: Value, name: String, description: String, @@ -228,7 +228,7 @@ #[solidity(rename_selector = "createFTCollection")] fn create_fungible_collection( &mut self, - caller: caller, + caller: Caller, value: Value, name: String, decimals: u8, @@ -248,7 +248,7 @@ #[solidity(rename_selector = "makeCollectionERC721MetadataCompatible")] fn make_collection_metadata_compatible( &mut self, - caller: caller, + caller: Caller, collection: Address, base_uri: String, ) -> Result<()> { @@ -334,7 +334,7 @@ } #[weight(>::destroy_collection())] - fn destroy_collection(&mut self, caller: caller, collection_address: Address) -> Result<()> { + fn destroy_collection(&mut self, caller: Caller, collection_address: Address) -> Result<()> { let caller = T::CrossAccountId::from_eth(caller); let collection_id = pallet_common::eth::map_eth_to_id(&collection_address) @@ -346,7 +346,7 @@ /// Check if a collection exists /// @param collectionAddress Address of the collection in question /// @return bool Does the collection exist? - fn is_collection_exist(&self, _caller: caller, collection_address: Address) -> Result { + fn is_collection_exist(&self, _caller: Caller, collection_address: Address) -> Result { if let Some(id) = pallet_common::eth::map_eth_to_id(&collection_address) { let collection_id = id; return Ok(>::contains_key(collection_id)); -- gitstuff