Skip to content

Commit 091139f

Browse files
committed
feat: enhance account management by adding support for ADMIN_PRIVATE_KEY in Hardhat configuration and DataProtectorSharingModule
1 parent 7ed7f2e commit 091139f

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

packages/sharing-smart-contract/hardhat.config.cjs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,19 @@ module.exports = {
3535
bellecour: {
3636
...bellecourBase,
3737
url: 'https://bellecour.iex.ec',
38-
accounts: env.DEPLOYER_PRIVATE_KEY ? [env.DEPLOYER_PRIVATE_KEY] : [],
38+
accounts: [
39+
...(env.DEPLOYER_PRIVATE_KEY ? [env.DEPLOYER_PRIVATE_KEY] : []),
40+
...(env.ADMIN_PRIVATE_KEY ? [env.ADMIN_PRIVATE_KEY] : []),
41+
].filter(Boolean),
3942
},
4043
avalancheFujiTestnet: {
4144
chainId: 43113,
4245
url: env.RPC_URL || 'https://api.avax-test.network/ext/bc/C/rpc',
4346
accounts: [
4447
env.DEPLOYER_PRIVATE_KEY ||
4548
'0x0000000000000000000000000000000000000000000000000000000000000000',
46-
],
49+
...(env.ADMIN_PRIVATE_KEY ? [env.ADMIN_PRIVATE_KEY] : []),
50+
].filter(Boolean),
4751
blockGasLimit: 8_000_000,
4852
},
4953
arbitrumSepolia: {
@@ -52,13 +56,17 @@ module.exports = {
5256
accounts: [
5357
env.DEPLOYER_PRIVATE_KEY ||
5458
'0x0000000000000000000000000000000000000000000000000000000000000000',
55-
],
59+
...(env.ADMIN_PRIVATE_KEY ? [env.ADMIN_PRIVATE_KEY] : []),
60+
].filter(Boolean),
5661
blockGasLimit: 30_000_000,
5762
},
5863
arbitrum: {
5964
chainId: 42161,
6065
url: env.RPC_URL || 'https://arb1.arbitrum.io/rpc',
61-
accounts: env.DEPLOYER_PRIVATE_KEY ? [env.DEPLOYER_PRIVATE_KEY] : [],
66+
accounts: [
67+
...(env.DEPLOYER_PRIVATE_KEY ? [env.DEPLOYER_PRIVATE_KEY] : []),
68+
...(env.ADMIN_PRIVATE_KEY ? [env.ADMIN_PRIVATE_KEY] : []),
69+
].filter(Boolean),
6270
blockGasLimit: 30_000_000,
6371
},
6472
// poco-chain native config

packages/sharing-smart-contract/ignition/modules/DataProtectorSharingModule.cjs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ const env = require('../../config/env.cjs');
1111

1212
// @ts-ignore
1313
module.exports = buildModule('DataProtectorSharingModule', (m) => {
14-
// Use admin private key if provided, otherwise fall back to the first account
15-
const proxyAdminOwner = env.ADMIN_PRIVATE_KEY
16-
? m.getAccount(env.ADMIN_PRIVATE_KEY)
17-
: m.getAccount(0);
14+
// Use admin account if provided (index 1), otherwise fall back to deployer account (index 0)
15+
const proxyAdminOwner = env.ADMIN_PRIVATE_KEY ? m.getAccount(1) : m.getAccount(0);
1816
const pocoAddress = env.POCO_ADDRESS || defaultPocoAddress;
1917
const datasetRegistryAddress = env.DATASET_REGISTRY_ADDRESS || defaultDatasetRegistryAddress;
2018

0 commit comments

Comments
 (0)