git.delta.rocks / unique-network / refs/commits / 2b8c75faeb12

difftreelog

fix After rebase

Trubnikov Sergey2022-08-24parent: #42c7b2c.patch.diff
in: master

1 file changed

modifiedpallets/common/src/eth.rsdiffbeforeafterboth
1616
17//! 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.
1818
19use 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;
23
24use crate::Config;
2523
26// 0x17c4e6453Cc49AAAaEACA894e6D9683e00000001 - collection 124// 0x17c4e6453Cc49AAAaEACA894e6D9683e00000001 - collection 1
27// TODO: Unhardcode prefix25// TODO: Unhardcode prefix
57where55where
58 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}
6461
62/// Converts Substrate address to CrossAccountId
63pub fn convert_substrate_address_to_cross_account_id<T: Config>(
64 address: uint256,
65) -> T::CrossAccountId
66where
67 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}