difftreelog
refac: rename caller -> Caller
in: master
11 files changed
crates/evm-coder/procedural/src/solidity_interface.rsdiffbeforeafterboth354354355 fn is_caller(&self) -> bool {355 fn is_caller(&self) -> bool {356 if let Ok(ident) = self.plain() {356 if let Ok(ident) = self.plain() {357 return ident == "caller";357 return ident == "Caller";358 }358 }359 false359 false360 }360 }crates/evm-coder/src/lib.rsdiffbeforeafterboth147 /// Makes function payable147 /// Makes function payable148 pub type Value = U256;148 pub type Value = U256;149 /// Makes function caller-sensitive149 /// Makes function caller-sensitive150 pub type caller = Address;150 pub type Caller = Address;151 //#endregion151 //#endregion152152153 /// Ethereum typed call message, similar to solidity153 /// Ethereum typed call message, similar to soliditycrates/evm-coder/tests/random.rsdiffbeforeafterboth64 unreachable!()64 unreachable!()65 }65 }666667 fn caller_sensitive(&self, _caller: caller) -> Result<u8> {67 fn caller_sensitive(&self, _caller: Caller) -> Result<u8> {68 unreachable!()68 unreachable!()69 }69 }70 fn payable(&mut self, _value: Value) -> Result<u8> {70 fn payable(&mut self, _value: Value) -> Result<u8> {crates/evm-coder/tests/solidity_generation.rsdiffbeforeafterboth28 fn balance_of(&self, _owner: Address) -> Result<U256> {28 fn balance_of(&self, _owner: Address) -> Result<U256> {29 unreachable!()29 unreachable!()30 }30 }31 fn transfer(&mut self, _caller: caller, _to: Address, _value: U256) -> Result<bool> {31 fn transfer(&mut self, _caller: Caller, _to: Address, _value: U256) -> Result<bool> {32 unreachable!()32 unreachable!()33 }33 }34 fn transfer_from(34 fn transfer_from(35 &mut self,35 &mut self,36 _caller: caller,36 _caller: Caller,37 _from: Address,37 _from: Address,38 _to: Address,38 _to: Address,39 _value: U256,39 _value: U256,40 ) -> Result<bool> {40 ) -> Result<bool> {41 unreachable!()41 unreachable!()42 }42 }43 fn approve(&mut self, _caller: caller, _spender: Address, _value: U256) -> Result<bool> {43 fn approve(&mut self, _caller: Caller, _spender: Address, _value: U256) -> Result<bool> {44 unreachable!()44 unreachable!()45 }45 }46 fn allowance(&self, _owner: Address, _spender: Address) -> Result<U256> {46 fn allowance(&self, _owner: Address, _spender: Address) -> Result<U256> {pallets/common/src/erc.rsdiffbeforeafterboth94 /// @param value Propery value.94 /// @param value Propery value.95 #[solidity(hide)]95 #[solidity(hide)]96 #[weight(<SelfWeightOf<T>>::set_collection_properties(1))]96 #[weight(<SelfWeightOf<T>>::set_collection_properties(1))]97 fn set_collection_property(&mut self, caller: caller, key: String, value: Bytes) -> Result<()> {97 fn set_collection_property(&mut self, caller: Caller, key: String, value: Bytes) -> Result<()> {98 let caller = T::CrossAccountId::from_eth(caller);98 let caller = T::CrossAccountId::from_eth(caller);99 let key = <Vec<u8>>::from(key)99 let key = <Vec<u8>>::from(key)100 .try_into()100 .try_into()111 #[weight(<SelfWeightOf<T>>::set_collection_properties(properties.len() as u32))]111 #[weight(<SelfWeightOf<T>>::set_collection_properties(properties.len() as u32))]112 fn set_collection_properties(112 fn set_collection_properties(113 &mut self,113 &mut self,114 caller: caller,114 caller: Caller,115 properties: Vec<eth::Property>,115 properties: Vec<eth::Property>,116 ) -> Result<()> {116 ) -> Result<()> {117 let caller = T::CrossAccountId::from_eth(caller);117 let caller = T::CrossAccountId::from_eth(caller);130 /// @param key Property key.130 /// @param key Property key.131 #[solidity(hide)]131 #[solidity(hide)]132 #[weight(<SelfWeightOf<T>>::delete_collection_properties(1))]132 #[weight(<SelfWeightOf<T>>::delete_collection_properties(1))]133 fn delete_collection_property(&mut self, caller: caller, key: String) -> Result<()> {133 fn delete_collection_property(&mut self, caller: Caller, key: String) -> Result<()> {134 let caller = T::CrossAccountId::from_eth(caller);134 let caller = T::CrossAccountId::from_eth(caller);135 let key = <Vec<u8>>::from(key)135 let key = <Vec<u8>>::from(key)136 .try_into()136 .try_into()143 ///143 ///144 /// @param keys Properties keys.144 /// @param keys Properties keys.145 #[weight(<SelfWeightOf<T>>::delete_collection_properties(keys.len() as u32))]145 #[weight(<SelfWeightOf<T>>::delete_collection_properties(keys.len() as u32))]146 fn delete_collection_properties(&mut self, caller: caller, keys: Vec<String>) -> Result<()> {146 fn delete_collection_properties(&mut self, caller: Caller, keys: Vec<String>) -> Result<()> {147 let caller = T::CrossAccountId::from_eth(caller);147 let caller = T::CrossAccountId::from_eth(caller);148 let keys = keys148 let keys = keys149 .into_iter()149 .into_iter()208 ///208 ///209 /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.209 /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.210 #[solidity(hide)]210 #[solidity(hide)]211 fn set_collection_sponsor(&mut self, caller: caller, sponsor: Address) -> Result<()> {211 fn set_collection_sponsor(&mut self, caller: Caller, sponsor: Address) -> Result<()> {212 self.consume_store_reads_and_writes(1, 1)?;212 self.consume_store_reads_and_writes(1, 1)?;213213214 let caller = T::CrossAccountId::from_eth(caller);214 let caller = T::CrossAccountId::from_eth(caller);225 /// @param sponsor Cross account address of the sponsor from whose account funds will be debited for operations with the contract.225 /// @param sponsor Cross account address of the sponsor from whose account funds will be debited for operations with the contract.226 fn set_collection_sponsor_cross(226 fn set_collection_sponsor_cross(227 &mut self,227 &mut self,228 caller: caller,228 caller: Caller,229 sponsor: eth::CrossAddress,229 sponsor: eth::CrossAddress,230 ) -> Result<()> {230 ) -> Result<()> {231 self.consume_store_reads_and_writes(1, 1)?;231 self.consume_store_reads_and_writes(1, 1)?;248 /// Collection sponsorship confirmation.248 /// Collection sponsorship confirmation.249 ///249 ///250 /// @dev After setting the sponsor for the collection, it must be confirmed with this function.250 /// @dev After setting the sponsor for the collection, it must be confirmed with this function.251 fn confirm_collection_sponsorship(&mut self, caller: caller) -> Result<()> {251 fn confirm_collection_sponsorship(&mut self, caller: Caller) -> Result<()> {252 self.consume_store_writes(1)?;252 self.consume_store_writes(1)?;253253254 let caller = T::CrossAccountId::from_eth(caller);254 let caller = T::CrossAccountId::from_eth(caller);257 }257 }258258259 /// Remove collection sponsor.259 /// Remove collection sponsor.260 fn remove_collection_sponsor(&mut self, caller: caller) -> Result<()> {260 fn remove_collection_sponsor(&mut self, caller: Caller) -> Result<()> {261 self.consume_store_reads_and_writes(1, 1)?;261 self.consume_store_reads_and_writes(1, 1)?;262 let caller = T::CrossAccountId::from_eth(caller);262 let caller = T::CrossAccountId::from_eth(caller);263 self.remove_sponsor(&caller).map_err(dispatch_to_evm::<T>)263 self.remove_sponsor(&caller).map_err(dispatch_to_evm::<T>)339 /// @dev Throws error if limit not found.339 /// @dev Throws error if limit not found.340 /// @param limit Some limit.340 /// @param limit Some limit.341 #[solidity(rename_selector = "setCollectionLimit")]341 #[solidity(rename_selector = "setCollectionLimit")]342 fn set_collection_limit(&mut self, caller: caller, limit: eth::CollectionLimit) -> Result<()> {342 fn set_collection_limit(&mut self, caller: Caller, limit: eth::CollectionLimit) -> Result<()> {343 self.consume_store_reads_and_writes(1, 1)?;343 self.consume_store_reads_and_writes(1, 1)?;344344345 if !limit.has_value() {345 if !limit.has_value() {359 /// @param newAdmin Cross account administrator address.359 /// @param newAdmin Cross account administrator address.360 fn add_collection_admin_cross(360 fn add_collection_admin_cross(361 &mut self,361 &mut self,362 caller: caller,362 caller: Caller,363 new_admin: eth::CrossAddress,363 new_admin: eth::CrossAddress,364 ) -> Result<()> {364 ) -> Result<()> {365 self.consume_store_reads_and_writes(2, 2)?;365 self.consume_store_reads_and_writes(2, 2)?;374 /// @param admin Cross account administrator address.374 /// @param admin Cross account administrator address.375 fn remove_collection_admin_cross(375 fn remove_collection_admin_cross(376 &mut self,376 &mut self,377 caller: caller,377 caller: Caller,378 admin: eth::CrossAddress,378 admin: eth::CrossAddress,379 ) -> Result<()> {379 ) -> Result<()> {380 self.consume_store_reads_and_writes(2, 2)?;380 self.consume_store_reads_and_writes(2, 2)?;388 /// Add collection admin.388 /// Add collection admin.389 /// @param newAdmin Address of the added administrator.389 /// @param newAdmin Address of the added administrator.390 #[solidity(hide)]390 #[solidity(hide)]391 fn add_collection_admin(&mut self, caller: caller, new_admin: Address) -> Result<()> {391 fn add_collection_admin(&mut self, caller: Caller, new_admin: Address) -> Result<()> {392 self.consume_store_reads_and_writes(2, 2)?;392 self.consume_store_reads_and_writes(2, 2)?;393393394 let caller = T::CrossAccountId::from_eth(caller);394 let caller = T::CrossAccountId::from_eth(caller);401 ///401 ///402 /// @param admin Address of the removed administrator.402 /// @param admin Address of the removed administrator.403 #[solidity(hide)]403 #[solidity(hide)]404 fn remove_collection_admin(&mut self, caller: caller, admin: Address) -> Result<()> {404 fn remove_collection_admin(&mut self, caller: Caller, admin: Address) -> Result<()> {405 self.consume_store_reads_and_writes(2, 2)?;405 self.consume_store_reads_and_writes(2, 2)?;406406407 let caller = T::CrossAccountId::from_eth(caller);407 let caller = T::CrossAccountId::from_eth(caller);414 ///414 ///415 /// @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'415 /// @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'416 #[solidity(rename_selector = "setCollectionNesting")]416 #[solidity(rename_selector = "setCollectionNesting")]417 fn set_nesting_bool(&mut self, caller: caller, enable: bool) -> Result<()> {417 fn set_nesting_bool(&mut self, caller: Caller, enable: bool) -> Result<()> {418 self.consume_store_reads_and_writes(1, 1)?;418 self.consume_store_reads_and_writes(1, 1)?;419419420 let caller = T::CrossAccountId::from_eth(caller);420 let caller = T::CrossAccountId::from_eth(caller);435 #[solidity(rename_selector = "setCollectionNesting")]435 #[solidity(rename_selector = "setCollectionNesting")]436 fn set_nesting(436 fn set_nesting(437 &mut self,437 &mut self,438 caller: caller,438 caller: Caller,439 enable: bool,439 enable: bool,440 collections: Vec<Address>,440 collections: Vec<Address>,441 ) -> Result<()> {441 ) -> Result<()> {503 }503 }504 /// Set the collection access method.504 /// Set the collection access method.505 /// @param mode Access mode505 /// @param mode Access mode506 fn set_collection_access(&mut self, caller: caller, mode: eth::AccessMode) -> Result<()> {506 fn set_collection_access(&mut self, caller: Caller, mode: eth::AccessMode) -> Result<()> {507 self.consume_store_reads_and_writes(1, 1)?;507 self.consume_store_reads_and_writes(1, 1)?;508508509 let caller = T::CrossAccountId::from_eth(caller);509 let caller = T::CrossAccountId::from_eth(caller);526 ///526 ///527 /// @param user Address of a trusted user.527 /// @param user Address of a trusted user.528 #[solidity(hide)]528 #[solidity(hide)]529 fn add_to_collection_allow_list(&mut self, caller: caller, user: Address) -> Result<()> {529 fn add_to_collection_allow_list(&mut self, caller: Caller, user: Address) -> Result<()> {530 self.consume_store_writes(1)?;530 self.consume_store_writes(1)?;531531532 let caller = T::CrossAccountId::from_eth(caller);532 let caller = T::CrossAccountId::from_eth(caller);540 /// @param user User cross account address.540 /// @param user User cross account address.541 fn add_to_collection_allow_list_cross(541 fn add_to_collection_allow_list_cross(542 &mut self,542 &mut self,543 caller: caller,543 caller: Caller,544 user: eth::CrossAddress,544 user: eth::CrossAddress,545 ) -> Result<()> {545 ) -> Result<()> {546 self.consume_store_writes(1)?;546 self.consume_store_writes(1)?;555 ///555 ///556 /// @param user Address of a removed user.556 /// @param user Address of a removed user.557 #[solidity(hide)]557 #[solidity(hide)]558 fn remove_from_collection_allow_list(&mut self, caller: caller, user: Address) -> Result<()> {558 fn remove_from_collection_allow_list(&mut self, caller: Caller, user: Address) -> Result<()> {559 self.consume_store_writes(1)?;559 self.consume_store_writes(1)?;560560561 let caller = T::CrossAccountId::from_eth(caller);561 let caller = T::CrossAccountId::from_eth(caller);569 /// @param user User cross account address.569 /// @param user User cross account address.570 fn remove_from_collection_allow_list_cross(570 fn remove_from_collection_allow_list_cross(571 &mut self,571 &mut self,572 caller: caller,572 caller: Caller,573 user: eth::CrossAddress,573 user: eth::CrossAddress,574 ) -> Result<()> {574 ) -> Result<()> {575 self.consume_store_writes(1)?;575 self.consume_store_writes(1)?;583 /// Switch permission for minting.583 /// Switch permission for minting.584 ///584 ///585 /// @param mode Enable if "true".585 /// @param mode Enable if "true".586 fn set_collection_mint_mode(&mut self, caller: caller, mode: bool) -> Result<()> {586 fn set_collection_mint_mode(&mut self, caller: Caller, mode: bool) -> Result<()> {587 self.consume_store_reads_and_writes(1, 1)?;587 self.consume_store_reads_and_writes(1, 1)?;588588589 let caller = T::CrossAccountId::from_eth(caller);589 let caller = T::CrossAccountId::from_eth(caller);640 /// @dev Owner can be changed only by current owner640 /// @dev Owner can be changed only by current owner641 /// @param newOwner new owner account641 /// @param newOwner new owner account642 #[solidity(hide, rename_selector = "changeCollectionOwner")]642 #[solidity(hide, rename_selector = "changeCollectionOwner")]643 fn set_owner(&mut self, caller: caller, new_owner: Address) -> Result<()> {643 fn set_owner(&mut self, caller: Caller, new_owner: Address) -> Result<()> {644 self.consume_store_writes(1)?;644 self.consume_store_writes(1)?;645645646 let caller = T::CrossAccountId::from_eth(caller);646 let caller = T::CrossAccountId::from_eth(caller);666 /// @param newOwner new owner cross account666 /// @param newOwner new owner cross account667 fn change_collection_owner_cross(667 fn change_collection_owner_cross(668 &mut self,668 &mut self,669 caller: caller,669 caller: Caller,670 new_owner: eth::CrossAddress,670 new_owner: eth::CrossAddress,671 ) -> Result<()> {671 ) -> Result<()> {672 self.consume_store_writes(1)?;672 self.consume_store_writes(1)?;pallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth105 /// @param sponsor User address who set as pending sponsor.105 /// @param sponsor User address who set as pending sponsor.106 fn set_sponsor(106 fn set_sponsor(107 &mut self,107 &mut self,108 caller: caller,108 caller: Caller,109 contract_address: Address,109 contract_address: Address,110 sponsor: Address,110 sponsor: Address,111 ) -> Result<()> {111 ) -> Result<()> {125 /// Set contract as self sponsored.125 /// Set contract as self sponsored.126 ///126 ///127 /// @param contractAddress Contract for which a self sponsoring is being enabled.127 /// @param contractAddress Contract for which a self sponsoring is being enabled.128 fn self_sponsored_enable(&mut self, caller: caller, contract_address: Address) -> Result<()> {128 fn self_sponsored_enable(&mut self, caller: Caller, contract_address: Address) -> Result<()> {129 self.recorder().consume_sload()?;129 self.recorder().consume_sload()?;130 self.recorder().consume_sstore()?;130 self.recorder().consume_sstore()?;131131146 /// Remove sponsor.146 /// Remove sponsor.147 ///147 ///148 /// @param contractAddress Contract for which a sponsorship is being removed.148 /// @param contractAddress Contract for which a sponsorship is being removed.149 fn remove_sponsor(&mut self, caller: caller, contract_address: Address) -> Result<()> {149 fn remove_sponsor(&mut self, caller: Caller, contract_address: Address) -> Result<()> {150 self.recorder().consume_sload()?;150 self.recorder().consume_sload()?;151 self.recorder().consume_sstore()?;151 self.recorder().consume_sstore()?;152152161 /// @dev Caller must be same that set via [`setSponsor`].161 /// @dev Caller must be same that set via [`setSponsor`].162 ///162 ///163 /// @param contractAddress Сontract for which need to confirm sponsorship.163 /// @param contractAddress Сontract for which need to confirm sponsorship.164 fn confirm_sponsorship(&mut self, caller: caller, contract_address: Address) -> Result<()> {164 fn confirm_sponsorship(&mut self, caller: Caller, contract_address: Address) -> Result<()> {165 self.recorder().consume_sload()?;165 self.recorder().consume_sload()?;166 self.recorder().consume_sstore()?;166 self.recorder().consume_sstore()?;167167207207208 fn set_sponsoring_mode(208 fn set_sponsoring_mode(209 &mut self,209 &mut self,210 caller: caller,210 caller: Caller,211 contract_address: Address,211 contract_address: Address,212 mode: SponsoringModeT,212 mode: SponsoringModeT,213 ) -> Result<()> {213 ) -> Result<()> {239 /// @dev Only contract owner can change this setting239 /// @dev Only contract owner can change this setting240 fn set_sponsoring_rate_limit(240 fn set_sponsoring_rate_limit(241 &mut self,241 &mut self,242 caller: caller,242 caller: Caller,243 contract_address: Address,243 contract_address: Address,244 rate_limit: u32,244 rate_limit: u32,245 ) -> Result<()> {245 ) -> Result<()> {259 /// @dev Only contract owner can change this setting259 /// @dev Only contract owner can change this setting260 fn set_sponsoring_fee_limit(260 fn set_sponsoring_fee_limit(261 &mut self,261 &mut self,262 caller: caller,262 caller: Caller,263 contract_address: Address,263 contract_address: Address,264 fee_limit: U256,264 fee_limit: U256,265 ) -> Result<()> {265 ) -> Result<()> {300 /// @dev Only contract owner can change this setting300 /// @dev Only contract owner can change this setting301 fn toggle_allowed(301 fn toggle_allowed(302 &mut self,302 &mut self,303 caller: caller,303 caller: Caller,304 contract_address: Address,304 contract_address: Address,305 user: Address,305 user: Address,306 is_allowed: bool,306 is_allowed: bool,329 /// @param enabled Should allowlist access to be enabled?329 /// @param enabled Should allowlist access to be enabled?330 fn toggle_allowlist(330 fn toggle_allowlist(331 &mut self,331 &mut self,332 caller: caller,332 caller: Caller,333 contract_address: Address,333 contract_address: Address,334 enabled: bool,334 enabled: bool,335 ) -> Result<()> {335 ) -> Result<()> {pallets/fungible/src/erc.rsdiffbeforeafterboth86 Ok(balance.into())86 Ok(balance.into())87 }87 }88 #[weight(<SelfWeightOf<T>>::transfer())]88 #[weight(<SelfWeightOf<T>>::transfer())]89 fn transfer(&mut self, caller: caller, to: Address, amount: U256) -> Result<bool> {89 fn transfer(&mut self, caller: Caller, to: Address, amount: U256) -> Result<bool> {90 let caller = T::CrossAccountId::from_eth(caller);90 let caller = T::CrossAccountId::from_eth(caller);91 let to = T::CrossAccountId::from_eth(to);91 let to = T::CrossAccountId::from_eth(to);92 let amount = amount.try_into().map_err(|_| "amount overflow")?;92 let amount = amount.try_into().map_err(|_| "amount overflow")?;101 #[weight(<SelfWeightOf<T>>::transfer_from())]101 #[weight(<SelfWeightOf<T>>::transfer_from())]102 fn transfer_from(102 fn transfer_from(103 &mut self,103 &mut self,104 caller: caller,104 caller: Caller,105 from: Address,105 from: Address,106 to: Address,106 to: Address,107 amount: U256,107 amount: U256,119 Ok(true)119 Ok(true)120 }120 }121 #[weight(<SelfWeightOf<T>>::approve())]121 #[weight(<SelfWeightOf<T>>::approve())]122 fn approve(&mut self, caller: caller, spender: Address, amount: U256) -> Result<bool> {122 fn approve(&mut self, caller: Caller, spender: Address, amount: U256) -> Result<bool> {123 let caller = T::CrossAccountId::from_eth(caller);123 let caller = T::CrossAccountId::from_eth(caller);124 let spender = T::CrossAccountId::from_eth(spender);124 let spender = T::CrossAccountId::from_eth(spender);125 let amount = amount.try_into().map_err(|_| "amount overflow")?;125 let amount = amount.try_into().map_err(|_| "amount overflow")?;148 /// @param to account that will receive minted tokens148 /// @param to account that will receive minted tokens149 /// @param amount amount of tokens to mint149 /// @param amount amount of tokens to mint150 #[weight(<SelfWeightOf<T>>::create_item())]150 #[weight(<SelfWeightOf<T>>::create_item())]151 fn mint(&mut self, caller: caller, to: Address, amount: U256) -> Result<bool> {151 fn mint(&mut self, caller: Caller, to: Address, amount: U256) -> Result<bool> {152 let caller = T::CrossAccountId::from_eth(caller);152 let caller = T::CrossAccountId::from_eth(caller);153 let to = T::CrossAccountId::from_eth(to);153 let to = T::CrossAccountId::from_eth(to);154 let amount = amount.try_into().map_err(|_| "amount overflow")?;154 let amount = amount.try_into().map_err(|_| "amount overflow")?;176 #[weight(<SelfWeightOf<T>>::create_item())]176 #[weight(<SelfWeightOf<T>>::create_item())]177 fn mint_cross(177 fn mint_cross(178 &mut self,178 &mut self,179 caller: caller,179 caller: Caller,180 to: pallet_common::eth::CrossAddress,180 to: pallet_common::eth::CrossAddress,181 amount: U256,181 amount: U256,182 ) -> Result<bool> {182 ) -> Result<bool> {194 #[weight(<SelfWeightOf<T>>::approve())]194 #[weight(<SelfWeightOf<T>>::approve())]195 fn approve_cross(195 fn approve_cross(196 &mut self,196 &mut self,197 caller: caller,197 caller: Caller,198 spender: pallet_common::eth::CrossAddress,198 spender: pallet_common::eth::CrossAddress,199 amount: U256,199 amount: U256,200 ) -> Result<bool> {200 ) -> Result<bool> {214 /// @param amount The amount that will be burnt.214 /// @param amount The amount that will be burnt.215 #[solidity(hide)]215 #[solidity(hide)]216 #[weight(<SelfWeightOf<T>>::burn_from())]216 #[weight(<SelfWeightOf<T>>::burn_from())]217 fn burn_from(&mut self, caller: caller, from: Address, amount: U256) -> Result<bool> {217 fn burn_from(&mut self, caller: Caller, from: Address, amount: U256) -> Result<bool> {218 let caller = T::CrossAccountId::from_eth(caller);218 let caller = T::CrossAccountId::from_eth(caller);219 let from = T::CrossAccountId::from_eth(from);219 let from = T::CrossAccountId::from_eth(from);220 let amount = amount.try_into().map_err(|_| "amount overflow")?;220 let amount = amount.try_into().map_err(|_| "amount overflow")?;235 #[weight(<SelfWeightOf<T>>::burn_from())]235 #[weight(<SelfWeightOf<T>>::burn_from())]236 fn burn_from_cross(236 fn burn_from_cross(237 &mut self,237 &mut self,238 caller: caller,238 caller: Caller,239 from: pallet_common::eth::CrossAddress,239 from: pallet_common::eth::CrossAddress,240 amount: U256,240 amount: U256,241 ) -> Result<bool> {241 ) -> Result<bool> {254 /// Mint tokens for multiple accounts.254 /// Mint tokens for multiple accounts.255 /// @param amounts array of pairs of account address and amount255 /// @param amounts array of pairs of account address and amount256 #[weight(<SelfWeightOf<T>>::create_multiple_items_ex(amounts.len() as u32))]256 #[weight(<SelfWeightOf<T>>::create_multiple_items_ex(amounts.len() as u32))]257 fn mint_bulk(&mut self, caller: caller, amounts: Vec<(Address, U256)>) -> Result<bool> {257 fn mint_bulk(&mut self, caller: Caller, amounts: Vec<(Address, U256)>) -> Result<bool> {258 let caller = T::CrossAccountId::from_eth(caller);258 let caller = T::CrossAccountId::from_eth(caller);259 let budget = self259 let budget = self260 .recorder260 .recorder277 #[weight(<SelfWeightOf<T>>::transfer())]277 #[weight(<SelfWeightOf<T>>::transfer())]278 fn transfer_cross(278 fn transfer_cross(279 &mut self,279 &mut self,280 caller: caller,280 caller: Caller,281 to: pallet_common::eth::CrossAddress,281 to: pallet_common::eth::CrossAddress,282 amount: U256,282 amount: U256,283 ) -> Result<bool> {283 ) -> Result<bool> {295 #[weight(<SelfWeightOf<T>>::transfer_from())]295 #[weight(<SelfWeightOf<T>>::transfer_from())]296 fn transfer_from_cross(296 fn transfer_from_cross(297 &mut self,297 &mut self,298 caller: caller,298 caller: Caller,299 from: pallet_common::eth::CrossAddress,299 from: pallet_common::eth::CrossAddress,300 to: pallet_common::eth::CrossAddress,300 to: pallet_common::eth::CrossAddress,301 amount: U256,301 amount: U256,pallets/nonfungible/src/erc.rsdiffbeforeafterboth63 #[solidity(hide)]63 #[solidity(hide)]64 fn set_token_property_permission(64 fn set_token_property_permission(65 &mut self,65 &mut self,66 caller: caller,66 caller: Caller,67 key: String,67 key: String,68 is_mutable: bool,68 is_mutable: bool,69 collection_admin: bool,69 collection_admin: bool,93 #[weight(<SelfWeightOf<T>>::set_token_property_permissions(permissions.len() as u32))]93 #[weight(<SelfWeightOf<T>>::set_token_property_permissions(permissions.len() as u32))]94 fn set_token_property_permissions(94 fn set_token_property_permissions(95 &mut self,95 &mut self,96 caller: caller,96 caller: Caller,97 permissions: Vec<eth::TokenPropertyPermission>,97 permissions: Vec<eth::TokenPropertyPermission>,98 ) -> Result<()> {98 ) -> Result<()> {99 let caller = T::CrossAccountId::from_eth(caller);99 let caller = T::CrossAccountId::from_eth(caller);121 #[weight(<SelfWeightOf<T>>::set_token_properties(1))]121 #[weight(<SelfWeightOf<T>>::set_token_properties(1))]122 fn set_property(122 fn set_property(123 &mut self,123 &mut self,124 caller: caller,124 caller: Caller,125 token_id: U256,125 token_id: U256,126 key: String,126 key: String,127 value: Bytes,127 value: Bytes,154 #[weight(<SelfWeightOf<T>>::set_token_properties(properties.len() as u32))]154 #[weight(<SelfWeightOf<T>>::set_token_properties(properties.len() as u32))]155 fn set_properties(155 fn set_properties(156 &mut self,156 &mut self,157 caller: caller,157 caller: Caller,158 token_id: U256,158 token_id: U256,159 properties: Vec<eth::Property>,159 properties: Vec<eth::Property>,160 ) -> Result<()> {160 ) -> Result<()> {187 /// @param key Property key.187 /// @param key Property key.188 #[solidity(hide)]188 #[solidity(hide)]189 #[weight(<SelfWeightOf<T>>::delete_token_properties(1))]189 #[weight(<SelfWeightOf<T>>::delete_token_properties(1))]190 fn delete_property(&mut self, token_id: U256, caller: caller, key: String) -> Result<()> {190 fn delete_property(&mut self, token_id: U256, caller: Caller, key: String) -> Result<()> {191 let caller = T::CrossAccountId::from_eth(caller);191 let caller = T::CrossAccountId::from_eth(caller);192 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;192 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;193 let key = <Vec<u8>>::from(key)193 let key = <Vec<u8>>::from(key)210 fn delete_properties(210 fn delete_properties(211 &mut self,211 &mut self,212 token_id: U256,212 token_id: U256,213 caller: caller,213 caller: Caller,214 keys: Vec<String>,214 keys: Vec<String>,215 ) -> Result<()> {215 ) -> Result<()> {216 let caller = T::CrossAccountId::from_eth(caller);216 let caller = T::CrossAccountId::from_eth(caller);445 #[weight(<SelfWeightOf<T>>::transfer_from())]445 #[weight(<SelfWeightOf<T>>::transfer_from())]446 fn transfer_from(446 fn transfer_from(447 &mut self,447 &mut self,448 caller: caller,448 caller: Caller,449 from: Address,449 from: Address,450 to: Address,450 to: Address,451 token_id: U256,451 token_id: U256,470 /// @param approved The new approved NFT controller470 /// @param approved The new approved NFT controller471 /// @param tokenId The NFT to approve471 /// @param tokenId The NFT to approve472 #[weight(<SelfWeightOf<T>>::approve())]472 #[weight(<SelfWeightOf<T>>::approve())]473 fn approve(&mut self, caller: caller, approved: Address, token_id: U256) -> Result<()> {473 fn approve(&mut self, caller: Caller, approved: Address, token_id: U256) -> Result<()> {474 let caller = T::CrossAccountId::from_eth(caller);474 let caller = T::CrossAccountId::from_eth(caller);475 let approved = T::CrossAccountId::from_eth(approved);475 let approved = T::CrossAccountId::from_eth(approved);476 let token = token_id.try_into()?;476 let token = token_id.try_into()?;487 #[weight(<SelfWeightOf<T>>::set_allowance_for_all())]487 #[weight(<SelfWeightOf<T>>::set_allowance_for_all())]488 fn set_approval_for_all(488 fn set_approval_for_all(489 &mut self,489 &mut self,490 caller: caller,490 caller: Caller,491 operator: Address,491 operator: Address,492 approved: bool,492 approved: bool,493 ) -> Result<()> {493 ) -> Result<()> {523 /// operator of the current owner.523 /// operator of the current owner.524 /// @param tokenId The NFT to approve524 /// @param tokenId The NFT to approve525 #[weight(<SelfWeightOf<T>>::burn_item())]525 #[weight(<SelfWeightOf<T>>::burn_item())]526 fn burn(&mut self, caller: caller, token_id: U256) -> Result<()> {526 fn burn(&mut self, caller: Caller, token_id: U256) -> Result<()> {527 let caller = T::CrossAccountId::from_eth(caller);527 let caller = T::CrossAccountId::from_eth(caller);528 let token = token_id.try_into()?;528 let token = token_id.try_into()?;529529539 /// @param to The new owner539 /// @param to The new owner540 /// @return uint256 The id of the newly minted token540 /// @return uint256 The id of the newly minted token541 #[weight(<SelfWeightOf<T>>::create_item())]541 #[weight(<SelfWeightOf<T>>::create_item())]542 fn mint(&mut self, caller: caller, to: Address) -> Result<U256> {542 fn mint(&mut self, caller: Caller, to: Address) -> Result<U256> {543 let token_id: U256 = <TokensMinted<T>>::get(self.id)543 let token_id: U256 = <TokensMinted<T>>::get(self.id)544 .checked_add(1)544 .checked_add(1)545 .ok_or("item id overflow")?545 .ok_or("item id overflow")?555 /// @param tokenId ID of the minted NFT555 /// @param tokenId ID of the minted NFT556 #[solidity(hide, rename_selector = "mint")]556 #[solidity(hide, rename_selector = "mint")]557 #[weight(<SelfWeightOf<T>>::create_item())]557 #[weight(<SelfWeightOf<T>>::create_item())]558 fn mint_check_id(&mut self, caller: caller, to: Address, token_id: U256) -> Result<bool> {558 fn mint_check_id(&mut self, caller: Caller, to: Address, token_id: U256) -> Result<bool> {559 let caller = T::CrossAccountId::from_eth(caller);559 let caller = T::CrossAccountId::from_eth(caller);560 let to = T::CrossAccountId::from_eth(to);560 let to = T::CrossAccountId::from_eth(to);561 let token_id: u32 = token_id.try_into()?;561 let token_id: u32 = token_id.try_into()?;593 #[weight(<SelfWeightOf<T>>::create_item())]593 #[weight(<SelfWeightOf<T>>::create_item())]594 fn mint_with_token_uri(594 fn mint_with_token_uri(595 &mut self,595 &mut self,596 caller: caller,596 caller: Caller,597 to: Address,597 to: Address,598 token_uri: String,598 token_uri: String,599 ) -> Result<U256> {599 ) -> Result<U256> {615 #[weight(<SelfWeightOf<T>>::create_item())]615 #[weight(<SelfWeightOf<T>>::create_item())]616 fn mint_with_token_uri_check_id(616 fn mint_with_token_uri_check_id(617 &mut self,617 &mut self,618 caller: caller,618 caller: Caller,619 to: Address,619 to: Address,620 token_id: U256,620 token_id: U256,621 token_uri: String,621 token_uri: String,765 #[weight(<SelfWeightOf<T>>::approve())]765 #[weight(<SelfWeightOf<T>>::approve())]766 fn approve_cross(766 fn approve_cross(767 &mut self,767 &mut self,768 caller: caller,768 caller: Caller,769 approved: eth::CrossAddress,769 approved: eth::CrossAddress,770 token_id: U256,770 token_id: U256,771 ) -> Result<()> {771 ) -> Result<()> {784 /// @param to The new owner784 /// @param to The new owner785 /// @param tokenId The NFT to transfer785 /// @param tokenId The NFT to transfer786 #[weight(<SelfWeightOf<T>>::transfer())]786 #[weight(<SelfWeightOf<T>>::transfer())]787 fn transfer(&mut self, caller: caller, to: Address, token_id: U256) -> Result<()> {787 fn transfer(&mut self, caller: Caller, to: Address, token_id: U256) -> Result<()> {788 let caller = T::CrossAccountId::from_eth(caller);788 let caller = T::CrossAccountId::from_eth(caller);789 let to = T::CrossAccountId::from_eth(to);789 let to = T::CrossAccountId::from_eth(to);790 let token = token_id.try_into()?;790 let token = token_id.try_into()?;804 #[weight(<SelfWeightOf<T>>::transfer())]804 #[weight(<SelfWeightOf<T>>::transfer())]805 fn transfer_cross(805 fn transfer_cross(806 &mut self,806 &mut self,807 caller: caller,807 caller: Caller,808 to: eth::CrossAddress,808 to: eth::CrossAddress,809 token_id: U256,809 token_id: U256,810 ) -> Result<()> {810 ) -> Result<()> {828 #[weight(<SelfWeightOf<T>>::transfer())]828 #[weight(<SelfWeightOf<T>>::transfer())]829 fn transfer_from_cross(829 fn transfer_from_cross(830 &mut self,830 &mut self,831 caller: caller,831 caller: Caller,832 from: eth::CrossAddress,832 from: eth::CrossAddress,833 to: eth::CrossAddress,833 to: eth::CrossAddress,834 token_id: U256,834 token_id: U256,853 /// @param tokenId The NFT to transfer853 /// @param tokenId The NFT to transfer854 #[solidity(hide)]854 #[solidity(hide)]855 #[weight(<SelfWeightOf<T>>::burn_from())]855 #[weight(<SelfWeightOf<T>>::burn_from())]856 fn burn_from(&mut self, caller: caller, from: Address, token_id: U256) -> Result<()> {856 fn burn_from(&mut self, caller: Caller, from: Address, token_id: U256) -> Result<()> {857 let caller = T::CrossAccountId::from_eth(caller);857 let caller = T::CrossAccountId::from_eth(caller);858 let from = T::CrossAccountId::from_eth(from);858 let from = T::CrossAccountId::from_eth(from);859 let token = token_id.try_into()?;859 let token = token_id.try_into()?;875 #[weight(<SelfWeightOf<T>>::burn_from())]875 #[weight(<SelfWeightOf<T>>::burn_from())]876 fn burn_from_cross(876 fn burn_from_cross(877 &mut self,877 &mut self,878 caller: caller,878 caller: Caller,879 from: eth::CrossAddress,879 from: eth::CrossAddress,880 token_id: U256,880 token_id: U256,881 ) -> Result<()> {881 ) -> Result<()> {907 /// @param tokenIds IDs of the minted NFTs907 /// @param tokenIds IDs of the minted NFTs908 #[solidity(hide)]908 #[solidity(hide)]909 #[weight(<SelfWeightOf<T>>::create_multiple_items(token_ids.len() as u32))]909 #[weight(<SelfWeightOf<T>>::create_multiple_items(token_ids.len() as u32))]910 fn mint_bulk(&mut self, caller: caller, to: Address, token_ids: Vec<U256>) -> Result<bool> {910 fn mint_bulk(&mut self, caller: Caller, to: Address, token_ids: Vec<U256>) -> Result<bool> {911 let caller = T::CrossAccountId::from_eth(caller);911 let caller = T::CrossAccountId::from_eth(caller);912 let to = T::CrossAccountId::from_eth(to);912 let to = T::CrossAccountId::from_eth(to);913 let mut expected_index = <TokensMinted<T>>::get(self.id)913 let mut expected_index = <TokensMinted<T>>::get(self.id)946 #[weight(<SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32))]946 #[weight(<SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32))]947 fn mint_bulk_with_token_uri(947 fn mint_bulk_with_token_uri(948 &mut self,948 &mut self,949 caller: caller,949 caller: Caller,950 to: Address,950 to: Address,951 tokens: Vec<(U256, String)>,951 tokens: Vec<(U256, String)>,952 ) -> Result<bool> {952 ) -> Result<bool> {997 #[weight(<SelfWeightOf<T>>::create_item())]997 #[weight(<SelfWeightOf<T>>::create_item())]998 fn mint_cross(998 fn mint_cross(999 &mut self,999 &mut self,1000 caller: caller,1000 caller: Caller,1001 to: eth::CrossAddress,1001 to: eth::CrossAddress,1002 properties: Vec<eth::Property>,1002 properties: Vec<eth::Property>,1003 ) -> Result<U256> {1003 ) -> Result<U256> {pallets/refungible/src/erc.rsdiffbeforeafterboth66 #[solidity(hide)]66 #[solidity(hide)]67 fn set_token_property_permission(67 fn set_token_property_permission(68 &mut self,68 &mut self,69 caller: caller,69 caller: Caller,70 key: String,70 key: String,71 is_mutable: bool,71 is_mutable: bool,72 collection_admin: bool,72 collection_admin: bool,96 #[weight(<SelfWeightOf<T>>::set_token_property_permissions(permissions.len() as u32))]96 #[weight(<SelfWeightOf<T>>::set_token_property_permissions(permissions.len() as u32))]97 fn set_token_property_permissions(97 fn set_token_property_permissions(98 &mut self,98 &mut self,99 caller: caller,99 caller: Caller,100 permissions: Vec<eth::TokenPropertyPermission>,100 permissions: Vec<eth::TokenPropertyPermission>,101 ) -> Result<()> {101 ) -> Result<()> {102 let caller = T::CrossAccountId::from_eth(caller);102 let caller = T::CrossAccountId::from_eth(caller);124 #[weight(<SelfWeightOf<T>>::set_token_properties(1))]124 #[weight(<SelfWeightOf<T>>::set_token_properties(1))]125 fn set_property(125 fn set_property(126 &mut self,126 &mut self,127 caller: caller,127 caller: Caller,128 token_id: U256,128 token_id: U256,129 key: String,129 key: String,130 value: Bytes,130 value: Bytes,157 #[weight(<SelfWeightOf<T>>::set_token_properties(properties.len() as u32))]157 #[weight(<SelfWeightOf<T>>::set_token_properties(properties.len() as u32))]158 fn set_properties(158 fn set_properties(159 &mut self,159 &mut self,160 caller: caller,160 caller: Caller,161 token_id: U256,161 token_id: U256,162 properties: Vec<eth::Property>,162 properties: Vec<eth::Property>,163 ) -> Result<()> {163 ) -> Result<()> {190 /// @param key Property key.190 /// @param key Property key.191 #[solidity(hide)]191 #[solidity(hide)]192 #[weight(<SelfWeightOf<T>>::delete_token_properties(1))]192 #[weight(<SelfWeightOf<T>>::delete_token_properties(1))]193 fn delete_property(&mut self, token_id: U256, caller: caller, key: String) -> Result<()> {193 fn delete_property(&mut self, token_id: U256, caller: Caller, key: String) -> Result<()> {194 let caller = T::CrossAccountId::from_eth(caller);194 let caller = T::CrossAccountId::from_eth(caller);195 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;195 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;196 let key = <Vec<u8>>::from(key)196 let key = <Vec<u8>>::from(key)213 fn delete_properties(213 fn delete_properties(214 &mut self,214 &mut self,215 token_id: U256,215 token_id: U256,216 caller: caller,216 caller: Caller,217 keys: Vec<String>,217 keys: Vec<String>,218 ) -> Result<()> {218 ) -> Result<()> {219 let caller = T::CrossAccountId::from_eth(caller);219 let caller = T::CrossAccountId::from_eth(caller);449 #[weight(<SelfWeightOf<T>>::transfer_from_creating_removing())]449 #[weight(<SelfWeightOf<T>>::transfer_from_creating_removing())]450 fn transfer_from(450 fn transfer_from(451 &mut self,451 &mut self,452 caller: caller,452 caller: Caller,453 from: Address,453 from: Address,454 to: Address,454 to: Address,455 token_id: U256,455 token_id: U256,472 }472 }473473474 /// @dev Not implemented474 /// @dev Not implemented475 fn approve(&mut self, _caller: caller, _approved: Address, _token_id: U256) -> Result<()> {475 fn approve(&mut self, _caller: Caller, _approved: Address, _token_id: U256) -> Result<()> {476 Err("not implemented".into())476 Err("not implemented".into())477 }477 }478478483 #[weight(<SelfWeightOf<T>>::set_allowance_for_all())]483 #[weight(<SelfWeightOf<T>>::set_allowance_for_all())]484 fn set_approval_for_all(484 fn set_approval_for_all(485 &mut self,485 &mut self,486 caller: caller,486 caller: Caller,487 operator: Address,487 operator: Address,488 approved: bool,488 approved: bool,489 ) -> Result<()> {489 ) -> Result<()> {551 /// operator of the current owner.551 /// operator of the current owner.552 /// @param tokenId The RFT to approve552 /// @param tokenId The RFT to approve553 #[weight(<SelfWeightOf<T>>::burn_item_fully())]553 #[weight(<SelfWeightOf<T>>::burn_item_fully())]554 fn burn(&mut self, caller: caller, token_id: U256) -> Result<()> {554 fn burn(&mut self, caller: Caller, token_id: U256) -> Result<()> {555 let caller = T::CrossAccountId::from_eth(caller);555 let caller = T::CrossAccountId::from_eth(caller);556 let token = token_id.try_into()?;556 let token = token_id.try_into()?;557557570 /// @param to The new owner570 /// @param to The new owner571 /// @return uint256 The id of the newly minted token571 /// @return uint256 The id of the newly minted token572 #[weight(<SelfWeightOf<T>>::create_item())]572 #[weight(<SelfWeightOf<T>>::create_item())]573 fn mint(&mut self, caller: caller, to: Address) -> Result<U256> {573 fn mint(&mut self, caller: Caller, to: Address) -> Result<U256> {574 let token_id: U256 = <TokensMinted<T>>::get(self.id)574 let token_id: U256 = <TokensMinted<T>>::get(self.id)575 .checked_add(1)575 .checked_add(1)576 .ok_or("item id overflow")?576 .ok_or("item id overflow")?586 /// @param tokenId ID of the minted RFT586 /// @param tokenId ID of the minted RFT587 #[solidity(hide, rename_selector = "mint")]587 #[solidity(hide, rename_selector = "mint")]588 #[weight(<SelfWeightOf<T>>::create_item())]588 #[weight(<SelfWeightOf<T>>::create_item())]589 fn mint_check_id(&mut self, caller: caller, to: Address, token_id: U256) -> Result<bool> {589 fn mint_check_id(&mut self, caller: Caller, to: Address, token_id: U256) -> Result<bool> {590 let caller = T::CrossAccountId::from_eth(caller);590 let caller = T::CrossAccountId::from_eth(caller);591 let to = T::CrossAccountId::from_eth(to);591 let to = T::CrossAccountId::from_eth(to);592 let token_id: u32 = token_id.try_into()?;592 let token_id: u32 = token_id.try_into()?;629 #[weight(<SelfWeightOf<T>>::create_item())]629 #[weight(<SelfWeightOf<T>>::create_item())]630 fn mint_with_token_uri(630 fn mint_with_token_uri(631 &mut self,631 &mut self,632 caller: caller,632 caller: Caller,633 to: Address,633 to: Address,634 token_uri: String,634 token_uri: String,635 ) -> Result<U256> {635 ) -> Result<U256> {651 #[weight(<SelfWeightOf<T>>::create_item())]651 #[weight(<SelfWeightOf<T>>::create_item())]652 fn mint_with_token_uri_check_id(652 fn mint_with_token_uri_check_id(653 &mut self,653 &mut self,654 caller: caller,654 caller: Caller,655 to: Address,655 to: Address,656 token_id: U256,656 token_id: U256,657 token_uri: String,657 token_uri: String,800 /// @param to The new owner800 /// @param to The new owner801 /// @param tokenId The RFT to transfer801 /// @param tokenId The RFT to transfer802 #[weight(<SelfWeightOf<T>>::transfer_creating_removing())]802 #[weight(<SelfWeightOf<T>>::transfer_creating_removing())]803 fn transfer(&mut self, caller: caller, to: Address, token_id: U256) -> Result<()> {803 fn transfer(&mut self, caller: Caller, to: Address, token_id: U256) -> Result<()> {804 let caller = T::CrossAccountId::from_eth(caller);804 let caller = T::CrossAccountId::from_eth(caller);805 let to = T::CrossAccountId::from_eth(to);805 let to = T::CrossAccountId::from_eth(to);806 let token = token_id.try_into()?;806 let token = token_id.try_into()?;825 #[weight(<SelfWeightOf<T>>::transfer_creating_removing())]825 #[weight(<SelfWeightOf<T>>::transfer_creating_removing())]826 fn transfer_cross(826 fn transfer_cross(827 &mut self,827 &mut self,828 caller: caller,828 caller: Caller,829 to: eth::CrossAddress,829 to: eth::CrossAddress,830 token_id: U256,830 token_id: U256,831 ) -> Result<()> {831 ) -> Result<()> {853 #[weight(<SelfWeightOf<T>>::transfer_creating_removing())]853 #[weight(<SelfWeightOf<T>>::transfer_creating_removing())]854 fn transfer_from_cross(854 fn transfer_from_cross(855 &mut self,855 &mut self,856 caller: caller,856 caller: Caller,857 from: eth::CrossAddress,857 from: eth::CrossAddress,858 to: eth::CrossAddress,858 to: eth::CrossAddress,859 token_id: U256,859 token_id: U256,883 /// @param tokenId The RFT to transfer883 /// @param tokenId The RFT to transfer884 #[solidity(hide)]884 #[solidity(hide)]885 #[weight(<SelfWeightOf<T>>::burn_from())]885 #[weight(<SelfWeightOf<T>>::burn_from())]886 fn burn_from(&mut self, caller: caller, from: Address, token_id: U256) -> Result<()> {886 fn burn_from(&mut self, caller: Caller, from: Address, token_id: U256) -> Result<()> {887 let caller = T::CrossAccountId::from_eth(caller);887 let caller = T::CrossAccountId::from_eth(caller);888 let from = T::CrossAccountId::from_eth(from);888 let from = T::CrossAccountId::from_eth(from);889 let token = token_id.try_into()?;889 let token = token_id.try_into()?;909 #[weight(<SelfWeightOf<T>>::burn_from())]909 #[weight(<SelfWeightOf<T>>::burn_from())]910 fn burn_from_cross(910 fn burn_from_cross(911 &mut self,911 &mut self,912 caller: caller,912 caller: Caller,913 from: eth::CrossAddress,913 from: eth::CrossAddress,914 token_id: U256,914 token_id: U256,915 ) -> Result<()> {915 ) -> Result<()> {944 /// @param tokenIds IDs of the minted RFTs944 /// @param tokenIds IDs of the minted RFTs945 #[solidity(hide)]945 #[solidity(hide)]946 #[weight(<SelfWeightOf<T>>::create_multiple_items(token_ids.len() as u32))]946 #[weight(<SelfWeightOf<T>>::create_multiple_items(token_ids.len() as u32))]947 fn mint_bulk(&mut self, caller: caller, to: Address, token_ids: Vec<U256>) -> Result<bool> {947 fn mint_bulk(&mut self, caller: Caller, to: Address, token_ids: Vec<U256>) -> Result<bool> {948 let caller = T::CrossAccountId::from_eth(caller);948 let caller = T::CrossAccountId::from_eth(caller);949 let to = T::CrossAccountId::from_eth(to);949 let to = T::CrossAccountId::from_eth(to);950 let mut expected_index = <TokensMinted<T>>::get(self.id)950 let mut expected_index = <TokensMinted<T>>::get(self.id)989 #[weight(<SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32))]989 #[weight(<SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32))]990 fn mint_bulk_with_token_uri(990 fn mint_bulk_with_token_uri(991 &mut self,991 &mut self,992 caller: caller,992 caller: Caller,993 to: Address,993 to: Address,994 tokens: Vec<(U256, String)>,994 tokens: Vec<(U256, String)>,995 ) -> Result<bool> {995 ) -> Result<bool> {1046 #[weight(<SelfWeightOf<T>>::create_item())]1046 #[weight(<SelfWeightOf<T>>::create_item())]1047 fn mint_cross(1047 fn mint_cross(1048 &mut self,1048 &mut self,1049 caller: caller,1049 caller: Caller,1050 to: eth::CrossAddress,1050 to: eth::CrossAddress,1051 properties: Vec<eth::Property>,1051 properties: Vec<eth::Property>,1052 ) -> Result<U256> {1052 ) -> Result<U256> {pallets/refungible/src/erc_token.rsdiffbeforeafterboth129 /// @param to The address to transfer to.129 /// @param to The address to transfer to.130 /// @param amount The amount to be transferred.130 /// @param amount The amount to be transferred.131 #[weight(<CommonWeights<T>>::transfer())]131 #[weight(<CommonWeights<T>>::transfer())]132 fn transfer(&mut self, caller: caller, to: Address, amount: U256) -> Result<bool> {132 fn transfer(&mut self, caller: Caller, to: Address, amount: U256) -> Result<bool> {133 let caller = T::CrossAccountId::from_eth(caller);133 let caller = T::CrossAccountId::from_eth(caller);134 let to = T::CrossAccountId::from_eth(to);134 let to = T::CrossAccountId::from_eth(to);135 let amount = amount.try_into().map_err(|_| "amount overflow")?;135 let amount = amount.try_into().map_err(|_| "amount overflow")?;149 #[weight(<CommonWeights<T>>::transfer_from())]149 #[weight(<CommonWeights<T>>::transfer_from())]150 fn transfer_from(150 fn transfer_from(151 &mut self,151 &mut self,152 caller: caller,152 caller: Caller,153 from: Address,153 from: Address,154 to: Address,154 to: Address,155 amount: U256,155 amount: U256,175 /// @param spender The address which will spend the funds.175 /// @param spender The address which will spend the funds.176 /// @param amount The amount of tokens to be spent.176 /// @param amount The amount of tokens to be spent.177 #[weight(<SelfWeightOf<T>>::approve())]177 #[weight(<SelfWeightOf<T>>::approve())]178 fn approve(&mut self, caller: caller, spender: Address, amount: U256) -> Result<bool> {178 fn approve(&mut self, caller: Caller, spender: Address, amount: U256) -> Result<bool> {179 let caller = T::CrossAccountId::from_eth(caller);179 let caller = T::CrossAccountId::from_eth(caller);180 let spender = T::CrossAccountId::from_eth(spender);180 let spender = T::CrossAccountId::from_eth(spender);181 let amount = amount.try_into().map_err(|_| "amount overflow")?;181 let amount = amount.try_into().map_err(|_| "amount overflow")?;209 /// @param amount The amount that will be burnt.209 /// @param amount The amount that will be burnt.210 #[weight(<SelfWeightOf<T>>::burn_from())]210 #[weight(<SelfWeightOf<T>>::burn_from())]211 #[solidity(hide)]211 #[solidity(hide)]212 fn burn_from(&mut self, caller: caller, from: Address, amount: U256) -> Result<bool> {212 fn burn_from(&mut self, caller: Caller, from: Address, amount: U256) -> Result<bool> {213 let caller = T::CrossAccountId::from_eth(caller);213 let caller = T::CrossAccountId::from_eth(caller);214 let from = T::CrossAccountId::from_eth(from);214 let from = T::CrossAccountId::from_eth(from);215 let amount = amount.try_into().map_err(|_| "amount overflow")?;215 let amount = amount.try_into().map_err(|_| "amount overflow")?;229 #[weight(<SelfWeightOf<T>>::burn_from())]229 #[weight(<SelfWeightOf<T>>::burn_from())]230 fn burn_from_cross(230 fn burn_from_cross(231 &mut self,231 &mut self,232 caller: caller,232 caller: Caller,233 from: pallet_common::eth::CrossAddress,233 from: pallet_common::eth::CrossAddress,234 amount: U256,234 amount: U256,235 ) -> Result<bool> {235 ) -> Result<bool> {255 #[weight(<SelfWeightOf<T>>::approve())]255 #[weight(<SelfWeightOf<T>>::approve())]256 fn approve_cross(256 fn approve_cross(257 &mut self,257 &mut self,258 caller: caller,258 caller: Caller,259 spender: pallet_common::eth::CrossAddress,259 spender: pallet_common::eth::CrossAddress,260 amount: U256,260 amount: U256,261 ) -> Result<bool> {261 ) -> Result<bool> {271 /// Throws if `msg.sender` doesn't owns all of the tokens.271 /// Throws if `msg.sender` doesn't owns all of the tokens.272 /// @param amount New total amount of the tokens.272 /// @param amount New total amount of the tokens.273 #[weight(<SelfWeightOf<T>>::repartition_item())]273 #[weight(<SelfWeightOf<T>>::repartition_item())]274 fn repartition(&mut self, caller: caller, amount: U256) -> Result<bool> {274 fn repartition(&mut self, caller: Caller, amount: U256) -> Result<bool> {275 let caller = T::CrossAccountId::from_eth(caller);275 let caller = T::CrossAccountId::from_eth(caller);276 let amount = amount.try_into().map_err(|_| "amount overflow")?;276 let amount = amount.try_into().map_err(|_| "amount overflow")?;277277285 #[weight(<CommonWeights<T>>::transfer())]285 #[weight(<CommonWeights<T>>::transfer())]286 fn transfer_cross(286 fn transfer_cross(287 &mut self,287 &mut self,288 caller: caller,288 caller: Caller,289 to: pallet_common::eth::CrossAddress,289 to: pallet_common::eth::CrossAddress,290 amount: U256,290 amount: U256,291 ) -> Result<bool> {291 ) -> Result<bool> {308 #[weight(<CommonWeights<T>>::transfer_from())]308 #[weight(<CommonWeights<T>>::transfer_from())]309 fn transfer_from_cross(309 fn transfer_from_cross(310 &mut self,310 &mut self,311 caller: caller,311 caller: Caller,312 from: pallet_common::eth::CrossAddress,312 from: pallet_common::eth::CrossAddress,313 to: pallet_common::eth::CrossAddress,313 to: pallet_common::eth::CrossAddress,314 amount: U256,314 amount: U256,pallets/unique/src/eth/mod.rsdiffbeforeafterboth56}56}575758fn convert_data<T: Config>(58fn convert_data<T: Config>(59 caller: caller,59 caller: Caller,60 name: String,60 name: String,61 description: String,61 description: String,62 token_prefix: String,62 token_prefix: String,878788#[inline(always)]88#[inline(always)]89fn create_collection_internal<T: Config>(89fn create_collection_internal<T: Config>(90 caller: caller,90 caller: Caller,91 value: Value,91 value: Value,92 name: String,92 name: String,93 collection_mode: CollectionMode,93 collection_mode: CollectionMode,149 #[solidity(rename_selector = "createNFTCollection")]149 #[solidity(rename_selector = "createNFTCollection")]150 fn create_nft_collection(150 fn create_nft_collection(151 &mut self,151 &mut self,152 caller: caller,152 caller: Caller,153 value: Value,153 value: Value,154 name: String,154 name: String,155 description: String,155 description: String,188 #[solidity(hide)]188 #[solidity(hide)]189 fn create_nonfungible_collection(189 fn create_nonfungible_collection(190 &mut self,190 &mut self,191 caller: caller,191 caller: Caller,192 value: Value,192 value: Value,193 name: String,193 name: String,194 description: String,194 description: String,208 #[solidity(rename_selector = "createRFTCollection")]208 #[solidity(rename_selector = "createRFTCollection")]209 fn create_rft_collection(209 fn create_rft_collection(210 &mut self,210 &mut self,211 caller: caller,211 caller: Caller,212 value: Value,212 value: Value,213 name: String,213 name: String,214 description: String,214 description: String,228 #[solidity(rename_selector = "createFTCollection")]228 #[solidity(rename_selector = "createFTCollection")]229 fn create_fungible_collection(229 fn create_fungible_collection(230 &mut self,230 &mut self,231 caller: caller,231 caller: Caller,232 value: Value,232 value: Value,233 name: String,233 name: String,234 decimals: u8,234 decimals: u8,248 #[solidity(rename_selector = "makeCollectionERC721MetadataCompatible")]248 #[solidity(rename_selector = "makeCollectionERC721MetadataCompatible")]249 fn make_collection_metadata_compatible(249 fn make_collection_metadata_compatible(250 &mut self,250 &mut self,251 caller: caller,251 caller: Caller,252 collection: Address,252 collection: Address,253 base_uri: String,253 base_uri: String,254 ) -> Result<()> {254 ) -> Result<()> {334 }334 }335335336 #[weight(<SelfWeightOf<T>>::destroy_collection())]336 #[weight(<SelfWeightOf<T>>::destroy_collection())]337 fn destroy_collection(&mut self, caller: caller, collection_address: Address) -> Result<()> {337 fn destroy_collection(&mut self, caller: Caller, collection_address: Address) -> Result<()> {338 let caller = T::CrossAccountId::from_eth(caller);338 let caller = T::CrossAccountId::from_eth(caller);339339340 let collection_id = pallet_common::eth::map_eth_to_id(&collection_address)340 let collection_id = pallet_common::eth::map_eth_to_id(&collection_address)346 /// Check if a collection exists346 /// Check if a collection exists347 /// @param collectionAddress Address of the collection in question347 /// @param collectionAddress Address of the collection in question348 /// @return bool Does the collection exist?348 /// @return bool Does the collection exist?349 fn is_collection_exist(&self, _caller: caller, collection_address: Address) -> Result<bool> {349 fn is_collection_exist(&self, _caller: Caller, collection_address: Address) -> Result<bool> {350 if let Some(id) = pallet_common::eth::map_eth_to_id(&collection_address) {350 if let Some(id) = pallet_common::eth::map_eth_to_id(&collection_address) {351 let collection_id = id;351 let collection_id = id;352 return Ok(<CollectionById<T>>::contains_key(collection_id));352 return Ok(<CollectionById<T>>::contains_key(collection_id));