diff --git a/src/apps/treasury/pages/hud.py b/src/apps/treasury/pages/hud.py index 4b3a8df..640c26e 100644 --- a/src/apps/treasury/pages/hud.py +++ b/src/apps/treasury/pages/hud.py @@ -10,7 +10,7 @@ from src.apps.treasury.util.constants import BCT_ERC20_CONTRACT, KLIMA_GREEN from src.apps.treasury.data.protocol_metrics import \ - sg, last_metric, get_last_asset_price_by_address, protocol_metrics_subgraph + sg, last_metric, get_last_asset_price_by_address ILLIQUID_ASSETS_GSHEET = 'https://docs.google.com/spreadsheets/d/1beNgV2Aemu01I-iyTsfOvHDTSevb0dj8GWXqo5KDShk' @@ -140,14 +140,14 @@ def query_last_metric(): # TODO: add logic to sum up balances until all KLIMA tokens are backed carbon_backing_usd = klima_supply * lowest_carbon_price -treasury_value -= carbon_backing_usd +total_treasury_value -= (carbon_backing_usd + treasury_usdc) # TODO: add descriptive tooltips to each label on the pie chart green_ratio_data = [ {"bucket": "Op Ex", "value": total_usdc, "target": 0.1}, {"bucket": "Carbon Forwards", "value": total_forwards, "target": 0.22}, {"bucket": "Carbon Backing", "value": carbon_backing_usd, "target": 0.2}, - {"bucket": "Treasury Holdings", "value": treasury_value, "target": 0.48} + {"bucket": "Treasury Holdings", "value": total_treasury_value, "target": 0.48} ] green_ratio_df = pd.DataFrame.from_records(green_ratio_data) order = [ diff --git a/src/apps/treasury/util/constants.py b/src/apps/treasury/util/constants.py index cb6e4ad..de3ce93 100644 --- a/src/apps/treasury/util/constants.py +++ b/src/apps/treasury/util/constants.py @@ -1,5 +1,19 @@ +import os + # Subgraphs -KLIMA_PROTOCOL_SUBGRAPH = 'https://api.thegraph.com/subgraphs/name/klimadao/klimadao-protocol-metrics' +GRAPH_API_KEY = os.environ.get('GRAPH_API_KEY') +GRAPH_BASE_URL = f'https://gateway-arbitrum.network.thegraph.com/api/{GRAPH_API_KEY}/subgraphs/id/' +GRAPH_DEV_BASE_URL = 'https://api.studio.thegraph.com/query/71975/' +GRAPH_VERSION_SUFFIX = '/version/latest' + +if os.environ.get('ENV') == 'production': + KLIMA_PROTOCOL_SUBGRAPH = ( + 'https://api.studio.thegraph.com/query/71975/staging-klimadao-protocol-metrics/version/latest' + ) +else: + KLIMA_PROTOCOL_SUBGRAPH = ( + GRAPH_DEV_BASE_URL + 'staging-klimadao-protocol-metrics' + GRAPH_VERSION_SUFFIX + ) BCT_ERC20_CONTRACT = '0x2f800db0fdb5223b3c3f354886d907a671414a7f' NCT_ERC20_CONTRACT = '0xD838290e877E0188a4A44700463419ED96c16107'