difftreelog
misk: remove simple type aliases
in: master
9 files changed
crates/evm-coder/src/events.rsdiffbeforeafterboth61 }61 }62}62}636364impl ToTopic for uint32 {64impl ToTopic for u32 {65 fn to_topic(&self) -> H256 {65 fn to_topic(&self) -> H256 {66 let mut out = [0u8; 32];66 let mut out = [0u8; 32];67 out[28..32].copy_from_slice(&self.to_be_bytes());67 out[28..32].copy_from_slice(&self.to_be_bytes());crates/evm-coder/src/lib.rsdiffbeforeafterboth132 use primitive_types::{U256, H160, H256};132 use primitive_types::{U256, H160, H256};133133134 pub type address = H160;134 pub type address = H160;135 pub type uint8 = u8;136 pub type uint16 = u16;137 pub type uint32 = u32;138 pub type uint64 = u64;139 pub type uint128 = u128;140 pub type uint256 = U256;135 pub type uint256 = U256;141 pub type bytes4 = [u8; 4];136 pub type bytes4 = [u8; 4];142 pub type topic = H256;137 pub type topic = H256;149 #[derive(Default, Debug, PartialEq, Eq, Clone)]144 #[derive(Default, Debug, PartialEq, Eq, Clone)]150 pub struct bytes(pub Vec<u8>);145 pub struct bytes(pub Vec<u8>);151152 /// Solidity doesn't have `void` type, however we have special implementation153 /// for empty tuple return type154 pub type void = ();155146156 //#region Special types147 //#region Special types157 /// Makes function payable148 /// Makes function payablepallets/common/src/erc.rsdiffbeforeafterboth93 /// @param value Propery value.93 /// @param value Propery value.94 #[solidity(hide)]94 #[solidity(hide)]95 #[weight(<SelfWeightOf<T>>::set_collection_properties(1))]95 #[weight(<SelfWeightOf<T>>::set_collection_properties(1))]96 fn set_collection_property(96 fn set_collection_property(&mut self, caller: caller, key: string, value: bytes) -> Result<()> {97 &mut self,98 caller: caller,99 key: string,100 value: bytes,101 ) -> Result<void> {102 let caller = T::CrossAccountId::from_eth(caller);97 let caller = T::CrossAccountId::from_eth(caller);103 let key = <Vec<u8>>::from(key)98 let key = <Vec<u8>>::from(key)104 .try_into()99 .try_into()117 &mut self,112 &mut self,118 caller: caller,113 caller: caller,119 properties: Vec<eth::Property>,114 properties: Vec<eth::Property>,120 ) -> Result<void> {115 ) -> Result<()> {121 let caller = T::CrossAccountId::from_eth(caller);116 let caller = T::CrossAccountId::from_eth(caller);122117123 let properties = properties118 let properties = properties212 ///207 ///213 /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.208 /// @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.214 #[solidity(hide)]209 #[solidity(hide)]215 fn set_collection_sponsor(&mut self, caller: caller, sponsor: address) -> Result<void> {210 fn set_collection_sponsor(&mut self, caller: caller, sponsor: address) -> Result<()> {216 self.consume_store_reads_and_writes(1, 1)?;211 self.consume_store_reads_and_writes(1, 1)?;217212218 let caller = T::CrossAccountId::from_eth(caller);213 let caller = T::CrossAccountId::from_eth(caller);231 &mut self,226 &mut self,232 caller: caller,227 caller: caller,233 sponsor: eth::CrossAddress,228 sponsor: eth::CrossAddress,234 ) -> Result<void> {229 ) -> Result<()> {235 self.consume_store_reads_and_writes(1, 1)?;230 self.consume_store_reads_and_writes(1, 1)?;236231237 let caller = T::CrossAccountId::from_eth(caller);232 let caller = T::CrossAccountId::from_eth(caller);252 /// Collection sponsorship confirmation.247 /// Collection sponsorship confirmation.253 ///248 ///254 /// @dev After setting the sponsor for the collection, it must be confirmed with this function.249 /// @dev After setting the sponsor for the collection, it must be confirmed with this function.255 fn confirm_collection_sponsorship(&mut self, caller: caller) -> Result<void> {250 fn confirm_collection_sponsorship(&mut self, caller: caller) -> Result<()> {256 self.consume_store_writes(1)?;251 self.consume_store_writes(1)?;257252258 let caller = T::CrossAccountId::from_eth(caller);253 let caller = T::CrossAccountId::from_eth(caller);261 }256 }262257263 /// Remove collection sponsor.258 /// Remove collection sponsor.264 fn remove_collection_sponsor(&mut self, caller: caller) -> Result<void> {259 fn remove_collection_sponsor(&mut self, caller: caller) -> Result<()> {265 self.consume_store_reads_and_writes(1, 1)?;260 self.consume_store_reads_and_writes(1, 1)?;266 let caller = T::CrossAccountId::from_eth(caller);261 let caller = T::CrossAccountId::from_eth(caller);267 self.remove_sponsor(&caller).map_err(dispatch_to_evm::<T>)262 self.remove_sponsor(&caller).map_err(dispatch_to_evm::<T>)343 /// @dev Throws error if limit not found.338 /// @dev Throws error if limit not found.344 /// @param limit Some limit.339 /// @param limit Some limit.345 #[solidity(rename_selector = "setCollectionLimit")]340 #[solidity(rename_selector = "setCollectionLimit")]346 fn set_collection_limit(341 fn set_collection_limit(&mut self, caller: caller, limit: eth::CollectionLimit) -> Result<()> {347 &mut self,348 caller: caller,349 limit: eth::CollectionLimit,350 ) -> Result<void> {351 self.consume_store_reads_and_writes(1, 1)?;342 self.consume_store_reads_and_writes(1, 1)?;352343353 if !limit.has_value() {344 if !limit.has_value() {369 &mut self,360 &mut self,370 caller: caller,361 caller: caller,371 new_admin: eth::CrossAddress,362 new_admin: eth::CrossAddress,372 ) -> Result<void> {363 ) -> Result<()> {373 self.consume_store_reads_and_writes(2, 2)?;364 self.consume_store_reads_and_writes(2, 2)?;374365375 let caller = T::CrossAccountId::from_eth(caller);366 let caller = T::CrossAccountId::from_eth(caller);384 &mut self,375 &mut self,385 caller: caller,376 caller: caller,386 admin: eth::CrossAddress,377 admin: eth::CrossAddress,387 ) -> Result<void> {378 ) -> Result<()> {388 self.consume_store_reads_and_writes(2, 2)?;379 self.consume_store_reads_and_writes(2, 2)?;389380390 let caller = T::CrossAccountId::from_eth(caller);381 let caller = T::CrossAccountId::from_eth(caller);396 /// Add collection admin.387 /// Add collection admin.397 /// @param newAdmin Address of the added administrator.388 /// @param newAdmin Address of the added administrator.398 #[solidity(hide)]389 #[solidity(hide)]399 fn add_collection_admin(&mut self, caller: caller, new_admin: address) -> Result<void> {390 fn add_collection_admin(&mut self, caller: caller, new_admin: address) -> Result<()> {400 self.consume_store_reads_and_writes(2, 2)?;391 self.consume_store_reads_and_writes(2, 2)?;401392402 let caller = T::CrossAccountId::from_eth(caller);393 let caller = T::CrossAccountId::from_eth(caller);409 ///400 ///410 /// @param admin Address of the removed administrator.401 /// @param admin Address of the removed administrator.411 #[solidity(hide)]402 #[solidity(hide)]412 fn remove_collection_admin(&mut self, caller: caller, admin: address) -> Result<void> {403 fn remove_collection_admin(&mut self, caller: caller, admin: address) -> Result<()> {413 self.consume_store_reads_and_writes(2, 2)?;404 self.consume_store_reads_and_writes(2, 2)?;414405415 let caller = T::CrossAccountId::from_eth(caller);406 let caller = T::CrossAccountId::from_eth(caller);422 ///413 ///423 /// @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'414 /// @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'424 #[solidity(rename_selector = "setCollectionNesting")]415 #[solidity(rename_selector = "setCollectionNesting")]425 fn set_nesting_bool(&mut self, caller: caller, enable: bool) -> Result<void> {416 fn set_nesting_bool(&mut self, caller: caller, enable: bool) -> Result<()> {426 self.consume_store_reads_and_writes(1, 1)?;417 self.consume_store_reads_and_writes(1, 1)?;427418428 let caller = T::CrossAccountId::from_eth(caller);419 let caller = T::CrossAccountId::from_eth(caller);446 caller: caller,437 caller: caller,447 enable: bool,438 enable: bool,448 collections: Vec<address>,439 collections: Vec<address>,449 ) -> Result<void> {440 ) -> Result<()> {450 self.consume_store_reads_and_writes(1, 1)?;441 self.consume_store_reads_and_writes(1, 1)?;451442452 if collections.is_empty() {443 if collections.is_empty() {513 /// @param mode Access mode504 /// @param mode Access mode514 /// 0 for Normal505 /// 0 for Normal515 /// 1 for AllowList506 /// 1 for AllowList516 fn set_collection_access(&mut self, caller: caller, mode: uint8) -> Result<void> {507 fn set_collection_access(&mut self, caller: caller, mode: u8) -> Result<()> {517 self.consume_store_reads_and_writes(1, 1)?;508 self.consume_store_reads_and_writes(1, 1)?;518509519 let caller = T::CrossAccountId::from_eth(caller);510 let caller = T::CrossAccountId::from_eth(caller);540 ///531 ///541 /// @param user Address of a trusted user.532 /// @param user Address of a trusted user.542 #[solidity(hide)]533 #[solidity(hide)]543 fn add_to_collection_allow_list(&mut self, caller: caller, user: address) -> Result<void> {534 fn add_to_collection_allow_list(&mut self, caller: caller, user: address) -> Result<()> {544 self.consume_store_writes(1)?;535 self.consume_store_writes(1)?;545536546 let caller = T::CrossAccountId::from_eth(caller);537 let caller = T::CrossAccountId::from_eth(caller);556 &mut self,547 &mut self,557 caller: caller,548 caller: caller,558 user: eth::CrossAddress,549 user: eth::CrossAddress,559 ) -> Result<void> {550 ) -> Result<()> {560 self.consume_store_writes(1)?;551 self.consume_store_writes(1)?;561552562 let caller = T::CrossAccountId::from_eth(caller);553 let caller = T::CrossAccountId::from_eth(caller);569 ///560 ///570 /// @param user Address of a removed user.561 /// @param user Address of a removed user.571 #[solidity(hide)]562 #[solidity(hide)]572 fn remove_from_collection_allow_list(&mut self, caller: caller, user: address) -> Result<void> {563 fn remove_from_collection_allow_list(&mut self, caller: caller, user: address) -> Result<()> {573 self.consume_store_writes(1)?;564 self.consume_store_writes(1)?;574565575 let caller = T::CrossAccountId::from_eth(caller);566 let caller = T::CrossAccountId::from_eth(caller);585 &mut self,576 &mut self,586 caller: caller,577 caller: caller,587 user: eth::CrossAddress,578 user: eth::CrossAddress,588 ) -> Result<void> {579 ) -> Result<()> {589 self.consume_store_writes(1)?;580 self.consume_store_writes(1)?;590581591 let caller = T::CrossAccountId::from_eth(caller);582 let caller = T::CrossAccountId::from_eth(caller);597 /// Switch permission for minting.588 /// Switch permission for minting.598 ///589 ///599 /// @param mode Enable if "true".590 /// @param mode Enable if "true".600 fn set_collection_mint_mode(&mut self, caller: caller, mode: bool) -> Result<void> {591 fn set_collection_mint_mode(&mut self, caller: caller, mode: bool) -> Result<()> {601 self.consume_store_reads_and_writes(1, 1)?;592 self.consume_store_reads_and_writes(1, 1)?;602593603 let caller = T::CrossAccountId::from_eth(caller);594 let caller = T::CrossAccountId::from_eth(caller);654 /// @dev Owner can be changed only by current owner645 /// @dev Owner can be changed only by current owner655 /// @param newOwner new owner account646 /// @param newOwner new owner account656 #[solidity(hide, rename_selector = "changeCollectionOwner")]647 #[solidity(hide, rename_selector = "changeCollectionOwner")]657 fn set_owner(&mut self, caller: caller, new_owner: address) -> Result<void> {648 fn set_owner(&mut self, caller: caller, new_owner: address) -> Result<()> {658 self.consume_store_writes(1)?;649 self.consume_store_writes(1)?;659650660 let caller = T::CrossAccountId::from_eth(caller);651 let caller = T::CrossAccountId::from_eth(caller);682 &mut self,673 &mut self,683 caller: caller,674 caller: caller,684 new_owner: eth::CrossAddress,675 new_owner: eth::CrossAddress,685 ) -> Result<void> {676 ) -> Result<()> {686 self.consume_store_writes(1)?;677 self.consume_store_writes(1)?;687678688 let caller = T::CrossAccountId::from_eth(caller);679 let caller = T::CrossAccountId::from_eth(caller);pallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth108 caller: caller,108 caller: caller,109 contract_address: address,109 contract_address: address,110 sponsor: address,110 sponsor: address,111 ) -> Result<void> {111 ) -> Result<()> {112 self.recorder().consume_sload()?;112 self.recorder().consume_sload()?;113 self.recorder().consume_sstore()?;113 self.recorder().consume_sstore()?;114114125 /// 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<void> {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<void> {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<void> {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()?;167167210 caller: caller,210 caller: caller,211 contract_address: address,211 contract_address: address,212 mode: SponsoringModeT,212 mode: SponsoringModeT,213 ) -> Result<void> {213 ) -> Result<()> {214 self.recorder().consume_sload()?;214 self.recorder().consume_sload()?;215 self.recorder().consume_sstore()?;215 self.recorder().consume_sstore()?;216216223 /// Get current contract sponsoring rate limit223 /// Get current contract sponsoring rate limit224 /// @param contractAddress Contract to get sponsoring rate limit of224 /// @param contractAddress Contract to get sponsoring rate limit of225 /// @return uint32 Amount of blocks between two sponsored transactions225 /// @return uint32 Amount of blocks between two sponsored transactions226 fn sponsoring_rate_limit(&self, contract_address: address) -> Result<uint32> {226 fn sponsoring_rate_limit(&self, contract_address: address) -> Result<u32> {227 self.recorder().consume_sload()?;227 self.recorder().consume_sload()?;228228229 Ok(<SponsoringRateLimit<T>>::get(contract_address)229 Ok(<SponsoringRateLimit<T>>::get(contract_address)241 &mut self,241 &mut self,242 caller: caller,242 caller: caller,243 contract_address: address,243 contract_address: address,244 rate_limit: uint32,244 rate_limit: u32,245 ) -> Result<void> {245 ) -> Result<()> {246 self.recorder().consume_sload()?;246 self.recorder().consume_sload()?;247 self.recorder().consume_sstore()?;247 self.recorder().consume_sstore()?;248248262 caller: caller,262 caller: caller,263 contract_address: address,263 contract_address: address,264 fee_limit: uint256,264 fee_limit: uint256,265 ) -> Result<void> {265 ) -> Result<()> {266 self.recorder().consume_sload()?;266 self.recorder().consume_sload()?;267 self.recorder().consume_sstore()?;267 self.recorder().consume_sstore()?;268268304 contract_address: address,304 contract_address: address,305 user: address,305 user: address,306 is_allowed: bool,306 is_allowed: bool,307 ) -> Result<void> {307 ) -> Result<()> {308 self.recorder().consume_sload()?;308 self.recorder().consume_sload()?;309 self.recorder().consume_sstore()?;309 self.recorder().consume_sstore()?;310310332 caller: caller,332 caller: caller,333 contract_address: address,333 contract_address: address,334 enabled: bool,334 enabled: bool,335 ) -> Result<void> {335 ) -> Result<()> {336 self.recorder().consume_sload()?;336 self.recorder().consume_sload()?;337 self.recorder().consume_sstore()?;337 self.recorder().consume_sstore()?;338338pallets/fungible/src/erc.rsdiffbeforeafterboth72 Ok(<TotalSupply<T>>::get(self.id).into())72 Ok(<TotalSupply<T>>::get(self.id).into())73 }73 }747475 fn decimals(&self) -> Result<uint8> {75 fn decimals(&self) -> Result<u8> {76 Ok(if let CollectionMode::Fungible(decimals) = &self.mode {76 Ok(if let CollectionMode::Fungible(decimals) = &self.mode {77 *decimals77 *decimals78 } else {78 } else {pallets/nonfungible/src/erc.rsdiffbeforeafterboth423 _to: address,423 _to: address,424 _token_id: uint256,424 _token_id: uint256,425 _data: bytes,425 _data: bytes,426 ) -> Result<void> {426 ) -> Result<()> {427 // TODO: Not implemetable427 // TODO: Not implemetable428 Err("not implemented".into())428 Err("not implemented".into())429 }429 }433 _from: address,433 _from: address,434 _to: address,434 _to: address,435 _token_id: uint256,435 _token_id: uint256,436 ) -> Result<void> {436 ) -> Result<()> {437 // TODO: Not implemetable437 // TODO: Not implemetable438 Err("not implemented".into())438 Err("not implemented".into())439 }439 }454 from: address,454 from: address,455 to: address,455 to: address,456 token_id: uint256,456 token_id: uint256,457 ) -> Result<void> {457 ) -> Result<()> {458 let caller = T::CrossAccountId::from_eth(caller);458 let caller = T::CrossAccountId::from_eth(caller);459 let from = T::CrossAccountId::from_eth(from);459 let from = T::CrossAccountId::from_eth(from);460 let to = T::CrossAccountId::from_eth(to);460 let to = T::CrossAccountId::from_eth(to);475 /// @param approved The new approved NFT controller475 /// @param approved The new approved NFT controller476 /// @param tokenId The NFT to approve476 /// @param tokenId The NFT to approve477 #[weight(<SelfWeightOf<T>>::approve())]477 #[weight(<SelfWeightOf<T>>::approve())]478 fn approve(&mut self, caller: caller, approved: address, token_id: uint256) -> Result<void> {478 fn approve(&mut self, caller: caller, approved: address, token_id: uint256) -> Result<()> {479 let caller = T::CrossAccountId::from_eth(caller);479 let caller = T::CrossAccountId::from_eth(caller);480 let approved = T::CrossAccountId::from_eth(approved);480 let approved = T::CrossAccountId::from_eth(approved);481 let token = token_id.try_into()?;481 let token = token_id.try_into()?;495 caller: caller,495 caller: caller,496 operator: address,496 operator: address,497 approved: bool,497 approved: bool,498 ) -> Result<void> {498 ) -> Result<()> {499 let caller = T::CrossAccountId::from_eth(caller);499 let caller = T::CrossAccountId::from_eth(caller);500 let operator = T::CrossAccountId::from_eth(operator);500 let operator = T::CrossAccountId::from_eth(operator);501501528 /// operator of the current owner.528 /// operator of the current owner.529 /// @param tokenId The NFT to approve529 /// @param tokenId The NFT to approve530 #[weight(<SelfWeightOf<T>>::burn_item())]530 #[weight(<SelfWeightOf<T>>::burn_item())]531 fn burn(&mut self, caller: caller, token_id: uint256) -> Result<void> {531 fn burn(&mut self, caller: caller, token_id: uint256) -> Result<()> {532 let caller = T::CrossAccountId::from_eth(caller);532 let caller = T::CrossAccountId::from_eth(caller);533 let token = token_id.try_into()?;533 let token = token_id.try_into()?;534534773 caller: caller,773 caller: caller,774 approved: eth::CrossAddress,774 approved: eth::CrossAddress,775 token_id: uint256,775 token_id: uint256,776 ) -> Result<void> {776 ) -> Result<()> {777 let caller = T::CrossAccountId::from_eth(caller);777 let caller = T::CrossAccountId::from_eth(caller);778 let approved = approved.into_sub_cross_account::<T>()?;778 let approved = approved.into_sub_cross_account::<T>()?;779 let token = token_id.try_into()?;779 let token = token_id.try_into()?;789 /// @param to The new owner789 /// @param to The new owner790 /// @param tokenId The NFT to transfer790 /// @param tokenId The NFT to transfer791 #[weight(<SelfWeightOf<T>>::transfer())]791 #[weight(<SelfWeightOf<T>>::transfer())]792 fn transfer(&mut self, caller: caller, to: address, token_id: uint256) -> Result<void> {792 fn transfer(&mut self, caller: caller, to: address, token_id: uint256) -> Result<()> {793 let caller = T::CrossAccountId::from_eth(caller);793 let caller = T::CrossAccountId::from_eth(caller);794 let to = T::CrossAccountId::from_eth(to);794 let to = T::CrossAccountId::from_eth(to);795 let token = token_id.try_into()?;795 let token = token_id.try_into()?;812 caller: caller,812 caller: caller,813 to: eth::CrossAddress,813 to: eth::CrossAddress,814 token_id: uint256,814 token_id: uint256,815 ) -> Result<void> {815 ) -> Result<()> {816 let caller = T::CrossAccountId::from_eth(caller);816 let caller = T::CrossAccountId::from_eth(caller);817 let to = to.into_sub_cross_account::<T>()?;817 let to = to.into_sub_cross_account::<T>()?;818 let token = token_id.try_into()?;818 let token = token_id.try_into()?;837 from: eth::CrossAddress,837 from: eth::CrossAddress,838 to: eth::CrossAddress,838 to: eth::CrossAddress,839 token_id: uint256,839 token_id: uint256,840 ) -> Result<void> {840 ) -> Result<()> {841 let caller = T::CrossAccountId::from_eth(caller);841 let caller = T::CrossAccountId::from_eth(caller);842 let from = from.into_sub_cross_account::<T>()?;842 let from = from.into_sub_cross_account::<T>()?;843 let to = to.into_sub_cross_account::<T>()?;843 let to = to.into_sub_cross_account::<T>()?;858 /// @param tokenId The NFT to transfer858 /// @param tokenId The NFT to transfer859 #[solidity(hide)]859 #[solidity(hide)]860 #[weight(<SelfWeightOf<T>>::burn_from())]860 #[weight(<SelfWeightOf<T>>::burn_from())]861 fn burn_from(&mut self, caller: caller, from: address, token_id: uint256) -> Result<void> {861 fn burn_from(&mut self, caller: caller, from: address, token_id: uint256) -> Result<()> {862 let caller = T::CrossAccountId::from_eth(caller);862 let caller = T::CrossAccountId::from_eth(caller);863 let from = T::CrossAccountId::from_eth(from);863 let from = T::CrossAccountId::from_eth(from);864 let token = token_id.try_into()?;864 let token = token_id.try_into()?;883 caller: caller,883 caller: caller,884 from: eth::CrossAddress,884 from: eth::CrossAddress,885 token_id: uint256,885 token_id: uint256,886 ) -> Result<void> {886 ) -> Result<()> {887 let caller = T::CrossAccountId::from_eth(caller);887 let caller = T::CrossAccountId::from_eth(caller);888 let from = from.into_sub_cross_account::<T>()?;888 let from = from.into_sub_cross_account::<T>()?;889 let token = token_id.try_into()?;889 let token = token_id.try_into()?;pallets/refungible/src/erc.rsdiffbeforeafterboth424 _to: address,424 _to: address,425 _token_id: uint256,425 _token_id: uint256,426 _data: bytes,426 _data: bytes,427 ) -> Result<void> {427 ) -> Result<()> {428 // TODO: Not implemetable428 // TODO: Not implemetable429 Err("not implemented".into())429 Err("not implemented".into())430 }430 }436 _from: address,436 _from: address,437 _to: address,437 _to: address,438 _token_id: uint256,438 _token_id: uint256,439 ) -> Result<void> {439 ) -> Result<()> {440 // TODO: Not implemetable440 // TODO: Not implemetable441 Err("not implemented".into())441 Err("not implemented".into())442 }442 }458 from: address,458 from: address,459 to: address,459 to: address,460 token_id: uint256,460 token_id: uint256,461 ) -> Result<void> {461 ) -> Result<()> {462 let caller = T::CrossAccountId::from_eth(caller);462 let caller = T::CrossAccountId::from_eth(caller);463 let from = T::CrossAccountId::from_eth(from);463 let from = T::CrossAccountId::from_eth(from);464 let to = T::CrossAccountId::from_eth(to);464 let to = T::CrossAccountId::from_eth(to);477 }477 }478478479 /// @dev Not implemented479 /// @dev Not implemented480 fn approve(&mut self, _caller: caller, _approved: address, _token_id: uint256) -> Result<void> {480 fn approve(&mut self, _caller: caller, _approved: address, _token_id: uint256) -> Result<()> {481 Err("not implemented".into())481 Err("not implemented".into())482 }482 }483483491 caller: caller,491 caller: caller,492 operator: address,492 operator: address,493 approved: bool,493 approved: bool,494 ) -> Result<void> {494 ) -> Result<()> {495 let caller = T::CrossAccountId::from_eth(caller);495 let caller = T::CrossAccountId::from_eth(caller);496 let operator = T::CrossAccountId::from_eth(operator);496 let operator = T::CrossAccountId::from_eth(operator);497497556 /// operator of the current owner.556 /// operator of the current owner.557 /// @param tokenId The RFT to approve557 /// @param tokenId The RFT to approve558 #[weight(<SelfWeightOf<T>>::burn_item_fully())]558 #[weight(<SelfWeightOf<T>>::burn_item_fully())]559 fn burn(&mut self, caller: caller, token_id: uint256) -> Result<void> {559 fn burn(&mut self, caller: caller, token_id: uint256) -> Result<()> {560 let caller = T::CrossAccountId::from_eth(caller);560 let caller = T::CrossAccountId::from_eth(caller);561 let token = token_id.try_into()?;561 let token = token_id.try_into()?;562562805 /// @param to The new owner805 /// @param to The new owner806 /// @param tokenId The RFT to transfer806 /// @param tokenId The RFT to transfer807 #[weight(<SelfWeightOf<T>>::transfer_creating_removing())]807 #[weight(<SelfWeightOf<T>>::transfer_creating_removing())]808 fn transfer(&mut self, caller: caller, to: address, token_id: uint256) -> Result<void> {808 fn transfer(&mut self, caller: caller, to: address, token_id: uint256) -> Result<()> {809 let caller = T::CrossAccountId::from_eth(caller);809 let caller = T::CrossAccountId::from_eth(caller);810 let to = T::CrossAccountId::from_eth(to);810 let to = T::CrossAccountId::from_eth(to);811 let token = token_id.try_into()?;811 let token = token_id.try_into()?;833 caller: caller,833 caller: caller,834 to: eth::CrossAddress,834 to: eth::CrossAddress,835 token_id: uint256,835 token_id: uint256,836 ) -> Result<void> {836 ) -> Result<()> {837 let caller = T::CrossAccountId::from_eth(caller);837 let caller = T::CrossAccountId::from_eth(caller);838 let to = to.into_sub_cross_account::<T>()?;838 let to = to.into_sub_cross_account::<T>()?;839 let token = token_id.try_into()?;839 let token = token_id.try_into()?;862 from: eth::CrossAddress,862 from: eth::CrossAddress,863 to: eth::CrossAddress,863 to: eth::CrossAddress,864 token_id: uint256,864 token_id: uint256,865 ) -> Result<void> {865 ) -> Result<()> {866 let caller = T::CrossAccountId::from_eth(caller);866 let caller = T::CrossAccountId::from_eth(caller);867 let from = from.into_sub_cross_account::<T>()?;867 let from = from.into_sub_cross_account::<T>()?;868 let to = to.into_sub_cross_account::<T>()?;868 let to = to.into_sub_cross_account::<T>()?;888 /// @param tokenId The RFT to transfer888 /// @param tokenId The RFT to transfer889 #[solidity(hide)]889 #[solidity(hide)]890 #[weight(<SelfWeightOf<T>>::burn_from())]890 #[weight(<SelfWeightOf<T>>::burn_from())]891 fn burn_from(&mut self, caller: caller, from: address, token_id: uint256) -> Result<void> {891 fn burn_from(&mut self, caller: caller, from: address, token_id: uint256) -> Result<()> {892 let caller = T::CrossAccountId::from_eth(caller);892 let caller = T::CrossAccountId::from_eth(caller);893 let from = T::CrossAccountId::from_eth(from);893 let from = T::CrossAccountId::from_eth(from);894 let token = token_id.try_into()?;894 let token = token_id.try_into()?;917 caller: caller,917 caller: caller,918 from: eth::CrossAddress,918 from: eth::CrossAddress,919 token_id: uint256,919 token_id: uint256,920 ) -> Result<void> {920 ) -> Result<()> {921 let caller = T::CrossAccountId::from_eth(caller);921 let caller = T::CrossAccountId::from_eth(caller);922 let from = from.into_sub_cross_account::<T>()?;922 let from = from.into_sub_cross_account::<T>()?;923 let token = token_id.try_into()?;923 let token = token_id.try_into()?;pallets/refungible/src/erc_token.rsdiffbeforeafterboth109 }109 }110110111 /// @dev Not supported111 /// @dev Not supported112 fn decimals(&self) -> Result<uint8> {112 fn decimals(&self) -> Result<u8> {113 // Decimals aren't supported for refungible tokens113 // Decimals aren't supported for refungible tokens114 Ok(0)114 Ok(0)115 }115 }pallets/unique/src/eth/mod.rsdiffbeforeafterboth231 caller: caller,231 caller: caller,232 value: value,232 value: value,233 name: string,233 name: string,234 decimals: uint8,234 decimals: u8,235 description: string,235 description: string,236 token_prefix: string,236 token_prefix: string,237 ) -> Result<address> {237 ) -> Result<address> {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<void> {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)366 /// Returns address of a collection.366 /// Returns address of a collection.367 /// @param collectionId - CollectionId of the collection367 /// @param collectionId - CollectionId of the collection368 /// @return eth mirror address of the collection368 /// @return eth mirror address of the collection369 fn collection_address(&self, collection_id: uint32) -> Result<address> {369 fn collection_address(&self, collection_id: u32) -> Result<address> {370 Ok(collection_id_to_address(collection_id.into()))370 Ok(collection_id_to_address(collection_id.into()))371 }371 }372372373 /// Returns collectionId of a collection.373 /// Returns collectionId of a collection.374 /// @param collectionAddress - Eth address of the collection374 /// @param collectionAddress - Eth address of the collection375 /// @return collectionId of the collection375 /// @return collectionId of the collection376 fn collection_id(&self, collection_address: address) -> Result<uint32> {376 fn collection_id(&self, collection_address: address) -> Result<u32> {377 map_eth_to_id(&collection_address)377 map_eth_to_id(&collection_address)378 .map(|id| id.0)378 .map(|id| id.0)379 .ok_or(Error::Revert(format!(379 .ok_or(Error::Revert(format!(