Examples
Runnable, self-contained example projects live in the repo's
examples/
directory. Each one is a complete rflow project (rflow.yaml + abis/ +
Makefile + README.md) driven entirely by make — you type a few targets,
watch the logs, and see real transactions relayed to CONFIRMED. Every example
uses its own database, anvil port and health port, so they can all run side
by side.
One command, one terminal — from the repo root, each example runs end-to-end (chain up, postgres up, deploy/fund, rflow booted, trigger fired automatically once indexing is live; Ctrl-C cleans up):
make run-token-transfer-relay
make run-mainnet-fork-usdc
make run-ops-monitor
make run-liquidation-keeper
make run-erc7683-solver
make run-treasury-ops
make run-command-decision
make run-command-trade-prep
make run-template-galleryThe per-example 3-terminal walkthroughs remain for step-by-step control:
| example | what it shows | one command (repo root) | step-by-step |
|---|---|---|---|
| token-transfer-relay | The headline. Watch ERC20 deposits into a treasury address; deposits >= 100 tokens are echoed back out through the embedded rrelayer to CONFIRMED. Zero external deps — local anvil, deterministic addresses. | make run-token-transfer-relay | make anvil · make setup deploy start · make trigger |
| mainnet-fork-usdc | The same relay flow against real mainnet USDC on an anvil fork — deposits fired by impersonating a Circle-scale whale, forwarded onward by the relayer. | make run-mainnet-fork-usdc | make anvil-fork · make setup fund start · make trigger |
| ops-monitor | No signer, no relayer, no event trigger — lazy boot proven in the logs. A 15s cron reads totalSupply on-chain and POSTs HMAC-signed reports to a local Python sink; plus an optional (paused) telegram heartbeat. | make run-ops-monitor | make anvil · make sink · make setup deploy start |
| liquidation-keeper | The classic keeper bot as one yaml file. A read: trigger polls an Aave-style healthFactor every 5s (edge-triggered, no indexer needed); the moment the position goes underwater the keeper liquidates — pre-flight simulated, assert_sim-guarded, gas-capped. | make run-liquidation-keeper | make anvil · make setup deploy start · make trigger |
| erc7683-solver | The intents starter kit. ERC-7683-shaped Open events are indexed, quoted (where: drops unprofitable intents), race-checked, then approved + filled by the solver relayer — index → decide → simulate → fill → exactly-once, with a commented cross-chain variant. | make run-erc7683-solver | make anvil · make setup deploy start · make trigger |
| treasury-ops | Human-in-the-loop, hands-on. A 30s cron reads the hot treasury balance and parks a sweep-to-cold behind an approval: gate — decide it with rflow approve and it rechecks, re-simulates and broadcasts. on_conflict: skip keeps parked sends from stacking. | make run-treasury-ops | make anvil · make setup deploy start · make approvals approve |
| command-decision | command custom logic, no signer. A node script reads the trigger context on stdin and prints a JSON decision ({severity, reason}); later steps branch on it — always report, if: non-ok escalate — over an HMAC-signed sink. The command decides; rflow reads the chain, journals, and calls. | make run-command-decision | make anvil · make sink · make setup deploy start |
| command-trade-prep | command prepares money movement. A deposit fires a node command that quotes a trade (amount, min_out, deadline, valid_until); rflow signs + simulates + sends it, gas-capped and rechecked against the freshness window, to CONFIRMED. The command cannot send — that is the point. | make run-command-trade-prep | make anvil · make setup deploy start · make trigger |
| template-gallery | The template registry walkthrough. rflow templates ls browses 17 first-party recipes, rflow new --template scaffolds a monitor-only AND a money-moving project, rflow add workflow composes a dead-letter pager into the first — everything validated. No chain, no database. | make run-template-gallery | make ls · make monitor money add · make lock tree |
Prerequisites
- Foundry (
anvil+cast) - Docker (postgres via the repo-root
docker-compose.yml, port 5448) - Rust (examples run the CLI with
cargo run --bin rflow) python3(ops-monitor's sink only)
Each example's make setup copies .env.example to .env, starts postgres
and creates the example's database idempotently. make help (the default
target) lists everything else.