CronJob - Scroll Mainnet #415
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
name: CronJob - Scroll Mainnet | |
on: | |
schedule: | |
- cron: "5 */1 * * *" # “At minute 5 past every hour” | |
push: | |
env: | |
CHAIN_ID: 534352 | |
PRIZE_POOL_ADDRESS: "0xa6ecd65c3eecdb59c2f74956ddf251ab5d899845" | |
OUTPUT_DIRECTORY_NAME: "winners/vaultAccounts" | |
CLI_VERSION: "2.0.2" | |
JSON_RPC_URL: ${{ secrets.SCROLL_MAINNET_RPC_URL }} | |
CONTRACT_JSON_URL: 'https://raw.githubusercontent.com/GenerationSoftware/pt-v5-mainnet/196aa20f4a0b3e651d0504ffeb0e1b9a08c7ccb6/deployments/scroll/contracts.json' | |
SUBGRAPH_URL: 'https://api.studio.thegraph.com/query/63100/pt-v5-scroll/version/latest' | |
NODE_OPTIONS: "--max_old_space_size=32768" | |
MULTICALL_ADDRESS: '0xcA11bde05977b3631167028862bE2a173976CA11' | |
PRIZE_TIERS_TO_COMPUTE: 0,1,2,3,4,5 | |
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 }} | |
# -------------------------------------------------------- # | |
# Scroll Mainnet | |
# -------------------------------------------------------- # | |
# 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: Scroll Mainnet - Compile Winners | |
id: compileWinnersScroll | |
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 }} -m ${{ env.MULTICALL_ADDRESS }} | |
# 3. Commit | |
- name: Commit Scroll Mainnet | |
if: steps.compileWinnersScroll.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 mainnet winner results for Scroll Mainnet draw #${{ steps.compileWinnersScroll.outputs.drawId }}" | |
# 4. Push | |
- name: Push changes (if required) | |
uses: ad-m/github-push-action@master | |
if: steps.compileWinnersScroll.outputs.runStatus == 'true' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
force: true |