Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 29 additions & 38 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ const DEFAULT_ACCOUNTS: any = {
count: 20,
};

const accounts: any = {
...(LEDGER_ACCOUNT
? { ledgerAccounts: [LEDGER_ACCOUNT] }
: {
accounts: PRIVATE_KEY ? [`0x${PRIVATE_KEY}`] : DEFAULT_ACCOUNTS,
}),
};

export default defineConfig({
plugins: [
hardhatToolboxMochaEthers,
Expand Down Expand Up @@ -143,117 +151,101 @@ export default defineConfig({
type: "http",
chainId: 21000,
url: `${PRIVADO_MAINNET_RPC_URL}`,
// accounts: process.env.PRIVATE_KEY ? [`0x${process.env.PRIVATE_KEY}`] : DEFAULT_ACCOUNTS,
ledgerAccounts: [`${LEDGER_ACCOUNT}`],
...accounts,
},
"privado-testnet": {
type: "http",
chainId: 21001,
url: `${PRIVADO_TESTNET_RPC_URL}`,
// accounts: process.env.PRIVATE_KEY ? [`0x${process.env.PRIVATE_KEY}`] : DEFAULT_ACCOUNTS,
ledgerAccounts: [`${LEDGER_ACCOUNT}`],
...accounts,
},
"billions-mainnet": {
type: "http",
chainId: 45056,
url: `${BILLIONS_MAINNET_RPC_URL}`,
// accounts: process.env.PRIVATE_KEY ? [`0x${process.env.PRIVATE_KEY}`] : DEFAULT_ACCOUNTS,
ledgerAccounts: [`${LEDGER_ACCOUNT}`],
...accounts,
},
"billions-testnet": {
type: "http",
chainId: 6913,
url: `${BILLIONS_TESTNET_RPC_URL}`,
// accounts: process.env.PRIVATE_KEY ? [`0x${process.env.PRIVATE_KEY}`] : DEFAULT_ACCOUNTS,
ledgerAccounts: [`${LEDGER_ACCOUNT}`],
...accounts,
},
"polygon-mainnet": {
type: "http",
chainId: 137,
url: `${POLYGON_MAINNET_RPC_URL}`,
// accounts: process.env.PRIVATE_KEY ? [`0x${process.env.PRIVATE_KEY}`] : DEFAULT_ACCOUNTS,
ledgerAccounts: [`${LEDGER_ACCOUNT}`],
...accounts,
},
"polygon-amoy": {
type: "http",
chainId: 80002,
url: `${POLYGON_AMOY_RPC_URL}`,
// accounts: process.env.PRIVATE_KEY ? [`0x${process.env.PRIVATE_KEY}`] : DEFAULT_ACCOUNTS,
ledgerAccounts: [`${LEDGER_ACCOUNT}`],
...accounts,
},
"ethereum-mainnet": {
type: "http",
chainId: 1,
url: `${ETHEREUM_MAINNET_RPC_URL}`,
// accounts: process.env.PRIVATE_KEY ? [`0x${process.env.PRIVATE_KEY}`] : DEFAULT_ACCOUNTS,
ledgerAccounts: [`${LEDGER_ACCOUNT}`],
...accounts,
},
"ethereum-sepolia": {
type: "http",
chainId: 11155111,
url: `${ETHEREUM_SEPOLIA_RPC_URL}`,
// accounts: process.env.PRIVATE_KEY ? [`0x${process.env.PRIVATE_KEY}`] : DEFAULT_ACCOUNTS,
ledgerAccounts: [`${LEDGER_ACCOUNT}`],
...accounts,
},
"zkevm-mainnet": {
type: "http",
chainId: 1101,
url: `${ZKEVM_MAINNET_RPC_URL}`,
// accounts: process.env.PRIVATE_KEY ? [`0x${process.env.PRIVATE_KEY}`] : DEFAULT_ACCOUNTS,
ledgerAccounts: [`${LEDGER_ACCOUNT}`],
...accounts,
},
"zkevm-cardona": {
type: "http",
chainId: 2442,
url: `${ZKEVM_CARDONA_RPC_URL}`,
// accounts: process.env.PRIVATE_KEY ? [`0x${process.env.PRIVATE_KEY}`] : DEFAULT_ACCOUNTS,
ledgerAccounts: [`${LEDGER_ACCOUNT}`],
...accounts,
},
"linea-mainnet": {
type: "http",
chainId: 59144,
url: `${LINEA_MAINNET_RPC_URL}`,
// accounts: process.env.PRIVATE_KEY ? [`0x${process.env.PRIVATE_KEY}`] : DEFAULT_ACCOUNTS,
ledgerAccounts: [`${LEDGER_ACCOUNT}`],
...accounts,
},
"linea-sepolia": {
type: "http",
chainId: 59141,
url: `${LINEA_SEPOLIA_RPC_URL}`,
// accounts: process.env.PRIVATE_KEY ? [`0x${process.env.PRIVATE_KEY}`] : DEFAULT_ACCOUNTS,
ledgerAccounts: [`${LEDGER_ACCOUNT}`],
...accounts,
},
"base-mainnet": {
type: "http",
chainId: 8453,
url: `${BASE_MAINNET_RPC_URL}`,
// accounts: process.env.PRIVATE_KEY ? [`0x${process.env.PRIVATE_KEY}`] : DEFAULT_ACCOUNTS,
ledgerAccounts: [`${LEDGER_ACCOUNT}`],
...accounts,
},
"base-sepolia": {
type: "http",
chainId: 84532,
url: `${BASE_SEPOLIA_RPC_URL}`,
// accounts: process.env.PRIVATE_KEY ? [`0x${process.env.PRIVATE_KEY}`] : DEFAULT_ACCOUNTS,
ledgerAccounts: [`${LEDGER_ACCOUNT}`],
...accounts,
},
"bnb-mainnet": {
type: "http",
chainId: 56,
url: `${BNB_MAINNET_RPC_URL}`,
// accounts: process.env.PRIVATE_KEY ? [`0x${process.env.PRIVATE_KEY}`] : DEFAULT_ACCOUNTS,
ledgerAccounts: [`${LEDGER_ACCOUNT}`],
...accounts,
},
"bnb-testnet": {
type: "http",
chainId: 97,
url: `${BNB_TESTNET_RPC_URL}`,
// accounts: process.env.PRIVATE_KEY ? [`0x${process.env.PRIVATE_KEY}`] : DEFAULT_ACCOUNTS,
ledgerAccounts: [`${LEDGER_ACCOUNT}`],
...accounts,
},
// --------------------------------------------------------------------------------------------------------------
// Note: uncomment to use a forked network and then run `npx hardhat node --fork`
// in some networks is needed to execute first a script with `await ethers.provider.send("evm_mine")`
// in some networks is needed to execute first a script with `await ethers.provider.send("evm_mine")`
// to mine a block. Otherwise you can receive an error: "No known hardfork for execution on historical block..."
// --------------------------------------------------------------------------------------------------------------
// fork: {
Expand All @@ -273,7 +265,6 @@ export default defineConfig({
type: "http",
url: "http://127.0.0.1:8545",
timeout: 100000000,
// accounts: process.env.PRIVATE_KEY ? [`0x${process.env.PRIVATE_KEY}`] : DEFAULT_ACCOUNTS,
},
},
typechain: {
Expand Down Expand Up @@ -312,8 +303,8 @@ export default defineConfig({
blockExplorers: {
blockscout: {
name: "billions-testnet",
url: "https://billions-testnet-blockscout.eu-north-2.gateway.fm",
apiUrl: "https://billions-testnet-blockscout.eu-north-2.gateway.fm/api/",
url: "https://explorer-testnet.billions.network",
apiUrl: "https://explorer-testnet.billions.network/api/",
},
},
},
Expand All @@ -322,8 +313,8 @@ export default defineConfig({
blockExplorers: {
blockscout: {
name: "billions-mainnet",
url: "https://billions-rpc.eu-north-2.gateway.fm",
apiUrl: "https://billions-rpc.eu-north-2.gateway.fm/api/",
url: "https://explorer.billions.network",
apiUrl: "https://explorer.billions.network/api/",
Comment on lines 306 to 317
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The block explorer URLs for billions networks have been updated from gateway.fm endpoints to billions.network endpoints. Please ensure these new endpoints are accessible and support the same API as the old ones, as the verification scripts depend on these URLs being correct.

Copilot uses AI. Check for mistakes.
},
},
},
Expand Down
3 changes: 1 addition & 2 deletions helpers/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ dotenv.config();

const defaultUrl = "http://url";

export const LEDGER_ACCOUNT =
process.env.LEDGER_ACCOUNT || "0x0000000000000000000000000000000000000000";
export const LEDGER_ACCOUNT = process.env.LEDGER_ACCOUNT || undefined;
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing LEDGER_ACCOUNT default from "0x0000000000000000000000000000000000000000" to undefined is a breaking change. In hardhat.config.ts, the accounts configuration now uses LEDGER_ACCOUNT in a conditional check. If LEDGER_ACCOUNT is undefined, the condition LEDGER_ACCOUNT ? { ledgerAccounts: [LEDGER_ACCOUNT] } : { ... } will work correctly. However, if users had LEDGER_ACCOUNT set to an empty string in their environment, it will now be treated as truthy and cause ledgerAccounts: [""] to be set, which could lead to errors. Consider checking for both undefined and empty string: LEDGER_ACCOUNT && LEDGER_ACCOUNT.trim() ? ...

Copilot uses AI. Check for mistakes.
export const BILLIONS_MAINNET_RPC_URL = process.env.BILLIONS_MAINNET_RPC_URL || defaultUrl;
export const BILLIONS_TESTNET_RPC_URL = process.env.BILLIONS_TESTNET_RPC_URL || defaultUrl;
export const POLYGON_MAINNET_RPC_URL = process.env.POLYGON_MAINNET_RPC_URL || defaultUrl;
Expand Down
4 changes: 4 additions & 0 deletions helpers/helperUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export async function verifyContract(
}

console.log(`Verifying contract at address: ${contractAddress} ...`);
const chainDescriptor = hre.config.chainDescriptors.get(BigInt(await getChainId()));
// When verifying if the proxy contract is not verified yet we need to pass the arguments
// for the proxy contract first, then for proxy admin and finally for the implementation contract
if (opts.constructorArgsProxy) {
Expand All @@ -102,6 +103,7 @@ export async function verifyContract(
contract: opts.contract,
constructorArgs: opts.constructorArgsProxy,
libraries: opts.libraries,
provider: chainDescriptor?.blockExplorers?.etherscan ? "etherscan" : "blockscout",
},
hre,
);
Expand All @@ -116,6 +118,7 @@ export async function verifyContract(
contract: opts.contract,
constructorArgs: opts.constructorArgsProxyAdmin,
libraries: opts.libraries,
provider: chainDescriptor?.blockExplorers?.etherscan ? "etherscan" : "blockscout",
},
hre,
);
Expand All @@ -129,6 +132,7 @@ export async function verifyContract(
contract: opts.contract,
constructorArgs: opts.constructorArgsImplementation,
libraries: opts.libraries,
provider: chainDescriptor?.blockExplorers?.etherscan ? "etherscan" : "blockscout",
Comment on lines 95 to 135
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provider selection logic defaults to "blockscout" when chainDescriptor is undefined or doesn't have an etherscan blockExplorer. However, chainDescriptors in hardhat.config.ts only contains entries for chain IDs 6913 and 45056 (billions networks). For all other networks (polygon-mainnet, ethereum-mainnet, etc.) that use Etherscan, chainDescriptor will be undefined, causing the provider to incorrectly default to "blockscout" instead of "etherscan". This will likely cause verification to fail on networks like Polygon Mainnet (137), Ethereum Mainnet (1), etc.

Consider either:

  1. Adding chainDescriptor entries for all networks with proper blockExplorer configuration
  2. Reversing the logic to default to "etherscan" when chainDescriptor is undefined
  3. Using a different mechanism to determine the correct provider for each network

Copilot uses AI. Check for mistakes.
},
hre,
);
Expand Down
Loading
Loading