Skip to content

Commit 9c719c7

Browse files
committed
chore: finish actor renaming
1 parent b23cf35 commit 9c719c7

5 files changed

Lines changed: 29 additions & 26 deletions

File tree

src/actors/fanatic.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use crate::{
2323
fanatic::{DoSmthWithLiquidationCall, UpdateReservePrice, UpdateReserveUser},
2424
follower::{SendFanaticAddr, StartListeningForEvents, StartListeningForOraclePrices},
2525
},
26-
Bum,
26+
Follower,
2727
},
2828
configs::FanaticConfig,
2929
consts::RAY,
@@ -35,7 +35,7 @@ pub struct Fanatic<P: Provider + Unpin + Clone + 'static> {
3535
provider: P,
3636

3737
db_addr: Addr<Database>,
38-
bum_addr: Addr<Bum<P>>,
38+
follower_addr: Addr<Follower<P>>,
3939
executor_addr: Option<Addr<Executor<P>>>,
4040

4141
pool_contract: contracts::aave_v3::PoolContract::PoolContractInstance<(), P>,
@@ -55,12 +55,15 @@ impl<P: Provider + Unpin + Clone + 'static> Actor for Fanatic<P> {
5555

5656
fn started(&mut self, ctx: &mut Self::Context) {
5757
let addr = ctx.address();
58-
let bum_addr = self.bum_addr.clone();
58+
let follower_addr = self.follower_addr.clone();
5959

6060
let fut = async move {
61-
bum_addr.send(SendFanaticAddr(addr)).await.unwrap();
62-
bum_addr.send(StartListeningForOraclePrices).await.unwrap();
63-
bum_addr.send(StartListeningForEvents).await.unwrap();
61+
follower_addr.send(SendFanaticAddr(addr)).await.unwrap();
62+
follower_addr
63+
.send(StartListeningForOraclePrices)
64+
.await
65+
.unwrap();
66+
follower_addr.send(StartListeningForEvents).await.unwrap();
6467
};
6568

6669
ctx.spawn(fut.into_actor(self));
@@ -186,7 +189,7 @@ impl<P: Provider + Unpin + Clone + 'static> Fanatic<P> {
186189
Ok(Fanatic {
187190
provider: config.provider,
188191
db_addr: config.db_addr,
189-
bum_addr: config.bum_addr,
192+
follower_addr: config.follower_addr,
190193
executor_addr: None,
191194
pool_contract,
192195
datap_contract,

src/actors/follower.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ use crate::{
1414
},
1515
Database, Fanatic,
1616
},
17-
configs::BumConfig,
17+
configs::FollowerConfig,
1818
consts::RAY,
1919
};
2020

2121
#[derive(Debug, Clone)]
22-
pub struct Bum<P: Provider + Unpin + Clone + 'static> {
22+
pub struct Follower<P: Provider + Unpin + Clone + 'static> {
2323
provider: P,
2424
filter: Filter,
2525

@@ -33,23 +33,23 @@ pub struct Bum<P: Provider + Unpin + Clone + 'static> {
3333
target: String,
3434
}
3535

36-
impl<P: Provider + Unpin + Clone + 'static> Actor for Bum<P> {
36+
impl<P: Provider + Unpin + Clone + 'static> Actor for Follower<P> {
3737
type Context = Context<Self>;
3838

3939
fn started(&mut self, _: &mut Self::Context) {
40-
info!("[started] Bum");
40+
info!("[started] Follower");
4141
}
4242
}
4343

44-
impl<P: Provider + Unpin + Clone + 'static> Handler<SendFanaticAddr<P>> for Bum<P> {
44+
impl<P: Provider + Unpin + Clone + 'static> Handler<SendFanaticAddr<P>> for Follower<P> {
4545
type Result = ();
4646

4747
fn handle(&mut self, msg: SendFanaticAddr<P>, _: &mut Context<Self>) -> Self::Result {
4848
self.fanatic_addr = Some(msg.0);
4949
}
5050
}
5151

52-
impl<P: Provider + Unpin + Clone + 'static> Handler<StartListeningForOraclePrices> for Bum<P> {
52+
impl<P: Provider + Unpin + Clone + 'static> Handler<StartListeningForOraclePrices> for Follower<P> {
5353
type Result = ();
5454

5555
fn handle(
@@ -61,16 +61,16 @@ impl<P: Provider + Unpin + Clone + 'static> Handler<StartListeningForOraclePrice
6161
}
6262
}
6363

64-
impl<P: Provider + Unpin + Clone + 'static> Handler<StartListeningForEvents> for Bum<P> {
64+
impl<P: Provider + Unpin + Clone + 'static> Handler<StartListeningForEvents> for Follower<P> {
6565
type Result = ();
6666

6767
fn handle(&mut self, _: StartListeningForEvents, ctx: &mut Context<Self>) -> Self::Result {
6868
self.listen_events(ctx);
6969
}
7070
}
7171

72-
impl<P: Provider + Unpin + Clone + 'static> Bum<P> {
73-
pub async fn new(config: BumConfig<P>) -> eyre::Result<Self> {
72+
impl<P: Provider + Unpin + Clone + 'static> Follower<P> {
73+
pub async fn new(config: FollowerConfig<P>) -> eyre::Result<Self> {
7474
let contracts = config
7575
.db_addr
7676
.send(database::GetProtocolContracts(config.target.clone()))

src/actors/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ pub mod follower;
88
pub use database::Database;
99
pub use executor::Executor;
1010
pub use fanatic::Fanatic;
11-
pub use follower::Bum;
11+
pub use follower::Follower;

src/configs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use actix::Addr;
44
use alloy::{primitives::Address, providers::Provider};
55
use sqlx::PgPool;
66

7-
use crate::actors::{Bum, Database, Fanatic};
7+
use crate::actors::{Database, Fanatic, Follower};
88

99
#[derive(Debug, Clone)]
1010
pub struct Config {
@@ -17,7 +17,7 @@ pub struct Config {
1717
}
1818

1919
#[derive(Debug, Clone)]
20-
pub struct BumConfig<P: Provider + Unpin + Clone + 'static> {
20+
pub struct FollowerConfig<P: Provider + Unpin + Clone + 'static> {
2121
pub provider: P,
2222
pub db_addr: Addr<Database>,
2323
pub target: String,
@@ -36,7 +36,7 @@ pub struct ExecutorConfig<P: Provider + Unpin + Clone + 'static> {
3636
pub struct FanaticConfig<P: Provider + Unpin + Clone + 'static> {
3737
pub provider: P,
3838
pub db_addr: Addr<Database>,
39-
pub bum_addr: Addr<Bum<P>>,
39+
pub follower_addr: Addr<Follower<P>>,
4040
pub target: String,
4141
}
4242

src/run.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use sqlx::postgres::PgPoolOptions;
1010
use tokio::signal::unix::{signal, SignalKind};
1111

1212
use crate::{
13-
actors::{Bum, Database, Executor, Fanatic},
14-
configs::{BumConfig, Config, DatabaseConfig, ExecutorConfig, FanaticConfig},
13+
actors::{Database, Executor, Fanatic, Follower},
14+
configs::{Config, DatabaseConfig, ExecutorConfig, FanaticConfig, FollowerConfig},
1515
};
1616

1717
#[derive(Message)]
@@ -50,21 +50,21 @@ pub async fn run(config: Config) {
5050
.await
5151
.start();
5252

53-
/* Spin up the bum actor */
54-
let bum_addr = Bum::new(BumConfig {
53+
/* Spin up the follower actor */
54+
let follower_addr = Follower::new(FollowerConfig {
5555
provider: provider_with_wallet.clone(),
5656
db_addr: db_addr.clone(),
5757
target: config.target.clone(),
5858
})
5959
.await
60-
.expect("Unable to initialise Bum actor")
60+
.expect("Unable to initialise follower actor")
6161
.start();
6262

6363
/* Spin up the fanatic actor */
6464
let fanatic_addr = Fanatic::new(FanaticConfig {
6565
provider: provider_with_wallet.clone(),
6666
db_addr: db_addr.clone(),
67-
bum_addr: bum_addr.clone(),
67+
follower_addr: follower_addr.clone(),
6868
target: config.target.clone(),
6969
})
7070
.await

0 commit comments

Comments
 (0)