Skip to content

Commit dd148fe

Browse files
feat: add github action workflow for setting callback (#274)
1 parent 8e32319 commit dd148fe

File tree

3 files changed

+66
-10
lines changed

3 files changed

+66
-10
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Set Callback Gas
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
network:
7+
description: 'Network'
8+
required: true
9+
type: choice
10+
options:
11+
- arbitrumSepolia
12+
- arbitrum
13+
- bellecour
14+
default: 'arbitrumSepolia'
15+
callback_gas-value:
16+
description: 'Callback Gas Value'
17+
required: true
18+
type: string
19+
20+
jobs:
21+
set-callback-gas:
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: read
25+
environment: ${{ inputs.network }} # Use the selected environment
26+
steps:
27+
- name: Validate callback gas input
28+
run: |
29+
if ! [[ "${{ inputs.callback_gas-value }}" =~ ^[0-9]+$ ]]; then
30+
echo "Error: Callback gas must be a positive integer"
31+
exit 1
32+
fi
33+
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
37+
- name: Set up Nodejs
38+
uses: actions/setup-node@v4
39+
with:
40+
node-version: 20
41+
cache: 'npm' # Cache dependencies
42+
43+
- name: Install dependencies
44+
run: npm ci
45+
46+
- name: Build
47+
run: npm run build
48+
49+
- name: Set callback gas on ${{ inputs.network }}
50+
env:
51+
ADMIN_PRIVATE_KEY: ${{ secrets.ADMIN_PRIVATE_KEY }}
52+
RPC_URL: ${{ secrets.RPC_URL }}
53+
CALLBACK_GAS: ${{ inputs.callback_gas-value }}
54+
run: npx hardhat run scripts/set-callback-gas.ts --network ${{ inputs.network }}

hardhat.config.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import '@nomicfoundation/hardhat-toolbox';
22
import 'dotenv/config';
33
import * as fs from 'fs';
4-
import * as path from 'path';
54
import 'hardhat-dependency-compiler';
65
import 'hardhat-deploy';
76
import { HardhatUserConfig, task } from 'hardhat/config';
@@ -10,10 +9,12 @@ import {
109
defaultHardhatNetworkParams,
1110
defaultLocalhostNetworkParams,
1211
} from 'hardhat/internal/core/config/default-config';
12+
import * as path from 'path';
1313
import 'solidity-docgen';
1414
import { cleanupDeployments, copyDeployments } from './scripts/tools/copy-deployments';
1515
import chainConfig from './utils/config';
1616

17+
const ZERO_PRIVATE_KEY = '0x0000000000000000000000000000000000000000000000000000000000000000';
1718
const isNativeChainType = chainConfig.isNativeChain();
1819
const isLocalFork = process.env.LOCAL_FORK == 'true';
1920
const isFujiFork = process.env.FUJI_FORK == 'true';
@@ -178,8 +179,8 @@ const config: HardhatUserConfig = {
178179
process.env.RPC_URL || // Defined in Github Actions environments
179180
'https://api.avax-test.network/ext/bc/C/rpc',
180181
accounts: [
181-
process.env.DEPLOYER_PRIVATE_KEY ||
182-
'0x0000000000000000000000000000000000000000000000000000000000000000',
182+
process.env.DEPLOYER_PRIVATE_KEY || ZERO_PRIVATE_KEY,
183+
process.env.ADMIN_PRIVATE_KEY || ZERO_PRIVATE_KEY,
183184
],
184185
...fujiBaseConfig,
185186
},
@@ -189,8 +190,8 @@ const config: HardhatUserConfig = {
189190
process.env.RPC_URL || // Defined in Github Actions environments
190191
'https://arbitrum.gateway.tenderly.co',
191192
accounts: [
192-
process.env.DEPLOYER_PRIVATE_KEY ||
193-
'0x0000000000000000000000000000000000000000000000000000000000000000',
193+
process.env.DEPLOYER_PRIVATE_KEY || ZERO_PRIVATE_KEY,
194+
process.env.ADMIN_PRIVATE_KEY || ZERO_PRIVATE_KEY,
194195
],
195196
...arbitrumBaseConfig,
196197
},
@@ -200,17 +201,17 @@ const config: HardhatUserConfig = {
200201
process.env.RPC_URL || // Defined in Github Actions environments
201202
'https://sepolia-rollup.arbitrum.io/rpc',
202203
accounts: [
203-
process.env.DEPLOYER_PRIVATE_KEY ||
204-
'0x0000000000000000000000000000000000000000000000000000000000000000',
204+
process.env.DEPLOYER_PRIVATE_KEY || ZERO_PRIVATE_KEY,
205+
process.env.ADMIN_PRIVATE_KEY || ZERO_PRIVATE_KEY,
205206
],
206207
...arbitrumSepoliaBaseConfig,
207208
},
208209
bellecour: {
209210
chainId: 134,
210211
url: 'https://bellecour.iex.ec',
211212
accounts: [
212-
process.env.DEPLOYER_PRIVATE_KEY ||
213-
'0x0000000000000000000000000000000000000000000000000000000000000000',
213+
process.env.DEPLOYER_PRIVATE_KEY || ZERO_PRIVATE_KEY,
214+
process.env.ADMIN_PRIVATE_KEY || ZERO_PRIVATE_KEY,
214215
],
215216
...bellecourBaseConfig,
216217
verify: {

scripts/set-callback-gas.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ import config from '../utils/config';
1919
throw new Error('Diamond proxy address is required');
2020
}
2121
console.log(`Diamond proxy address: ${proxyAddress}`);
22-
const [owner] = await ethers.getSigners();
22+
// TODO: update here to use getNamedAccounts
23+
const [, owner] = await ethers.getSigners();
2324
const iexecPoCo = IexecInterfaceToken__factory.connect(proxyAddress, owner);
2425
if ((await iexecPoCo.owner()) !== owner.address) {
2526
throw new Error(`Sender account ${owner.address} is not the PoCo owner.`);

0 commit comments

Comments
 (0)