Skip to content

Create ERC20 Transfer Payload #11

Create ERC20 Transfer Payload

Create ERC20 Transfer Payload #11

name: Create ERC20 Transfer Payload
on:
workflow_dispatch:
inputs:
token:
description: 'Token'
required: true
destination:
description: 'Destination Address(or unqiue addrbook string)'
required: true
whole_amount:
description: 'Whole Amount (provide either whole_amount or wei_amount)'
required: false
wei_amount:
description: 'Wei Amount'
required: false
multisig:
description: 'Source Multisig Address (or unique addrbook string)'
required: true
chain_name:
description: 'Chain Name. Exists in bal_addresses: One of [base, gnosis, zkevm, avalanche, mainnet, arbitrum, optimism, polygon, sepolia]'
required: true
jobs:
erc20-transfer:
runs-on: ubuntu-latest
outputs:
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
pull-request-branch: ${{ steps.generate-branch-name.outputs.branch }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
pip install git+https://github.com/BalancerMaxis/[email protected]
- name: Run script
run: |
cd action-scripts
python tx_build_erc20_transfer.py
env:
TOKEN: ${{ github.event.inputs.token }}
DESTINATION: ${{ github.event.inputs.destination }}
WHOLE_AMOUNT: ${{ github.event.inputs.whole_amount }}
WEI_AMOUNT: ${{ github.event.inputs.wei_amount }}
MULTISIG: ${{ github.event.inputs.multisig }}
CHAIN_NAME: ${{ github.event.inputs.chain_name }}
INFURA_KEY: ${{ secrets.INFURA_KEY }}
ALCHEMY_KEY: ${{ secrets.ALCHEMY_KEY }}
- name: Prepare PR title and body
run: |
echo "PR_TITLE=Transfer of $TOKEN to $DESTINATION on $CHAIN_NAME" >> $GITHUB_ENV
echo "PR_BODY=Automatically generated payload to transfer funds. See report that will be generated by CI/CD below. If no report, check action, something is wrong" >> $GITHUB_ENV
env:
TOKEN: ${{ github.event.inputs.token }}
DESTINATION: ${{ github.event.inputs.destination }}
CHAIN_NAME: ${{ github.event.inputs.chain_name }}
- name: Generate branch name
id: generate-branch-name
run: |
echo "::set-output name=branch::${{ github.job }}-$(date +'%Y%m%d%H%M%S')"
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v6
with:
title: ${{ env.PR_TITLE }}
body: ${{ env.PR_BODY }}
branch: ${{ steps.generate-branch-name.outputs.branch }}
labels: "Automatic Payload"
delete-branch: true
run_reports:
needs: erc20-transfer
uses: "BalancerMaxis/multisig-ops/.github/workflows/run_reports_reusable.yaml@main"
with:
pr_number: ${{ needs.erc20-transfer.outputs.pull-request-number }}
checkout_ref: ${{ needs.erc20-transfer.outputs.pull-request-branch }}