Skip to content

Commit

Permalink
DKG initiation workflow definition for GitHub Actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
KPrasch committed Sep 24, 2024
1 parent 27f0f4c commit f10d8f5
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/scripts/import_account.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env python3

import os

from ape_accounts import import_account_from_private_key


def main():
try:
passphrase = os.environ["DKG_INITIATOR_PASSPHRASE"]
private_key = os.environ["DKG_INITIATOR_PRIVATE_KEY"]
except KeyError:
raise Exception(
"There are missing environment variables."
"Please set DKG_INITIATOR_PASSPHRASE and DKG_INITIATOR_PRIVATE_KEY."
)
account = import_account_from_private_key(
'AUTOMATION',
passphrase,
private_key
)
print(f"Account imported: {account.address}")


if __name__ == '__main__':
main()
11 changes: 11 additions & 0 deletions .github/scripts/initiate_ritual.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ape run initiate_ritual \
--autosign \
--account AUTOMATION \
--network polygon:mainnet:${RPC_PROVIDER} \
--domain mainnet \
--duration 86400 \
--access-controller GlobalAllowList \
--fee-model FreeFeeModel \
--authority ${DKG_AUTHORITY_ADDRESS} \
--min-version ${MIN_VERSION} \
--num-nodes 30
40 changes: 40 additions & 0 deletions .github/workflows/dkg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Heartbeat DKG

on:
schedule:
- cron: '0 0 * * *'

jobs:
initiate_dkg:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install dependencies
run: |
pip3 install eth-ape ape-infura ape-polygon ape-etherscan
pip3 install -e .
- name: Import Ape Account
run: .github/scripts/import_account.py
env:
DKG_INITIATOR_PRIVATE_KEY: ${{ secrets.DKG_INITIATOR_PRIVATE_KEY }}
DKG_INITIATOR_PASSPHRASE: ${{ secrets.DKG_INITIATOR_PASSPHRASE }}

- name: Initiate Ritual
run: .github/scripts/initiate_ritual.sh
env:
DKG_INITIATOR_ADDRESS: ${{ secrets.DKG_INITIATOR_ADDRESS }}
APE_ACCOUNTS_AUTOMATION_PASSPHRASE: ${{ secrets.DKG_INITIATOR_PASSPHRASE }}
DKG_AUTHORITY_ADDRESS: ${{ secrets.DKG_AUTHORITY_ADDRESS }}
RPC_PROVIDER: ${{ secrets.RPC_PROVIDER }}
MIN_VERSION: ${{ secrets.MIN_VERSION }}
WEB3_INFURA_API_KEY: ${{ secrets.WEB3_INFURA_API_KEY }}
POLYGONSCAN_API_KEY: ${{ secrets.POLYGONSCAN_API_KEY }}

0 comments on commit f10d8f5

Please sign in to comment.