Skip to content

Commit

Permalink
Rename PaymentAccount to SignerAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
scx1332 committed Feb 7, 2024
1 parent 3f68929 commit 68158a3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions crates/erc20_payment_lib/src/runtime.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::signer::{PaymentAccount, Signer};
use crate::signer::{Signer, SignerAccount};
use crate::transaction::{
create_faucet_mint, create_free_allocation, create_free_allocation_internal,
create_lock_deposit, create_lock_withdraw, create_make_allocation,
Expand Down Expand Up @@ -60,7 +60,7 @@ pub struct SharedState {
pub external_gather_time: Option<DateTime<Utc>>,

#[serde(skip)]
pub accounts: Vec<PaymentAccount>,
pub accounts: Vec<SignerAccount>,
}

impl SharedState {
Expand Down Expand Up @@ -453,7 +453,7 @@ impl PaymentRuntime {
let accounts = payment_runtime_args
.secret_keys
.iter()
.map(|s| PaymentAccount {
.map(|s| SignerAccount {
address: get_eth_addr_from_secret(s),
signer: signer.clone(),
})
Expand Down Expand Up @@ -554,7 +554,7 @@ impl PaymentRuntime {
})
}

pub async fn add_account(&self, payment_account: PaymentAccount) {
pub async fn add_account(&self, payment_account: SignerAccount) {
log::info!("Adding account: {}", payment_account);
let mut sh = self.shared_state.lock().unwrap();

Expand Down
10 changes: 5 additions & 5 deletions crates/erc20_payment_lib/src/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ use tokio::time::timeout;
use web3::types::{Address, SignedTransaction, TransactionParameters, H160};

#[derive(Clone)]
pub struct PaymentAccount {
pub struct SignerAccount {
pub address: Address,
pub signer: Arc<Box<dyn Signer + Send + Sync>>,
}

impl Debug for PaymentAccount {
impl Debug for SignerAccount {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "PaymentAccount {{ address: {:#x} }}", self.address)
write!(f, "SignerAccount {{ address: {:#x} }}", self.address)
}
}

impl Display for PaymentAccount {
impl Display for SignerAccount {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "{:#x}", self.address)
}
}

impl PaymentAccount {
impl SignerAccount {
pub fn new(address: H160, signer: Arc<Box<dyn Signer + Send + Sync>>) -> Self {
Self { address, signer }
}
Expand Down

0 comments on commit 68158a3

Please sign in to comment.