Skip to content

Commit

Permalink
Switch subgraph URLs to decentralized network
Browse files Browse the repository at this point in the history
  • Loading branch information
0xAurelius committed Jun 10, 2024
1 parent d501124 commit c012cf1
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 19 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ jobs:
env:
PREFECT_API_KEY: ${{ secrets.PREFECT_API_KEY }}
PREFECT_API_URL: ${{ secrets.PREFECT_API_URL }}
GRAPH_API_KEY: ${{ secrets.GRAPH_API_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.DIGITALOCEAN_SPACES_API_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_API_SECRET }}
WEB3_INFURA_PROJECT_ID: ${{ secrets.WEB3_INFURA_PROJECT_ID }}
Expand Down Expand Up @@ -114,7 +115,7 @@ jobs:
- name: Update deployment file with image
run: sed -i 's|<IMAGE>|'${DOCKER_IMAGE}'|' $GITHUB_WORKSPACE/agent/k8s/base/deployment.yaml
- name: Write secrets file
run: $GITHUB_WORKSPACE/scripts/properties_from_env.sh PREFECT_API_KEY PREFECT_API_URL AWS_SECRET_ACCESS_KEY AWS_ACCESS_KEY_ID PREFECT_POOL WEB3_INFURA_PROJECT_ID > $GITHUB_WORKSPACE/agent/k8s/secret.properties
run: $GITHUB_WORKSPACE/scripts/properties_from_env.sh PREFECT_API_KEY PREFECT_API_URL AWS_SECRET_ACCESS_KEY AWS_ACCESS_KEY_ID PREFECT_POOL WEB3_INFURA_PROJECT_ID GRAPH_API_KEY > $GITHUB_WORKSPACE/agent/k8s/secret.properties
- name: Save DigitalOcean kubeconfig with short-lived credentials
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 ${{ secrets.DIGITALOCEAN_CLUSTER_NAME }}
- name: Deploy to DigitalOcean Kubernetes
Expand Down
5 changes: 5 additions & 0 deletions agent/k8s/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,8 @@ spec:
secretKeyRef:
name: data-pipelines-secrets
key: WEB3_INFURA_PROJECT_ID
- name: GRAPH_API_KEY
valueFrom:
secretKeyRef:
name: data-pipelines-secrets
key: GRAPH_API_KEY
59 changes: 41 additions & 18 deletions flows/constants.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,44 @@
CARBON_SUBGRAPH_URL = (
"https://api.thegraph.com/subgraphs/name/klimadao/polygon-digital-carbon"
)
CARBON_LEGACY_SUBGRAPH_URL = (
"https://api.thegraph.com/subgraphs/name/klimadao/polygon-bridged-carbon"
)
CARBON_ETH_SUBGRAPH_URL = (
"https://api.thegraph.com/subgraphs/name/klimadao/ethereum-bridged-carbon"
)
CARBON_CELO_SUBGRAPH_URL = (
"https://api.thegraph.com/subgraphs/name/klimadao/celo-bridged-carbon"
)
CARBON_HOLDERS_SUBGRAPH_URL = (
"https://api.thegraph.com/subgraphs/name/klimadao/klimadao-user-carbon"
)
PAIRS_SUBGRAPH_URL = (
"https://api.thegraph.com/subgraphs/name/klimadao/klimadao-pairs"
)
import os

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'

CARBON_SG_ID = 'ECLEwJKgujmiRCW1XbfbbUbpae2igeHa2KJ6BXNSWrZF'
CARBON_LEGACY_SG_ID = '9skh5pMQGRdyJcBe8PjWdDjLoYqoYTMLRDpFh6acSHUu'
CARBON_ETH_SG_ID = 'A3dewmSVoxFvvyaMQUJFQHDg3cF8ageeq3hXHnMgs3kp'
CARBON_CELO_SG_ID = 'H5UMmbFgxE73i8s445cRuSx5bg7AUUrsKdtBBCQfinYX'
CARBON_HOLDERS_SG_ID = 'BJFQSmoqffMD8e1pN9xdsuRDYQNgVs8z3DBiXa6AdkGY'
PAIRS_SG_ID = 'hwk9GJd5cf5EASZRxQZJ56KocpYt7tNDtho9HZwN6rL'

if os.environ.get('ENV') == 'production':
CARBON_SUBGRAPH_URL = GRAPH_BASE_URL + CARBON_SG_ID
CARBON_LEGACY_SUBGRAPH_URL = GRAPH_BASE_URL + CARBON_LEGACY_SG_ID
CARBON_ETH_SUBGRAPH_URL = GRAPH_BASE_URL + CARBON_ETH_SG_ID
CARBON_CELO_SUBGRAPH_URL = GRAPH_BASE_URL + CARBON_CELO_SG_ID
CARBON_HOLDERS_SUBGRAPH_URL = GRAPH_BASE_URL + CARBON_HOLDERS_SG_ID
PAIRS_SUBGRAPH_URL = GRAPH_BASE_URL + PAIRS_SG_ID

else:
CARBON_SUBGRAPH_URL = (
GRAPH_DEV_BASE_URL + "staging-polygon-digital-carbon" + GRAPH_VERSION_SUFFIX
)
CARBON_LEGACY_SUBGRAPH_URL = (
GRAPH_DEV_BASE_URL + "staging-polygon-bridged-carbon" + GRAPH_VERSION_SUFFIX
)
CARBON_ETH_SUBGRAPH_URL = (
GRAPH_DEV_BASE_URL + "staging-ethereum-bridged-carbon" + GRAPH_VERSION_SUFFIX
)
CARBON_CELO_SUBGRAPH_URL = (
GRAPH_DEV_BASE_URL + "staging-celo-bridged-carbon" + GRAPH_VERSION_SUFFIX
)
CARBON_HOLDERS_SUBGRAPH_URL = (
GRAPH_DEV_BASE_URL + "staging-klimadao-user-carbon" + GRAPH_VERSION_SUFFIX
)
PAIRS_SUBGRAPH_URL = (
GRAPH_DEV_BASE_URL + "staging-klimadao-pairs" + GRAPH_VERSION_SUFFIX
)

BCT_ADDRESS = "0x2f800db0fdb5223b3c3f354886d907a671414a7f"
NCT_ADDRESS = "0xd838290e877e0188a4a44700463419ed96c16107"
Expand Down

0 comments on commit c012cf1

Please sign in to comment.