Set Block #223
This file contains hidden or 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
| # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
| # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
| name: Set Block | |
| on: | |
| schedule: | |
| # TODO: The cron job should run every alternate Friday at 11 UTC(New staking interval starts at 10:28:15 UTC) | |
| - cron: "30 10 * * FRI" | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Setup node.js | |
| uses: actions/setup-node@v1 | |
| with: | |
| node-version: "14.x" | |
| - name: Cache node modules | |
| uses: actions/cache@v4 | |
| env: | |
| cache-name: cache-node-modules | |
| with: | |
| # npm cache files are stored in `~/.npm` on Linux/macOS | |
| path: ~/.npm | |
| key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-build-${{ env.cache-name }}- | |
| ${{ runner.os }}-build- | |
| ${{ runner.os }}- | |
| - name: Cache compiler installations | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.solcx | |
| ~/.vvm | |
| key: ${{ runner.os }}-compiler-cache | |
| # - name: Set pip cache directory path | |
| # id: pip-cache-dir-path | |
| # run: | | |
| # echo "::set-output name=dir::$(pip cache dir)" | |
| # - name: Restore pip cache | |
| # uses: actions/cache@v4 | |
| # id: pip-cache | |
| # with: | |
| # path: | | |
| # ${{ steps.pip-cache-dir-path.outputs.dir }} | |
| # key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
| # restore-keys: | | |
| # ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
| # ${{ runner.os }}-pip- | |
| - name: Setup Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: "3.10" | |
| - name: Install python dependencies | |
| run: | | |
| pip install --upgrade pip | |
| pip install -r requirements.txt && brownie pm install OpenZeppelin/[email protected] | |
| - name: Patch py-solc-x to use GitHub releases | |
| run: | | |
| python3 << 'EOF' | |
| import os | |
| import site | |
| # Find py-solc-x install location | |
| site_packages = site.getsitepackages()[0] | |
| install_file = os.path.join(site_packages, "solcx", "install.py") | |
| # Read the file | |
| with open(install_file, 'r') as f: | |
| content = f.read() | |
| # Replace the blocked URL with GitHub releases | |
| # Old py-solc-x 1.1.1 uses solc-bin.ethereum.org | |
| content = content.replace( | |
| 'SOLC_BASE_URL = "https://solc-bin.ethereum.org/"', | |
| 'SOLC_BASE_URL = "https://binaries.soliditylang.org/"' | |
| ) | |
| content = content.replace( | |
| '"https://solc-bin.ethereum.org/"', | |
| '"https://binaries.soliditylang.org/"' | |
| ) | |
| content = content.replace( | |
| 'solc-bin.ethereum.org', | |
| 'binaries.soliditylang.org' | |
| ) | |
| # Write back | |
| with open(install_file, 'w') as f: | |
| f.write(content) | |
| print("✓ Patched py-solc-x to use binaries.soliditylang.org") | |
| EOF | |
| - name: Set Block | |
| run: echo $REWARDS_CRON && brownie networks import network-config.yaml true && brownie run scripts/contractInteraction/setBlock_cron.py --network=rsk-mainnet | |
| env: | |
| REWARDS_CRON: 1 | |
| FEE_CLAIMER: ${{secrets.FEE_CLAIMER}} |