Skip to content

Commit c47f370

Browse files
committed
Add new chains config
1 parent e7393c7 commit c47f370

File tree

3 files changed

+36
-9
lines changed

3 files changed

+36
-9
lines changed

packages/sharing-smart-contract/.env.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# wallet used for transactions
2-
WALLET_PRIVATE_KEY=...
2+
PRIVATE_KEY=...
33

44
# environment to use for configuration (prod/staging). The default is prod.
55
ENV=...

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// Hardhat Ignition does not support ESM modules, so we use CommonJS syntax.
22
// TODO refactor this to use ESM syntax when Hardhat Ignition supports it.
33

4-
require('dotenv/config.js');
4+
require('dotenv/config');
55
const { z } = require('zod');
66

77
const addressRegex = /(^|\b)(0x)?[0-9a-fA-F]{64}(\b|$)/;
88
const privateKeyRegex = /(^|\b)(0x)?[0-9a-fA-F]{64}(\b|$)/;
99

1010
const envSchema = z.object({
1111
// Private key of the wallet used for transactions
12-
WALLET_PRIVATE_KEY: z
12+
PRIVATE_KEY: z
1313
.string()
1414
.regex(privateKeyRegex, 'Invalid private key format')
1515
.optional()
@@ -37,6 +37,13 @@ const envSchema = z.object({
3737

3838
// Mnemonic for deployment or network interaction
3939
MNEMONIC: z.string().min(1, 'MNEMONIC cannot be empty').optional().or(z.literal('')),
40+
41+
FUJI_RPC_URL: z.string().url('FUJI_RPC_URL must be a valid URL').optional(),
42+
43+
ARBITRUM_SEPOLIA_RPC_URL: z
44+
.string()
45+
.url('ARBITRUM_SEPOLIA_RPC_URL must be a valid URL')
46+
.optional(),
4047
});
4148

4249
module.exports = {

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

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ require('@openzeppelin/hardhat-upgrades');
44
require('hardhat-contract-sizer');
55
require('@openzeppelin/hardhat-upgrades');
66
require('hardhat-dependency-compiler');
7-
require('dotenv').config();
7+
const env = require('./config/env.cjs');
88

99
// TODO format
1010

11-
const { WALLET_PRIVATE_KEY } = process.env;
12-
1311
const bellecourBase = {
1412
gasPrice: 0,
1513
blockGasLimit: 6_700_000,
@@ -37,14 +35,36 @@ module.exports = {
3735
bellecour: {
3836
...bellecourBase,
3937
url: 'https://bellecour.iex.ec',
40-
accounts: WALLET_PRIVATE_KEY ? [WALLET_PRIVATE_KEY] : [],
38+
accounts: env.PRIVATE_KEY ? [env.PRIVATE_KEY] : [],
39+
},
40+
avalancheFujiTestnet: {
41+
chainId: 43113,
42+
url: env.FUJI_RPC_URL || 'https://api.avax-test.network/ext/bc/C/rpc',
43+
accounts: [
44+
env.PRIVATE_KEY ||
45+
'0x0000000000000000000000000000000000000000000000000000000000000000',
46+
],
47+
blockGasLimit: 8_000_000,
48+
},
49+
arbitrumSepolia: {
50+
chainId: 421614,
51+
url: env.ARBITRUM_SEPOLIA_RPC_URL || 'https://sepolia-rollup.arbitrum.io/rpc',
52+
accounts: [
53+
process.env.PRIVATE_KEY ||
54+
'0x0000000000000000000000000000000000000000000000000000000000000000',
55+
],
56+
blockGasLimit: 30_000_000,
57+
},
58+
'local-bellecour-fork': {
59+
...bellecourBase,
60+
url: 'http://127.0.0.1:8545',
4161
},
4262
// poco-chain native config
4363
'dev-native': {
4464
chainId: 65535,
45-
url: process.env.RPC_URL ?? 'http://localhost:8545',
65+
url: env.RPC_URL ?? 'http://localhost:8545',
4666
accounts: {
47-
mnemonic: process.env.MNEMONIC ?? '',
67+
mnemonic: env.MNEMONIC ?? '',
4868
},
4969
gasPrice: 0,
5070
},

0 commit comments

Comments
 (0)