harb/services/txnBot
Agent b8e5885849 chore: gardener housekeeping 2026-04-06
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 06:01:19 +00:00
..
src fix: txnBot has zero test coverage after deleting recenterAccess.test.ts (#919) 2026-03-17 19:34:58 +00:00
.env.template merge liquidity and liquidation bot 2024-09-17 11:23:43 +02:00
.gitignore fix: Consolidate redundant/broken gitignore node_modules entries (#204) 2026-02-25 21:13:16 +00:00
.graphql merge liquidity and liquidation bot 2024-09-17 11:23:43 +02:00
.lintstagedrc.json txnbot - rewrite and lint (#53) 2025-10-04 15:40:30 +02:00
.prettierrc txnbot - rewrite and lint (#53) 2025-10-04 15:40:30 +02:00
AGENTS.md chore: gardener housekeeping 2026-04-06 2026-04-06 06:01:19 +00:00
eslint.config.js fix: lint: Ban waitForTimeout, setTimeout-as-delay, and fixed sleep patterns (#442) 2026-03-03 20:58:01 +00:00
package.json fix: restore test script in txnBot package.json (#887) 2026-03-17 13:34:03 +00:00
README.md fix: txnBot AGENTS.md ENVIRONMENT enum is stale (#784) 2026-03-15 14:11:45 +00:00
tsconfig.build.json txnbot - rewrite and lint (#53) 2025-10-04 15:40:30 +02:00
tsconfig.json txnbot - rewrite and lint (#53) 2025-10-04 15:40:30 +02:00

txnBot

Automation worker that monitors staking positions and calls recenter() / payTax() when profitable.

Environments

The bot supports four environments shared across the stack:

  • BASE_SEPOLIA_LOCAL_FORK Anvil fork of Base Sepolia started by scripts/dev.sh
  • BASE_MAINNET_LOCAL_FORK Anvil fork of Base mainnet started by scripts/dev.sh
  • BASE_SEPOLIA Public Base Sepolia testnet
  • BASE Base mainnet

Set ENVIRONMENT alongside the other variables listed below to target the desired chain.

Configuration

Create an environment file (e.g. .env) with:

ENVIRONMENT=BASE_SEPOLIA
PROVIDER_URL=<rpc-url>
PRIVATE_KEY=<hex-private-key>
LM_CONTRACT_ADDRESS=<liquidity-manager-address>
STAKE_CONTRACT_ADDRESS=<stake-contract-address>
GRAPHQL_ENDPOINT=<ponder-graphql-url>
# Optional: PORT=43069

scripts/dev.sh start generates these values automatically for the local fork, writes them to a temporary file, and keeps the process running in the background.

Local Run

npm install
npm start

The service exposes a lightweight status endpoint at GET /status reporting uptime, balances, and the most recent automation activity.

Generate a New Operator Key

Run npm run generate-key to produce a fresh EOA. The command writes the private key and address as JSON log entries to txnbot.log. Be sure to rotate the log or move the credentials to a secure store immediately after use.