-
Notifications
You must be signed in to change notification settings - Fork 4
/
mod.rs
33 lines (26 loc) · 1.06 KB
/
mod.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use revm::primitives::AccountInfo;
use crate::{
address::Address,
agent::agent_channel::{AgentChannelReceiver, AgentChannelSender},
state::{update::Update, State, World},
};
pub mod agent_channel;
/// Basic traits that every `Agent` must implement in order to properly interact with an EVM and simulation.
pub trait Agent<U, W>: Sync + Send
where
U: Update,
W: World<WorldUpdate = U>,
{
/// Returns the address of the agent.
fn address(&self) -> Address;
/// Returns the account info of the agent.
fn account_info(&self) -> AccountInfo {
AccountInfo::default()
}
/// Executes actions against the simulation as soon as the agent is activated.
fn activation_step(&mut self, _state: &mut State<U, W>) {}
/// Executes the agents actions against the simulation environment.
fn step(&mut self, _state: &State<U, W>, _channel: &AgentChannelSender<U>) {}
/// Executes the agents actions against the simulation environment.
fn resolve_step(&mut self, _state: &State<U, W>, _channel: &AgentChannelReceiver<U>) {}
}