CronJob - Base Mainnet #4071
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 - Base Mainnet | |
on: | |
schedule: | |
- cron: "5,35 16-23,0-4 * * *" # “At minute 5 and 35 past every hour from 16 through 23 and every hour from 0 through 4.” | |
push: | |
env: | |
CHAIN_ID: 8453 | |
PRIZE_POOL_ADDRESS: "0x45b2010d8A4f08b53c9fa7544C51dFd9733732cb" | |
OUTPUT_DIRECTORY_NAME: "winners/vaultAccounts" | |
CLI_VERSION: "2.0.6" | |
JSON_RPC_URL: ${{ secrets.BASE_MAINNET_RPC_URL }} | |
CONTRACT_JSON_URL: 'https://raw.githubusercontent.com/GenerationSoftware/pt-v5-mainnet/bc84c3f5e1d9703372ae7f9baf584bab42f47b27/deployments/base/contracts.json' | |
SUBGRAPH_URL: 'https://subgraph.satsuma-prod.com/17063947abe2/g9-software-inc--666267/pt-v5-base/version/v0.0.1/api' | |
REMOTE_STATUS_URL: 'https://raw.githubusercontent.com/GenerationSoftware/pt-v5-winners/refs/heads/main/winners/vaultAccounts' | |
NODE_OPTIONS: "--max_old_space_size=32768" | |
DEBUG: true | |
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 }} | |
# -------------------------------------------------------- # | |
# Base 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: Base Mainnet - Compile Winners | |
id: compileWinnersBase | |
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 }} -r ${{ env.REMOTE_STATUS_URL }} | |
# 3. Commit | |
- name: Commit Base Mainnet | |
if: steps.compileWinnersBase.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 Base Mainnet draw #${{ steps.compileWinnersBase.outputs.drawId }}" | |
# 4. Push | |
- name: Push changes (if required) | |
uses: ad-m/github-push-action@master | |
if: steps.compileWinnersBase.outputs.runStatus == 'true' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
force: true |