I'm working with pallet_evm of Frontier to support EVM
, I want to map
the Substrate account with the EVM account
#[pallet::storage]
pub type Mapping<T: Config> = StorageMap<_, Twox64Concat, H160, AccountId32>;
why did I change the AddressMapping of pallet_evm the EVM account balance dropped to 0
impl<T> pallet_evm::AddressMapping<AccountId32> for MyAddressMapping<T>
where
T: Config,
{
fn into_account_id(address: H160) -> AccountId32 {
if let Some(account_id) = Mapping::<T>::get(address) {
account_id
} else {
HashedAddressMapping::<BlakeTwo256>::into_account_id(address)
}
}
}
and why the trait AddressMapping must have the value return rather than an option like this
pub trait AddressMapping<A> {
fn into_account_id(address: H160) -> Option<A>;
}