Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Shared utilities live in `utils/`:
Use structured logging everywhere — never use `print()`.

```python
from utils.logging import get_logger
from utils.logger import get_logger

logger = get_logger("protocol_name")

Expand Down
2 changes: 1 addition & 1 deletion api/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from urllib.parse import parse_qs, urlparse

from automation.config import JobsConfig, load_jobs_config
from utils.logging import get_logger
from utils.logger import get_logger
from utils.store import AlertEvent, get_alert, normalize_timestamp, query_alerts

logger = get_logger("api.server")
Expand Down
2 changes: 1 addition & 1 deletion automation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ profiles:

The runner runs every task in declared order, capturing each subprocess's exit code (and its stdout/stderr) without aborting the profile. After all tasks finish, if any failed, a single Markdown digest is posted to Telegram via `utils.telegram.send_telegram_message` with `protocol="automation"` — set `TELEGRAM_BOT_TOKEN_AUTOMATION` / `TELEGRAM_CHAT_ID_AUTOMATION` in `.env` to route it to a dedicated channel, otherwise it falls back to `TELEGRAM_BOT_TOKEN_DEFAULT` / `TELEGRAM_CHAT_ID_DEFAULT`.

Each failing task contributes a header line (`❌ *name* (exit N, Ds)`) and, when the script produced output, the last few lines of its error tail in a fenced code block — so the alert is actionable without an SSH/`journalctl` round-trip. The tail prefers stderr (uncaught tracebacks) and falls back to stdout (`utils.logging` output). The full captured output is still re-emitted to the daemon logs at `warning` level; only the short tail (4 lines / 500 chars) travels to Telegram. Because the tail lives inside a `` ``` `` fence, tracebacks containing Markdown metacharacters (`_`, `*`, `[`) can't break parsing and silently drop the digest.
Each failing task contributes a header line (`❌ *name* (exit N, Ds)`) and, when the script produced output, the last few lines of its error tail in a fenced code block — so the alert is actionable without an SSH/`journalctl` round-trip. The tail prefers stderr (uncaught tracebacks) and falls back to stdout (`utils.logger` output). The full captured output is still re-emitted to the daemon logs at `warning` level; only the short tail (4 lines / 500 chars) travels to Telegram. Because the tail lives inside a `` ``` `` fence, tracebacks containing Markdown metacharacters (`_`, `*`, `[`) can't break parsing and silently drop the digest.

The profile's exit code is non-zero if any task failed, which supercronic surfaces in the journald logs (`journalctl -u yearn-monitor`).

Expand Down
2 changes: 1 addition & 1 deletion automation/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _error_tail(stdout: str | None, stderr: str | None) -> str | None:
"""Extract a short, human-readable error tail from a failed task's output.

Prefers stderr — uncaught tracebacks and the interpreter's own error output land there —
and falls back to stdout (where `utils.logging` handlers write). Returns the last few
and falls back to stdout (where `utils.logger` handlers write). Returns the last few
non-empty lines, char-capped, or None when the task produced no output at all (the caller
then falls back to the bare exit code).
"""
Expand Down
2 changes: 1 addition & 1 deletion protocols/3jane/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from utils.cache import cache_path, get_last_value_for_key_from_file, write_last_value_to_file
from utils.chains import Chain
from utils.formatting import format_usd
from utils.logging import get_logger
from utils.logger import get_logger
from utils.telegram import send_telegram_message
from utils.web3_wrapper import ChainManager

Expand Down
2 changes: 1 addition & 1 deletion protocols/aave/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from utils.abi import load_abi
from utils.alert import Alert, AlertSeverity, send_alert
from utils.chains import Chain
from utils.logging import get_logger
from utils.logger import get_logger
from utils.web3_wrapper import ChainManager

PROTOCOL = "aave"
Expand Down
4 changes: 2 additions & 2 deletions protocols/aave/proposals.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import requests

from utils.cache import get_last_queued_id_from_file, write_last_queued_id_to_file
from utils.http import request_with_retry
from utils.logging import get_logger
from utils.http_client import request_with_retry
from utils.logger import get_logger
from utils.telegram import send_error_message, send_telegram_message

PROTOCOL = "aave"
Expand Down
2 changes: 1 addition & 1 deletion protocols/apyusd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from utils.cache import cache_filename, get_last_value_for_key_from_file, write_last_value_to_file
from utils.chains import Chain
from utils.config import Config
from utils.logging import get_logger
from utils.logger import get_logger
from utils.telegram import send_error_message
from utils.web3_wrapper import ChainManager

Expand Down
2 changes: 1 addition & 1 deletion protocols/bad-debt/bad-debt-trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import requests

from utils.logging import get_logger
from utils.logger import get_logger

logger = get_logger("bad-debt")

Expand Down
2 changes: 1 addition & 1 deletion protocols/cap/liquidity.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from utils.cache import cache_filename, get_last_value_for_key_from_file, write_last_value_to_file
from utils.chains import Chain
from utils.config import Config
from utils.logging import get_logger
from utils.logger import get_logger
from utils.web3_wrapper import ChainManager

CUSD = "0xcCcc62962d17b8914c62D74FfB843d73B2a3cccC"
Expand Down
2 changes: 1 addition & 1 deletion protocols/compound/collateral.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
)
from utils.chains import Chain
from utils.formatting import format_usd
from utils.logging import get_logger
from utils.logger import get_logger
from utils.telegram import send_telegram_message
from utils.web3_wrapper import ChainManager, Web3Client

Expand Down
2 changes: 1 addition & 1 deletion protocols/compound/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from utils.abi import load_abi
from utils.alert import Alert, AlertSeverity, send_alert
from utils.chains import Chain
from utils.logging import get_logger
from utils.logger import get_logger
from utils.web3_wrapper import ChainManager

PROTOCOL = "comp"
Expand Down
2 changes: 1 addition & 1 deletion protocols/compound/proposals.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from dotenv import load_dotenv

from utils.cache import get_last_queued_id_from_file, write_last_queued_id_to_file
from utils.logging import get_logger
from utils.logger import get_logger
from utils.telegram import escape_markdown, send_telegram_message

load_dotenv()
Expand Down
2 changes: 1 addition & 1 deletion protocols/ethena/ethena.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from utils.abi import load_abi
from utils.alert import Alert, AlertSeverity, send_alert
from utils.logging import get_logger
from utils.logger import get_logger
from utils.telegram import send_error_message
from utils.web3_wrapper import Chain, ChainManager

Expand Down
2 changes: 1 addition & 1 deletion protocols/fluid/proposals.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import requests

from utils.cache import get_last_queued_id_from_file, write_last_queued_id_to_file
from utils.logging import get_logger
from utils.logger import get_logger
from utils.telegram import escape_markdown, send_error_message, send_telegram_message

PROTOCOL = "fluid"
Expand Down
2 changes: 1 addition & 1 deletion protocols/infinifi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from utils.cache import cache_filename, get_last_value_for_key_from_file, write_last_value_to_file
from utils.chains import Chain
from utils.config import Config
from utils.logging import get_logger
from utils.logger import get_logger
from utils.telegram import send_error_message
from utils.web3_wrapper import ChainManager

Expand Down
2 changes: 1 addition & 1 deletion protocols/lrt-pegs/curve/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from utils.abi import load_abi
from utils.alert import Alert, AlertSeverity, send_alert
from utils.chains import Chain
from utils.logging import get_logger
from utils.logger import get_logger
from utils.web3_wrapper import ChainManager

CHANNEL = "pegs"
Expand Down
2 changes: 1 addition & 1 deletion protocols/lrt-pegs/fluid/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from utils.abi import load_abi
from utils.chains import Chain
from utils.logging import get_logger
from utils.logger import get_logger
from utils.telegram import send_telegram_message
from utils.web3_wrapper import ChainManager

Expand Down
2 changes: 1 addition & 1 deletion protocols/lrt-pegs/origin_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from utils.alert import Alert, AlertSeverity, send_alert
from utils.cache import get_last_queued_id_from_file, write_last_queued_id_to_file
from utils.chains import Chain
from utils.logging import get_logger
from utils.logger import get_logger
from utils.web3_wrapper import ChainManager

REDEEM_VALUE = int(1e18)
Expand Down
2 changes: 1 addition & 1 deletion protocols/lrt-pegs/uniswap_v3.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from utils.abi import load_abi
from utils.chains import Chain
from utils.logging import get_logger
from utils.logger import get_logger
from utils.telegram import send_telegram_message
from utils.web3_wrapper import ChainManager

Expand Down
2 changes: 1 addition & 1 deletion protocols/maker/proposals.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import requests

from utils.cache import get_last_queued_id_from_file, write_last_queued_id_to_file
from utils.logging import get_logger
from utils.logger import get_logger
from utils.telegram import escape_markdown, send_error_message, send_telegram_message

PROTOCOL = "maker"
Expand Down
4 changes: 2 additions & 2 deletions protocols/maple/collateral.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
from utils.alert import Alert, AlertSeverity, send_alert
from utils.config import Config
from utils.formatting import format_usd
from utils.http import request_with_retry
from utils.logging import get_logger
from utils.http_client import request_with_retry
from utils.logger import get_logger

PROTOCOL = "maple"
logger = get_logger(PROTOCOL)
Expand Down
2 changes: 1 addition & 1 deletion protocols/maple/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from utils.cache import cache_path, get_last_value_for_key_from_file, write_last_value_to_file
from utils.chains import Chain
from utils.formatting import format_usd
from utils.logging import get_logger
from utils.logger import get_logger
from utils.telegram import send_error_message
from utils.web3_wrapper import ChainManager

Expand Down
4 changes: 2 additions & 2 deletions protocols/morpho/_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from typing import Any, Dict, List, Optional

from utils.chains import Chain
from utils.http import request_with_retry
from utils.logging import get_logger
from utils.http_client import request_with_retry
from utils.logger import get_logger

API_URL = "https://api.morpho.org/graphql"
MORPHO_URL = "https://app.morpho.org"
Expand Down
4 changes: 2 additions & 2 deletions protocols/morpho/governance.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
)
from utils.chains import Chain
from utils.formatting import format_token_amount, format_with_suffix
from utils.http import request_with_retry
from utils.logging import get_logger
from utils.http_client import request_with_retry
from utils.logger import get_logger
from utils.telegram import send_telegram_message
from utils.web3_wrapper import ChainManager

Expand Down
4 changes: 2 additions & 2 deletions protocols/morpho/governance_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
write_last_value_to_file,
)
from utils.chains import Chain
from utils.http import request_with_retry
from utils.logging import get_logger
from utils.http_client import request_with_retry
from utils.logger import get_logger
from utils.telegram import send_telegram_message

PROTOCOL = "morpho"
Expand Down
4 changes: 2 additions & 2 deletions protocols/morpho/markets.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import requests

from utils.chains import Chain
from utils.http import request_with_retry
from utils.logging import get_logger
from utils.http_client import request_with_retry
from utils.logger import get_logger
from utils.telegram import send_error_message, send_telegram_message

# Configuration constants
Expand Down
4 changes: 2 additions & 2 deletions protocols/morpho/markets_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
write_last_value_to_file,
)
from utils.chains import Chain
from utils.http import request_with_retry
from utils.logging import get_logger
from utils.http_client import request_with_retry
from utils.logger import get_logger
from utils.telegram import send_telegram_message
from utils.web3_wrapper import ChainManager, Web3Client

Expand Down
2 changes: 1 addition & 1 deletion protocols/morpho/v2_decoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from utils.calldata.decoder import resolve_selector
from utils.chains import Chain
from utils.formatting import format_token_amount, format_with_suffix
from utils.logging import get_logger
from utils.logger import get_logger

logger = get_logger("morpho.v2_decoders")

Expand Down
2 changes: 1 addition & 1 deletion protocols/pendle/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from utils.abi import load_abi
from utils.chains import Chain
from utils.logging import get_logger
from utils.logger import get_logger
from utils.telegram import send_telegram_message
from utils.web3_wrapper import ChainManager

Expand Down
2 changes: 1 addition & 1 deletion protocols/rtoken/monitor_rtoken.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from utils.alert import Alert, AlertSeverity, send_alert
from utils.cache import get_last_queued_id_from_file, write_last_queued_id_to_file
from utils.chains import Chain
from utils.logging import get_logger
from utils.logger import get_logger
from utils.telegram import send_error_message
from utils.web3_wrapper import ChainManager

Expand Down
2 changes: 1 addition & 1 deletion protocols/safe/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
)
from utils.chains import safe_network_to_chain_id
from utils.llm.ai_explainer import explain_batch_transaction, explain_transaction, format_explanation_line
from utils.logging import get_logger
from utils.logger import get_logger
from utils.telegram import escape_markdown, send_telegram_message

load_dotenv()
Expand Down
2 changes: 1 addition & 1 deletion protocols/safe/specific.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from eth_utils import to_checksum_address
from web3 import Web3

from utils.logging import get_logger
from utils.logger import get_logger

logger = get_logger("safe.specific")

Expand Down
2 changes: 1 addition & 1 deletion protocols/spark/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from utils.alert import Alert, AlertSeverity, send_alert
from utils.chains import Chain
from utils.logging import get_logger
from utils.logger import get_logger
from utils.web3_wrapper import ChainManager

PROTOCOL = "spark"
Expand Down
2 changes: 1 addition & 1 deletion protocols/stables/dune_large_transfers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from utils.alert import Alert, AlertSeverity, send_alert
from utils.cache import cache_filename, get_last_value_for_key_from_file, write_last_value_to_file
from utils.config import Config
from utils.logging import get_logger
from utils.logger import get_logger

logger = get_logger("stables.dune_large_transfers")
PROTOCOL = "stables"
Expand Down
2 changes: 1 addition & 1 deletion protocols/stables/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from utils.alert import Alert, AlertSeverity, send_alert
from utils.defillama import fetch_prices
from utils.logging import get_logger
from utils.logger import get_logger

logger = get_logger("stables")

Expand Down
2 changes: 1 addition & 1 deletion protocols/stargate/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from utils.abi import load_abi
from utils.chains import Chain
from utils.logging import get_logger
from utils.logger import get_logger
from utils.telegram import send_telegram_message
from utils.web3_wrapper import ChainManager

Expand Down
2 changes: 1 addition & 1 deletion protocols/strata/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from utils.abi import load_abi
from utils.cache import cache_filename, get_last_value_for_key_from_file, write_last_value_to_file
from utils.chains import Chain
from utils.logging import get_logger
from utils.logger import get_logger
from utils.telegram import send_error_message, send_telegram_message
from utils.web3_wrapper import ChainManager

Expand Down
2 changes: 1 addition & 1 deletion protocols/timelock/timelock_alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from utils.calldata.decoder import decode_calldata, format_call_lines
from utils.chains import EXPLORER_URLS, Chain
from utils.llm.ai_explainer import explain_batch_transaction, explain_transaction, format_explanation_line
from utils.logging import get_logger
from utils.logger import get_logger
from utils.proxy import build_diff_url, detect_proxy_upgrade, get_current_implementation
from utils.safe_tx import unwrap_safe_exec_transaction
from utils.telegram import MAX_MESSAGE_LENGTH, escape_markdown, send_error_message, send_telegram_message
Expand Down
2 changes: 1 addition & 1 deletion protocols/usdai/large_mints.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from utils.chains import Chain
from utils.config import Config
from utils.erc20_supply_delta_monitor import ERC20SupplyDeltaMonitorConfig, run_erc20_supply_delta_monitor
from utils.logging import get_logger
from utils.logger import get_logger

PROTOCOL = "usdai"
logger = get_logger(f"{PROTOCOL}.large_mints")
Expand Down
2 changes: 1 addition & 1 deletion protocols/usdai/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from utils.cache import cache_filename, get_last_value_for_key_from_file, write_last_value_to_file
from utils.chains import Chain
from utils.config import Config
from utils.logging import get_logger
from utils.logger import get_logger
from utils.telegram import send_error_message
from utils.web3_wrapper import ChainManager

Expand Down
2 changes: 1 addition & 1 deletion protocols/ustb/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from utils.cache import cache_path, get_last_value_for_key_from_file, write_last_value_to_file
from utils.chains import Chain
from utils.formatting import format_usd
from utils.logging import get_logger
from utils.logger import get_logger
from utils.web3_wrapper import ChainManager

PROTOCOL = "ustb"
Expand Down
2 changes: 1 addition & 1 deletion protocols/yearn/check_endorsed.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from web3 import Web3

from utils.chains import Chain
from utils.logging import get_logger
from utils.logger import get_logger
from utils.telegram import send_telegram_message_with_fallback
from utils.web3_wrapper import ChainManager

Expand Down
Loading