Solver inventory rebalance
Template: solver-inventory-rebalance ยท category: intents ยท risk: money_moving
Keeps a solver's fill wallet stocked. It polls the solver wallet's ERC20
inventory and, when the balance drifts below a floor, parks a top-up transfer
from a separate funding wallet behind a human approval โ refilling the
solver back to a target balance. The pairing for
erc7683-solver: the fill workflow burns
output-token inventory, this keeps it topped up.
When to use it
- your solver runs out of a token mid-day and starts skipping fills
- you want a human in the loop before reserve capital moves to the hot wallet
- you keep funding capital in a separate wallet from the fill wallet
Generate it
rflow new --template solver-inventory-rebalance
# or add the workflow to an existing project
rflow add workflow solver-inventory-rebalanceNon-interactive (CI/agents):
rflow new --template solver-inventory-rebalance --yes --output ./rebalance \
--answer token_address=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 \
--answer min_inventory=50000 --answer refill_to=100000Inputs
| key | type | default |
|---|---|---|
project_name | string | solver-inventory-rebalance |
network / chain_id / rpc_env / rpc_url | network / chain_id / env_var / string | ethereum / 1 / ETH_RPC / a public RPC |
confirmations | int | 3 |
token_name / token_address / token_decimals | contract / address / int | Token / USDC mainnet / 6 |
solver_wallet | address | zero placeholder (replace!) |
min_inventory / refill_to | token_amount | 50000 / 100000 |
poll_every | duration | 1m |
approval_timeout | duration | 30m |
gas_max_price | string | 50 gwei |
Required env vars
DATABASE_URL, the RPC env var (default ETH_RPC), and
RAW_DANGEROUS_MNEMONIC โ rflow new writes a fresh DEV-ONLY mnemonic;
swap in a production signer before real funds ride on it.
Safety notes
Money-moving, so every rail is on: pre-flight simulation with
assert_sim: ["${{ sim.ok }}"], a gas.max_price ceiling, a concurrency
group (skip) so a parked top-up never stacks, wait_for: confirmed, and
on_failure: dead_letter. The top-up is parked behind
approval โ rflow approve <id> โ and the approval
re-simulates immediately before broadcast, so a wallet refilled during the
wait sends nothing. Attach a budget to cap cumulative
top-up spend.
Run it locally
docker compose up -d # postgres on localhost:5448
# fill .env (RPC + a real signer), set solver_wallet
rflow validate
rflow startCommon modifications
- refill from an external treasury by pointing
fundingat that wallet - watch several tokens by adding a workflow per token
- raise
poll_everyon quiet chains to cut RPC load