diff --git a/README.md b/README.md index cb4356c..a5ff36a 100644 --- a/README.md +++ b/README.md @@ -40,10 +40,11 @@ $ curl localhost:5000/tvl/eth } ``` supported networks are: -- `ETH` -- `FTM` -- `OPI` -- `ARB` +- `eth` +- `ftm` +- `opt` +- `arb` +- `base` ### `/tvl/total` returns the sum of the TVLs of all networks: diff --git a/api.py b/api.py index 843fede..8e2d91a 100644 --- a/api.py +++ b/api.py @@ -6,7 +6,7 @@ app = Flask(__name__) CORS(app) -NETWORKS = ['eth', 'ftm', 'opt', 'arb'] +NETWORKS = ['eth', 'ftm', 'opt', 'arb', 'base'] UNIT_USD = 'USD' diff --git a/grafana.py b/grafana.py index 2d90c06..3f0abe8 100644 --- a/grafana.py +++ b/grafana.py @@ -9,17 +9,19 @@ # Explanation of query # sum v2 vaults does not subtract delegated deposits -QUERY_FTM_TVL = """sum(sum by (vault, version, address) (yearn_vault{param=\"tvl\", experimental=\"false\", network=\"FTM\"}))""" +QUERY_FTM_TVL = """sum(sum by (vault, version, address) (yearn_vault{param=\"tvl\", experimental=\"false\", network=\"FTM\"})) or vector(0)""" -# Explanation of query everything below is only on eth -# Sum of v1 vaults + sum of v2 vaults + sum of earn - sum of v2 vault funds deposited into other v2 vaults + veCRV holdings -QUERY_ETH_TVL = """sum(sum by (vault, version, address) (yearn_vault{param=\"tvl\", experimental=\"false\", network=\"ETH\"}))""" +QUERY_ETH_TVL = """sum(sum by (vault, version, address) (yearn_vault{param=\"tvl\", experimental=\"false\", network=\"ETH\"})) or vector(0)""" -QUERY_OPT_TVL = """sum(sum by (vault, version, address) (yearn_vault{param=\"tvl\", experimental=\"false\", network=\"OPTI\"}))""" +QUERY_styETH_TVL = """yeth{product=\"st-yETH\",param=\"tvl\"}""" -QUERY_ARB_TVL = """sum(sum by (vault, version, address) (yearn_vault{param=\"tvl\", experimental=\"false\", network=\"ARB\"}))""" +QUERY_OPTI_TVL = """sum(sum by (vault, version, address) (yearn_vault{param=\"tvl\", experimental=\"false\", network=\"OPTI\"})) or vector(0)""" -QUERY_TOTAL_TVL = QUERY_ETH_TVL + " + " + QUERY_FTM_TVL + " + " + QUERY_OPT_TVL + " + " + QUERY_ARB_TVL +QUERY_BASE_TVL = """sum(sum by (vault, version, address) (yearn_vault{param=\"tvl\", experimental=\"false\", network=\"BASE\"})) or vector(0)""" + +QUERY_ARBI_TVL = """sum(sum by (vault, version, address) (yearn_vault{param=\"tvl\", experimental=\"false\", network=\"ARB\"})) or vector(0)""" + +QUERY_TOTAL_TVL = QUERY_ETH_TVL + " + " + QUERY_FTM_TVL + " + " + QUERY_OPTI_TVL + " + " + QUERY_ARBI_TVL + " + " + QUERY_BASE_TVL + " + " + QUERY_styETH_TVL # Partner queries # Count of unique entries in the partner field @@ -35,8 +37,10 @@ 'tvl_total': QUERY_TOTAL_TVL, 'tvl_eth': QUERY_ETH_TVL, 'tvl_ftm': QUERY_FTM_TVL, - 'tvl_opt': QUERY_OPT_TVL, - 'tvl_arb': QUERY_ARB_TVL, + 'tvl_opti': QUERY_OPTI_TVL, + 'tvl_arbi': QUERY_ARBI_TVL, + 'tvl_base': QUERY_BASE_TVL, + 'tvl_styETH': QUERY_styETH_TVL, 'partners_count': QUERY_PAR_CNT, 'partners_total': QUERY_PAR_TOTAL, }