Skip to content

refactor: organize protocol monitors into protocols/ folder#265

Merged
spalen0 merged 2 commits into
mainfrom
refactor/organize-protocols-folder
Jun 4, 2026
Merged

refactor: organize protocol monitors into protocols/ folder#265
spalen0 merged 2 commits into
mainfrom
refactor/organize-protocols-folder

Conversation

@spalen0
Copy link
Copy Markdown
Collaborator

@spalen0 spalen0 commented Jun 4, 2026

What

After merging automation/, the repo root had accumulated ~26 protocol monitor directories alongside shared code and infra, making it hard to navigate. This moves every protocol monitor into a single protocols/ folder.

Root now holds only shared code (utils/, automation/, common-abi/) and infra (deploy/, docs/, scripts/, tests/).

Changes

  • Moved all protocol dirs (aave, morpho, safe, yearn, lrt-pegs, 3jane, …) under protocols/ via git mv so file history is preserved.
  • Paths: load_abi() / open() calls now reference protocols/<name>/abi/…. common-abi/ stays at the root as shared ABIs (unchanged).
  • Imports: intra/cross-protocol imports (compound, maple, morpho, safe) and utils/address_resolver now use the protocols.* package path.
  • automation/jobs.yaml: task script: paths re-pointed under protocols/ (utils/tenderly/tenderly.py unchanged).
  • pyproject.toml: switched [tool.setuptools] to namespace package discovery (packages.find), so the editable-install finder maps protocols.* automatically — adding a new protocol no longer requires a packages edit.
  • Tests: updated imports and mock.patch() target strings.
  • Docs: README protocol links, CLAUDE.md, and CONTRIBUTING.md updated for the new layout.

Verification

  • uv run pytest tests/ — 457 passed, 4 skipped
  • uv run ruff check . — all checks passed
  • uv run ruff format --check . — all files formatted
  • python -m automation render-crontab renders; every jobs.yaml script path resolves on disk
  • python protocols/aave/main.py and python protocols/compound/main.py (a protocols.*-importing script) run and resolve imports

⚠️ Deploy note — requires re-sync on the box

This is a packaging change, not just code. Several scripts now import the protocols.* package (e.g. protocols/safe/main.py, which runs every 10 min in the multisig profile), and protocols only resolves through the editable-install import finder. That finder is generated at install time from pyproject.toml, so the box must regenerate it before the new code runs:

git pull
uv sync --frozen --extra ai      # regenerates the protocols.* import finder
sudo systemctl restart monitoring

If the multisig profile's automatic git pull lands this code before a manual uv sync, scripts with protocols.* imports will fail with ModuleNotFoundError: protocols until the sync runs. The cron cadence itself is unchanged (the crontab only references profiles, not script paths), so no crontab edit is needed beyond what the restart re-renders. This matches the existing jobs.yaml note: pyproject/dependency changes need a manual uv sync + restart.

🤖 Generated with Claude Code

spalen0 and others added 2 commits June 4, 2026 16:58
Consolidate the ~26 protocol monitor directories (aave, morpho, safe, …)
that had accumulated at the repo root into a single `protocols/` folder, so
the root only holds shared code (utils/, automation/, common-abi/) and infra
(deploy/, docs/, scripts/, tests/).

- Move all protocol dirs under protocols/ via git mv (history preserved).
- Update load_abi()/open() paths and intra/cross-protocol imports to the
  protocols.* package path (common-abi/ stays at root as shared ABIs).
- Update automation/jobs.yaml task script paths (utils/tenderly unchanged).
- Switch pyproject.toml to namespace package discovery so the editable
  finder maps protocols.* automatically — no per-protocol packages entry.
- Update test imports and mock.patch() target strings.
- Update README, CLAUDE.md, CONTRIBUTING docs for the new layout.

All 457 tests pass; ruff check + format clean; `python -m automation
render-crontab` and every jobs.yaml script path resolve.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@spalen0 spalen0 merged commit 2c1a6a5 into main Jun 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant