From 2b8c75faeb1228eba0d01b2754ca2625de805769 Mon Sep 17 00:00:00 2001 From: Trubnikov Sergey Date: Wed, 24 Aug 2022 14:48:22 +0000 Subject: [PATCH] fix: After rebase --- --- a/pallets/common/src/eth.rs +++ b/pallets/common/src/eth.rs @@ -16,12 +16,10 @@ //! The module contains a number of functions for converting and checking ethereum identifiers. -use evm_coder::{types::uint256, execution::Result}; -pub use pallet_evm::account::CrossAccountId; +use evm_coder::types::uint256; +pub use pallet_evm::account::{Config, CrossAccountId}; use sp_core::H160; use up_data_structs::CollectionId; - -use crate::Config; // 0x17c4e6453Cc49AAAaEACA894e6D9683e00000001 - collection 1 // TODO: Unhardcode prefix @@ -57,7 +55,19 @@ where T::AccountId: AsRef<[u8; 32]>, { - use pallet_evm::account::CrossAccountId; let slice = from.as_sub().as_ref(); uint256::from_big_endian(slice) } + +/// Converts Substrate address to CrossAccountId +pub fn convert_substrate_address_to_cross_account_id( + address: uint256, +) -> T::CrossAccountId +where + T::AccountId: From<[u8; 32]>, +{ + let mut address_arr: [u8; 32] = Default::default(); + address.to_big_endian(&mut address_arr); + let account_id = T::AccountId::from(address_arr); + T::CrossAccountId::from_sub(account_id) +} \ No newline at end of file -- gitstuff