Skip to content

Commit

Permalink
chore: impl From<u64> and derive Copy for MockAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
koushiro committed Jan 24, 2024
1 parent 1ad3f1c commit 8334a7d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion precompiles/src/testing/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use scale_info::TypeInfo;
use serde::{Deserialize, Serialize};
use sp_core::{Decode, Encode, MaxEncodedLen, H160, H256};

#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Debug)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug)]
#[derive(Serialize, Deserialize, derive_more::Display)]
#[derive(Encode, Decode, MaxEncodedLen, TypeInfo)]
pub struct MockAccount(pub H160);
Expand Down Expand Up @@ -82,6 +82,12 @@ impl From<[u8; 20]> for MockAccount {
}
}

impl From<u64> for MockAccount {
fn from(address: u64) -> MockAccount {
MockAccount::from_u64(address)
}
}

impl AddressMapping<MockAccount> for MockAccount {
fn into_account_id(address: H160) -> MockAccount {
address.into()
Expand Down

0 comments on commit 8334a7d

Please sign in to comment.