Skip to content

CronJob - Optimism Sepolia #1591

CronJob - Optimism Sepolia

CronJob - Optimism Sepolia #1591

name: CronJob - Optimism Sepolia
on:
schedule:
- cron: "5 */6 * * *" # ie. 6:05am, 12:05pm, 6:05pm, etc.
push:
env:
CHAIN_ID: 11155420
PRIZE_POOL_ADDRESS: "0x122feca66c2b1ba8fa9c39e88152592a5496bc99"
OUTPUT_DIRECTORY_NAME: "winners/vaultAccounts"
CLI_VERSION: "2.0.0"
JSON_RPC_URL: ${{ secrets.OPTIMISM_SEPOLIA_RPC_URL }}
CONTRACT_JSON_URL: 'https://raw.githubusercontent.com/GenerationSoftware/pt-v5-testnet/993c1f75b8b19826195f44c197be6928a213863d/deployments/optimismSepolia/contracts.json'
SUBGRAPH_URL: 'https://api.studio.thegraph.com/query/63100/pt-v5-op-sepolia/version/latest'
NODE_OPTIONS: "--max_old_space_size=32768"
permissions: write-all
jobs:
runCLI:
name: Winners Compute
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 1
matrix:
node: ["20.11.1"]
os: [ubuntu-latest]
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
submodules: recursive
- name: Use Node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
# -------------------------------------------------------- #
# Optimism Sepolia
# -------------------------------------------------------- #
# 1. Install
- name: Install PoolTogether V5 CLI
run: |
npm install -g @generationsoftware/pt-v5-cli@${{ env.CLI_VERSION }}
echo "$(npm -g bin)" >> $GITHUB_PATH
# 2. Find depositors, winners, and output them for each vault to JSON files
- name: Optimism Sepolia - Compile Winners
id: compileWinnersOptimism
uses: chuckbergeron/executable-wrapper@e19cd743c8f0c6af006f6a25bd6715c770569d72
continue-on-error: true
with:
run_command: ptv5 utils compileWinners -o ./${{ env.OUTPUT_DIRECTORY_NAME }} -p ${{ env.PRIZE_POOL_ADDRESS }} -c ${{ env.CHAIN_ID }} -j ${{ env.CONTRACT_JSON_URL }} -s ${{ env.SUBGRAPH_URL }}
# 3. Commit
- name: Commit Optimism Sepolia
if: steps.compileWinnersOptimism.outputs.runStatus == 'true'
continue-on-error: true
run: |
git config pull.rebase false
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git pull
ls
git add ./${{ env.OUTPUT_DIRECTORY_NAME }}
git commit -m "Add testnet winner results for Optimism Sepolia draw #${{ steps.compileWinnersOptimism.outputs.drawId }}"
# 4. Push
- name: Push changes (if required)
uses: ad-m/github-push-action@master
if: steps.compileWinnersOptimism.outputs.runStatus == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
force: true