refactor: organize protocol monitors into protocols/ folder#265
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 singleprotocols/folder.Root now holds only shared code (
utils/,automation/,common-abi/) and infra (deploy/,docs/,scripts/,tests/).Changes
aave,morpho,safe,yearn,lrt-pegs,3jane, …) underprotocols/viagit mvso file history is preserved.load_abi()/open()calls now referenceprotocols/<name>/abi/….common-abi/stays at the root as shared ABIs (unchanged).compound,maple,morpho,safe) andutils/address_resolvernow use theprotocols.*package path.script:paths re-pointed underprotocols/(utils/tenderly/tenderly.pyunchanged).[tool.setuptools]to namespace package discovery (packages.find), so the editable-install finder mapsprotocols.*automatically — adding a new protocol no longer requires apackagesedit.mock.patch()target strings.CLAUDE.md, andCONTRIBUTING.mdupdated for the new layout.Verification
uv run pytest tests/— 457 passed, 4 skippeduv run ruff check .— all checks passeduv run ruff format --check .— all files formattedpython -m automation render-crontabrenders; everyjobs.yamlscript path resolves on diskpython protocols/aave/main.pyandpython protocols/compound/main.py(aprotocols.*-importing script) run and resolve importsThis 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 themultisigprofile), andprotocolsonly resolves through the editable-install import finder. That finder is generated at install time frompyproject.toml, so the box must regenerate it before the new code runs:If the multisig profile's automatic
git pulllands this code before a manualuv sync, scripts withprotocols.*imports will fail withModuleNotFoundError: protocolsuntil 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 existingjobs.yamlnote: pyproject/dependency changes need a manualuv sync+ restart.🤖 Generated with Claude Code