Skip to content
Merged
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
4 changes: 2 additions & 2 deletions modules/twap-monitor/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ allow = []

# ComposableCoW.ConditionalOrderCreated emissions on Sepolia. topic-0 =
# keccak256("ConditionalOrderCreated(address,(address,bytes32,bytes))"),
# parity-tested against the sol! decoder in strategy.rs. Both `address`
# parity-tested against the sol! decoder in keeper.rs. Both `address`
# and `event_signature` are pinned so the supervisor does not deliver
# unrelated logs to the module.
[[subscription]]
Expand All @@ -38,7 +38,7 @@ event_signature = "0x2cceac5555b0ca45a3744ced542f54b56ad2eb45e521962372eef212a2c

# ComposableCoW v2 ConditionalOrderRemoved emissions. topic-0 =
# keccak256("ConditionalOrderRemoved(address,bytes32)"), parity-tested
# against the sol! decoder in strategy.rs.
# against the sol! decoder in keeper.rs.
# This stream and the created stream merge in arrival order, not
# chain order, so a removal drops the watch (with its gates) only
# when it postdates the watch's indexed create.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Pure strategy logic for the twap-monitor module.
//! Pure logic for the twap-monitor keeper module.
//!
//! Every interaction with the world flows through a trait seam: the
//! `nexum_sdk::host` traits for chain and store access and the videre
Expand Down
12 changes: 6 additions & 6 deletions modules/twap-monitor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
//!
//! ## Module layout
//!
//! - `strategy.rs` holds the pure logic and unit tests against the
//! - `keeper.rs` holds the pure logic and unit tests against the
//! `nexum_sdk::host` trait seams and the videre `VenueTransport`
//! seam. It does not know `wit-bindgen` exists.
//! - `lib.rs` (this file) is the `#[videre_sdk::keeper]` glue: the
//! macro derives the component world from `module.toml`, emits the
//! `WitBindgenHost` adapter, and dispatches each event variant to
//! `strategy` with the typed [`CowClient`] over the module's own
//! `keeper` with the typed [`CowClient`] over the module's own
//! `videre:venue/client` import.

// wit_bindgen::generate! expands to host-import shims whose arity
Expand All @@ -22,7 +22,7 @@
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![allow(clippy::too_many_arguments)]

mod strategy;
mod keeper;

use cow_venue::CowClient;
use nexum::host::types;
Expand All @@ -39,17 +39,17 @@ impl TwapMonitor {

fn on_chain_logs(batch: types::ChainLogs) -> Result<(), Fault> {
let logs: Vec<nexum_sdk::events::Log> = batch.logs.into_iter().map(Into::into).collect();
strategy::on_chain_logs(&WitBindgenHost, &logs)?;
keeper::on_chain_logs(&WitBindgenHost, &logs)?;
Ok(())
}

fn on_block(block: types::Block) -> Result<(), Fault> {
let info = strategy::BlockInfo {
let info = keeper::BlockInfo {
chain_id: block.chain_id,
number: block.number,
timestamp: block.timestamp,
};
strategy::on_block(&WitBindgenHost, &CowClient::new(), info)?;
keeper::on_block(&WitBindgenHost, &CowClient::new(), info)?;
Ok(())
}

Expand Down
Loading