Skip to content

Commit

Permalink
feat: add ypm_debug script (#674)
Browse files Browse the repository at this point in the history
* add ypm_debug script

* chore: update readme & .envexample
  • Loading branch information
0xBasically authored Nov 13, 2023
1 parent cf2e3bc commit bb2d51c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ export SHOW_STATS= # True or False. Defaults to False.

# DEBUG_Variables
export DEBUG_ADDRESS=<YOUR_VAULT_APY_DEBUG_ADDRESS_HERE> # Address you want to use to run the debug-apy script on
export BAD=<YOUR_TOKEN_TO_PRICE> # 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
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)"

Expand Down
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
21 changes: 21 additions & 0 deletions scripts/utils/debug-price.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit bb2d51c

Please sign in to comment.