Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[workspace]
members = [
"crates/nexum-engine",
"modules/ethflow-watcher",
"modules/example",
]
resolver = "2"
Expand Down
15 changes: 15 additions & 0 deletions modules/ethflow-watcher/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "ethflow-watcher"
version = "0.1.0"
edition.workspace = true
license.workspace = true
repository.workspace = true

[lib]
crate-type = ["cdylib"]

[dependencies]
cowprotocol = { version = "1.0.0-alpha.3", default-features = false }
alloy-primitives = { version = "1.5", default-features = false, features = ["std"] }
alloy-sol-types = { version = "1.5", default-features = false, features = ["std"] }
wit-bindgen = { version = "0.57", default-features = false, features = ["macros", "realloc"] }
35 changes: 35 additions & 0 deletions modules/ethflow-watcher/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// wit_bindgen::generate! expands to host-import shims whose arity matches
// the WIT signatures, which can exceed clippy's too-many-arguments threshold.
#![allow(clippy::too_many_arguments)]

wit_bindgen::generate!({
path: ["../../wit/nexum-host", "../../wit/shepherd-cow"],
world: "shepherd:cow/shepherd",
generate_all,
});

use nexum::host::{logging, types};

struct EthFlowWatcher;

impl Guest for EthFlowWatcher {
fn init(_config: Vec<(String, String)>) -> Result<(), HostError> {
logging::log(logging::Level::Info, "ethflow-watcher init");
Ok(())
}

fn on_event(event: types::Event) -> Result<(), HostError> {
// CoWSwapEthFlow `OrderPlacement` decode lands in BLEU-832; the
// EIP-1271 submission path lands in BLEU-833. Block / Tick /
// Message are not used by this module.
if let types::Event::Logs(logs) = event {
logging::log(
logging::Level::Info,
&format!("ethflow received {} logs (decode in BLEU-832)", logs.len()),
);
}
Ok(())
}
}

export!(EthFlowWatcher);