This project tracks affiliate fees from various protocols (Portals, 0x, Relay, Chainflip) across EVM chains. It is organized for maintainability and clean code, with shared modules for config, logging, and database access.
listeners/— Main event listeners for each protocolshared/— Shared helpers for config, logging, and databasetests/— Test scriptsold files/— Deprecated or legacy code
shared/config.py: Centralized config and .env loadershared/logging.py: Consistent logger setup (setup_logger)shared/db.py: SQLite helpers (connect_db,ensure_schema)
- Install dependencies:
pip install web3 pyyaml python-dotenv
- .env file:
Place your API keys and secrets in a
.envfile in the project root. Example:INFURA_API_KEY=your_infura_key ALCHEMY_API_KEY=your_alchemy_key
- Config YAML:
Each listener requires a config YAML (see
listeners/portals_listener_config.yamlfor example).
Run a listener with:
PYTHONPATH=. python listeners/portals_listener.py- If you see
ModuleNotFoundError, ensure you usePYTHONPATH=. - If config or .env values are missing, check your YAML and
.envfiles. - For DB schema errors, ensure your config and schema match the code.
- Add new listeners in
listeners/, using shared modules for config/log/db. - Write docstrings and type hints for all functions.
- Place tests in
tests/.