difftreelog
fix After rebase
in: master
1 file changed
pallets/common/src/eth.rsdiffbeforeafterboth161617//! The module contains a number of functions for converting and checking ethereum identifiers.17//! The module contains a number of functions for converting and checking ethereum identifiers.181819use evm_coder::{types::uint256, execution::Result};19use evm_coder::types::uint256;20pub use pallet_evm::account::CrossAccountId;20pub use pallet_evm::account::{Config, CrossAccountId};21use sp_core::H160;21use sp_core::H160;22use up_data_structs::CollectionId;22use up_data_structs::CollectionId;2324use crate::Config;252326// 0x17c4e6453Cc49AAAaEACA894e6D9683e00000001 - collection 124// 0x17c4e6453Cc49AAAaEACA894e6D9683e00000001 - collection 127// TODO: Unhardcode prefix25// TODO: Unhardcode prefix57where55where58 T::AccountId: AsRef<[u8; 32]>,56 T::AccountId: AsRef<[u8; 32]>,59{57{60 use pallet_evm::account::CrossAccountId;61 let slice = from.as_sub().as_ref();58 let slice = from.as_sub().as_ref();62 uint256::from_big_endian(slice)59 uint256::from_big_endian(slice)63}60}646162/// Converts Substrate address to CrossAccountId63pub fn convert_substrate_address_to_cross_account_id<T: Config>(64 address: uint256,65) -> T::CrossAccountId66where67 T::AccountId: From<[u8; 32]>,68{69 let mut address_arr: [u8; 32] = Default::default();70 address.to_big_endian(&mut address_arr);71 let account_id = T::AccountId::from(address_arr);72 T::CrossAccountId::from_sub(account_id)73}