Skip to content

Commit

Permalink
feat: add VMPoolStateBuilder and refactor TychoSimulationContract t…
Browse files Browse the repository at this point in the history
…o improve engine handling

This commit aims to abstract away a lot of complexity that is in `VMPoolState` using a builder pattern.

This pattern helps us separating the initialisation and the execution of `VMPoolState`, making it more straightforward and simpler. For example many field where given to VMPoolState just for initialisation and never used after (`engine`, `trace`, ect..). Some where also `Option` but actually required by the struct at runtime (like `adapter_contract`.

The builder also allow any field to be directly given, for example if someone wants to manually create the `AdapterContract`.
  • Loading branch information
zizou0x committed Nov 25, 2024
1 parent f9be371 commit 58319b6
Show file tree
Hide file tree
Showing 7 changed files with 566 additions and 365 deletions.
14 changes: 14 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ unicode-width = "0.1.13"
once_cell = "1.20.2"

[dev-dependencies]
tokio-test = "0.4.4"
mockito = "1.1.1"
warp = "0.3.5"
approx = "0.5.1"
Expand Down
1 change: 1 addition & 0 deletions src/protocol/vm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pub(crate) mod erc20_overwrite_factory;
pub mod errors;
mod models;
pub mod state;
pub mod state_builder;
pub mod tycho_decoder;
pub(crate) mod tycho_simulation_contract;
pub mod utils;
Loading

0 comments on commit 58319b6

Please sign in to comment.