Skip to main content

cow_weiroll/
lib.rs

1//! `cow-weiroll` — Layer 2 Weiroll script builder for the `CoW` Protocol SDK.
2//!
3//! [Weiroll](https://github.com/weiroll/weiroll) is a minimal VM for
4//! chaining arbitrary EVM calls into a single transaction. This crate
5//! provides the Rust types for building Weiroll scripts and encoding them
6//! as `execute(bytes32[],bytes[])` calldata targeting the canonical Weiroll
7//! executor contract.
8//!
9//! # Submodules
10//!
11//! | Module | Purpose |
12//! |---|---|
13//! | `planner` (private) | [`WeirollPlanner`] builder for accumulating commands/state |
14//! | [`types`] | [`WeirollCommand`], [`WeirollScript`], [`WeirollContractRef`], factory functions |
15//!
16//! # Key items
17//!
18//! | Item | Purpose |
19//! |---|---|
20//! | [`WeirollPlanner`] | Builder: `add_command` → `add_state_slot` → `plan()` |
21//! | [`WeirollCommand`] | A single 32-byte packed instruction |
22//! | [`WeirollScript`] | Finalised script (commands + state) |
23//! | [`WeirollContractRef`] | Contract address + ABI + default call flags |
24//! | [`create_weiroll_contract`] | Factory for `CALL`-mode contracts |
25//! | [`create_weiroll_library`] | Factory for `DELEGATECALL`-mode libraries |
26//! | [`create_weiroll_delegate_call`] | Build a complete `execute(...)` [`EvmCall`](cow_chains::chains::EvmCall) |
27
28#![deny(unsafe_code)]
29#![warn(missing_docs)]
30
31mod planner;
32pub mod types;
33
34pub use planner::WeirollPlanner;
35pub use types::{
36    WEIROLL_ADDRESS, WeirollCommand, WeirollCommandFlags, WeirollContractRef, WeirollScript,
37    create_weiroll_contract, create_weiroll_delegate_call, create_weiroll_library,
38    define_read_only, get_static,
39};