-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1169 from BalancerMaxis/issue/1120
feat: query upkeeps from dune
- Loading branch information
Showing
2 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Query all Chainlink upkeeps | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
|
||
jobs: | ||
query_upkeeps: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.10 | ||
cache: "pip" | ||
|
||
- name: Query Dune | ||
env: | ||
DUNE_API_KEY: ${{ secrets.DUNE_API_KEY }} | ||
run: | | ||
pwd | ||
RUN_DIR=tools/python | ||
pip install -r $RUN_DIR/requirements.txt | ||
python $RUN_DIR/query_upkeeps.py | ||
- name: Commit and push reports | ||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_message: "ci: dump csv file with all queried upkeeps" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import pandas as pd | ||
from dune_client.client import DuneClient | ||
from dune_client.types import QueryParameter | ||
from dune_client.query import QueryBase | ||
|
||
|
||
def get_upkeeps(chain="ethereum"): | ||
dune = DuneClient.from_env() | ||
query = QueryBase( | ||
name="@gosuto/cla_chain_upkeeps", | ||
query_id=3889683, | ||
params=[ | ||
QueryParameter.enum_type(name="chain", value=chain), | ||
], | ||
) | ||
return dune.run_query_dataframe(query) | ||
|
||
|
||
if __name__ == "__main__": | ||
dfs = [] | ||
for chain in [ | ||
"ethereum", | ||
"arbitrum", | ||
"polygon", | ||
"optimism", | ||
"avalanche", | ||
"base", | ||
"gnosis", | ||
]: | ||
dfs.append(get_upkeeps(chain)) | ||
pd.concat(dfs).to_csv("../../out/upkeeps.csv", index=False) |