-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Colin/simple arb detection #230
Conversation
time to fix the rest of the tests and clean up
Just fixed the conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
thread::spawn(move || { | ||
while let Ok(_logs) = receiver.recv() { | ||
// self.filter_events(logs); | ||
let decoder = |input, filter_num: usize| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sick move
@@ -151,23 +232,52 @@ pub struct SimulationEventFilter { | |||
pub address: B160, | |||
/// The event names to filter for. | |||
pub topic: H256, | |||
/// A private copy of the [`BaseContract`] for whichever contract is used to generate filters. | |||
base_contract: BaseContract, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does this need to be private?
Closes #144
Quite a big refactor was needed in order to give us the ability to have a struct like
SimpleArbitrageur
an impl block that we can access from a simulation. That is, working with&dyn Agent
can't do this and it would have required a complicatedevent_monitoring()
function to be created.This is now done by using the
AgentType
enum which does create an onion type by virtue of items likeAgentType::User(User)
. This is not the most elegant, but we get more control this way.In order to make the creation of agents easier, we have a trait called
AgentStatus
that allows for fields of each agent struct to change depending on whether it has been added to theSimulationManager
's HashMap as well as theSimulationEnvironment
db. This also required a bit of finagling with another traitIdentifiable
which solely retrieves the name of an agent.A new test was written in
simple_arbitrageur.rs
calledsimple_arbitrage_detection()
. Think of this as a basic boilerplate example of detecting price differences. It is rather clunky for now, but going further felt a bit silly until we have other pools to arb with.