diff --git a/.env.example b/.env.example index d47dbd711..5afe629b5 100644 --- a/.env.example +++ b/.env.example @@ -44,3 +44,5 @@ export SHOW_STATS= # True or False. Defaults to False. # DEBUG_Variables export DEBUG_ADDRESS= # Address you want to use to run the debug-apy script on +export BAD= # Address you want to use to run the debug-price script for ypm on +export BLOCK= # Default to current block. Dont have to set if you want the default \ No newline at end of file diff --git a/Makefile b/Makefile index 57e216693..f23670c00 100644 --- a/Makefile +++ b/Makefile @@ -134,6 +134,11 @@ debug-apy: build setup-network docker build -f Dockerfile.dev -t ghcr.io/yearn/yearn-exporter . DEBUG=true $(compose_command) -p $$PROJECT_PREFIX run --rm --entrypoint "brownie run --network $$BROWNIE_NETWORK debug_apy with_exception_handling -I" exporter +debug-price: build setup-network + source set_network_envs.sh + docker build -f Dockerfile.dev -t ghcr.io/yearn/yearn-exporter . + $(compose_command) -p $$PROJECT_PREFIX run --rm -e BAD=$(BAD) --entrypoint "brownie run --network $$BROWNIE_NETWORK utils/debug-price -I" exporter + list-networks: @echo "supported networks: $(supported_networks)" diff --git a/readme.md b/readme.md index 4ce653d6b..5b29f9311 100644 --- a/readme.md +++ b/readme.md @@ -110,3 +110,6 @@ This is a flexible approach to start multiple containers on multiple networks wh - start APY preview for curve pools: `make curve-apy-previews` + +- debug ypm prices: + `make debug-price network=optimism` diff --git a/scripts/utils/debug-price.py b/scripts/utils/debug-price.py new file mode 100644 index 000000000..80e66fd6c --- /dev/null +++ b/scripts/utils/debug-price.py @@ -0,0 +1,21 @@ + +import logging +import os + +from brownie import chain + +import y + +y_logger = logging.getLogger('y') +y_logger.setLevel(logging.DEBUG) +y_logger.addHandler(logging.StreamHandler()) + +def main(): + BAD = os.environ.get("BAD") + BLOCK = os.environ.get("BLOCK") + if not BAD: + raise ValueError("You must specify a token to debug by setting BAD env var") + if not BLOCK: + BLOCK = chain.height + y_logger.warning("no BLOCK specified, using %s", BLOCK) + y.get_price(BAD, int(BLOCK), skip_cache=True)