Skip to content

Commit

Permalink
Merge pull request #79 from 0xAurelius/migrate-subgraphs
Browse files Browse the repository at this point in the history
Migrate subgraphs
  • Loading branch information
0xAurelius authored Jun 10, 2024
2 parents cdf4500 + 13052cd commit 1241658
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
needs: build-docker
env:
AIRTABLE_API_KEY: ${{ secrets.AIRTABLE_API_KEY }}
GRAPH_API_KEY: ${{ secrets.GRAPH_API_KEY }}
POLYGONSCAN_API_KEY: ${{ secrets.POLYGONSCAN_API_KEY }}
WEB3_PROVIDER_ETH_URL: ${{ secrets.WEB3_PROVIDER_ETH_URL }}
WEB3_PROVIDER_POLYGON_URL: ${{ secrets.WEB3_PROVIDER_POLYGON_URL }}
Expand Down
5 changes: 5 additions & 0 deletions k8s/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ spec:
secretKeyRef:
name: discord-bots-secret
key: POLYGONSCAN_API_KEY
- name: GRAPH_API_KEY
valueFrom:
secretKeyRef:
name: discord-bots-secret
key: GRAPH_API_KEY
1 change: 1 addition & 0 deletions k8s/secret.properties.template
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ DISCORD_WEBHOOK_BROKEN_BOND_ALERT=${DISCORD_WEBHOOK_BROKEN_BOND_ALERT}
POLYGONSCAN_API_KEY=${POLYGONSCAN_API_KEY}
WEB3_PROVIDER_ETH_URL=${WEB3_PROVIDER_ETH_URL}
WEB3_PROVIDER_POLYGON_URL=${WEB3_PROVIDER_POLYGON_URL}
GRAPH_API_KEY=${GRAPH_API_KEY}
27 changes: 23 additions & 4 deletions src/constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

from web3 import Web3

# Hard-coded since Polygon block times have stabilized
Expand Down Expand Up @@ -46,7 +48,24 @@
DAO_WALLET_ADDRESS = Web3.to_checksum_address('0x65a5076c0ba74e5f3e069995dc3dab9d197d995c')

# Subgraphs
KLIMA_PROTOCOL_SUBGRAPH = 'https://api.thegraph.com/subgraphs/name/klimadao/klimadao-protocol-metrics'
KLIMA_CARBON_SUBGRAPH = 'https://api.thegraph.com/subgraphs/name/klimadao/polygon-bridged-carbon'
KLIMA_BONDS_SUBGRAPH = 'https://api.thegraph.com/subgraphs/name/klimadao/klimadao-bonds'
POLYGON_DIGITAL_CARBON_SUBGRAPH = 'https://api.thegraph.com/subgraphs/name/klimadao/polygon-digital-carbon'
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'

# TODO: upgrade all IDs to latest production versions once upgraded
PROTOCOL_SUBGRAPH_ID = 'AiHH7a5AJwnn8zAuENy3586m82fgosUs2346LWKgxmTJ'
CARBON_SUBGRAPH_ID = '9skh5pMQGRdyJcBe8PjWdDjLoYqoYTMLRDpFh6acSHUu'
BONDS_SUBGRAPH_ID = 'D7bejmu4JQ9mnnQhhrs6b3iEL17nviNuLhN5RJkeUDFn'
POLYGON_DIGITAL_CARBON_ID = 'ECLEwJKgujmiRCW1XbfbbUbpae2igeHa2KJ6BXNSWrZF'

if os.environ.get('ENV') == 'production':
KLIMA_PROTOCOL_SUBGRAPH = GRAPH_BASE_URL + PROTOCOL_SUBGRAPH_ID
KLIMA_CARBON_SUBGRAPH = GRAPH_BASE_URL + CARBON_SUBGRAPH_ID
KLIMA_BONDS_SUBGRAPH = GRAPH_BASE_URL + BONDS_SUBGRAPH_ID
POLYGON_DIGITAL_CARBON_SUBGRAPH = GRAPH_BASE_URL + POLYGON_DIGITAL_CARBON_ID
else:
KLIMA_PROTOCOL_SUBGRAPH = GRAPH_DEV_BASE_URL + 'staging-klimadao-protocol-metrics' + GRAPH_VERSION_SUFFIX
KLIMA_CARBON_SUBGRAPH = GRAPH_DEV_BASE_URL + 'staging-polygon-bridged-carbon' + GRAPH_VERSION_SUFFIX
KLIMA_BONDS_SUBGRAPH = GRAPH_DEV_BASE_URL + 'staging-klimadao-bonds' + GRAPH_VERSION_SUFFIX
POLYGON_DIGITAL_CARBON_SUBGRAPH = GRAPH_DEV_BASE_URL + 'staging-polygon-digital-carbon' + GRAPH_VERSION_SUFFIX

0 comments on commit 1241658

Please sign in to comment.