Skip to content

Commit

Permalink
chore: test ci
Browse files Browse the repository at this point in the history
Signed-off-by: nikolay <[email protected]>
  • Loading branch information
natanasow committed Feb 4, 2025
1 parent a307013 commit 8388f54
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 0 deletions.
114 changes: 114 additions & 0 deletions .github/workflows/update-hedera-response-codes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Update HederaResponseCodes contract

jobs:
update:
name: Index ERC Contracts on Hedera ${{ github.event.inputs.HEDERA_NETWORK }} and Update Registry
runs-on: smart-contracts-linux-large

steps:
- name: Harden Runner
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
egress-policy: audit

- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive

- name: Use Node.js [20]
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version: 20

- name: Install Dependencies
run: |
cd ${{env.INDEXER_PATH}}
npm install
- uses: actions/checkout@v4
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3

- name: Import GPG Key
id: gpg_importer
uses: step-security/ghaction-import-gpg@6c8fe4d0126a59d57c21f87c9ae5dd3451fa3cca # v6.1.0
with:
git_commit_gpgsign: true
git_tag_gpgsign: true
git_user_signingkey: true
gpg_private_key: ${{ secrets.GPG_KEY_CONTENTS }}
passphrase: ${{ secrets.GPG_KEY_PASSPHRASE }}

- name: Get Current Date
id: current_date
run: echo "CURRENT_DATE=$(date -u +"%m-%d-%Y")" >> $GITHUB_ENV

- name: Create Pull Request Target hedera-smart-contracts Repository
uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7.0.6
with:
branch: ERC-Registry-Periodical-Update/${{ github.run_id }}
commit-message: 'chore: update ERC Registry with latest ERC-20, ERC-721, and ERC-1155 tokens on Hedera ${{github.event.inputs.HEDERA_NETWORK}}'
committer: ${{ steps.gpg_importer.outputs.name }} <${{ steps.gpg_importer.outputs.email }}>
author: ${{ steps.gpg_importer.outputs.name }} <${{ steps.gpg_importer.outputs.email }}>
token: ${{ secrets.GH_ACCESS_TOKEN }}
delete-branch: true
signoff: true
title: 'chore: update ERC Registry with latest ERC-20, ERC-721, and ERC-1155 tokens on Hedera ${{github.event.inputs.HEDERA_NETWORK}}'
body: >
**Description**:
This PR updates the ERC Registry to include the most recent ERC-20, ERC-721, and ERC-1155 tokens.
**Registry Update Summary**:
- **Hedera Network**: ${{ github.event.inputs.HEDERA_NETWORK }}
- **New ERC-20 Records Added**: ${{ env.NEW_ERC20_RECORDS }}
- **New ERC-721 Records Added**: ${{ env.NEW_ERC721_RECORDS }}
- **New ERC-1155 Records Added**: ${{ env.NEW_ERC1155_RECORDS }}
- **Indexing Duration**: ${{ env.INDEXING_DURATION }}
- **Last Indexed Time**: ${{ env.CURRENT_DATE }}
labels: 'internal'
assignees: 'swirlds-automation'

- name: Backup erc-registry to Temporary Directory
run: |
mkdir -p /tmp/erc-registry/${{ github.event.inputs.HEDERA_NETWORK }}
cp -r ${{ env.INDEXER_PATH }}/erc-registry/${{ github.event.inputs.HEDERA_NETWORK }}/* /tmp/erc-registry/${{ github.event.inputs.HEDERA_NETWORK }}
- name: Checkout hedera-mirror-node-explorer
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive
repository: hashgraph/hedera-mirror-node-explorer
token: ${{ secrets.GH_ACCESS_TOKEN_MIRROR_NODE_EXPLORER }}

- name: Restore erc-registry from Temporary Directory
run: |
mkdir -p ./erc-registry/${{ github.event.inputs.HEDERA_NETWORK }}
cp -r /tmp/erc-registry/${{ github.event.inputs.HEDERA_NETWORK }}/* ./public/${{ github.event.inputs.HEDERA_NETWORK }}
- name: Create Pull Request Target hedera-mirror-node-explorer
uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7.0.6
with:
branch: ERC-Registry-Periodical-Update/${{ github.run_id }}
commit-message: 'chore: update ERC Registry with latest ERC-20, ERC-721, and ERC-1155 tokens on Hedera ${{github.event.inputs.HEDERA_NETWORK}}'
committer: ${{ steps.gpg_importer.outputs.name }} <${{ steps.gpg_importer.outputs.email }}>
author: ${{ steps.gpg_importer.outputs.name }} <${{ steps.gpg_importer.outputs.email }}>
token: ${{ secrets.GH_ACCESS_TOKEN_MIRROR_NODE_EXPLORER }}
delete-branch: true
signoff: true
title: 'chore: update ERC Registry with latest ERC-20, ERC-721, and ERC-1155 tokens on Hedera ${{github.event.inputs.HEDERA_NETWORK}}'
body: >
**Description**:
This PR updates the ERC Registry to include the most recent ERC-20, ERC-721, and ERC-1155 tokens.
**Registry Update Summary**:
- **Hedera Network**: ${{ github.event.inputs.HEDERA_NETWORK }}
- **New ERC-20 Records Added**: ${{ env.NEW_ERC20_RECORDS }}
- **New ERC-721 Records Added**: ${{ env.NEW_ERC721_RECORDS }}
- **New ERC-1155 Records Added**: ${{ env.NEW_ERC1155_RECORDS }}
- **Indexing Duration**: ${{ env.INDEXING_DURATION }}
- **Last Indexed Time**: ${{ env.CURRENT_DATE }}
labels: 'internal'
assignees: 'swirlds-automation'
23 changes: 23 additions & 0 deletions utils/protobuf-parser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const hederaProto = require('@hashgraph/proto');
const fs = require('fs');
const shell = require('shelljs');

async function main() {
let hederaResponseCodeContract =
'// SPDX-License-Identifier: Apache-2.0\n' +
'pragma solidity >=0.4.9 <0.9.0;\n' +
'\n// this contract is auto-generated by a manual triggered script in utils/protobuf-parser.js' +
'\n// documentation for each code can be found here https://github.com/hashgraph/hedera-services/blob/main/hapi/hedera-protobufs/services/response_code.proto\n\n' +
'library HederaResponseCodes {\n';

for (const [name, code] of Object.entries(hederaProto.proto.ResponseCodeEnum)) {
hederaResponseCodeContract += ` int32 internal constant ${name} = ${code};\n`;
}

hederaResponseCodeContract += '}\n';

fs.writeFileSync('./contracts/system-contracts/HederaResponseCodes.sol', hederaResponseCodeContract);
shell.exec('npx hardhat compile');
}

main();

0 comments on commit 8388f54

Please sign in to comment.