Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: impl From<u64> and derive Copy for MockAccount #1288

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading