Skip to content
Open
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
17 changes: 14 additions & 3 deletions utils/smart-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { IContractDeploymentMap } from "../types/constants";
import { runChildProcess } from "./process";
import fetch from "node-fetch";
import { getDAppLaunchpadConfig } from "./config";
import { error } from "console";

Comment on lines +12 to 13
Copy link

Copilot AI Jun 11, 2025

Choose a reason for hiding this comment

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

The 'error' import from the console module is not used in the file; consider removing it to improve code clarity.

Suggested change
import { error } from "console";

Copilot uses AI. Check for mistakes.
// CONSTANTS
const providerLocalBlockchain = new ethers.JsonRpcProvider("http://127.0.0.1:8545");
Expand Down Expand Up @@ -189,6 +190,10 @@ export const getDeployedSmartContractsLocalChain = async (projectRootDir: string
))
);

const blockTransactionDeployedBytecode = await Promise.all(blockTransactionReceipts.map(
(receipt) => providerLocalBlockchain.send("eth_getCode", [receipt.contractAddress, receipt.blockNumber])
));

// For all found transactions, get their Contract address, bytecode and name
const contractsDeployedMap: IContractDeploymentMap = {};
const artifactFilesPath = shell
Expand All @@ -197,7 +202,7 @@ export const getDeployedSmartContractsLocalChain = async (projectRootDir: string
const artifacts = artifactFilesPath.map((path) => JSON.parse(shell.cat(path)));

for (let i = 0; i < blockTransactionReceipts.length; i++) {
const artifact = artifacts.find((artifact) => artifact.bytecode === blockTransactionsContractDeployments[i].input);
const artifact = artifacts.find((artifact) => artifact.deployedBytecode === blockTransactionDeployedBytecode[i]);

if (!artifact) continue;

Expand Down Expand Up @@ -304,7 +309,8 @@ export const deploySmartContractsProduction = async (projectRootDir: string, net
const blockNumPostDeployment = await getLatestBlockNumberOfNetwork(networkName);

const { contractsDeployedMap } = await getDeployedSmartContractsProduction(projectRootDir, networkName, blockNumPreDeployment, blockNumPostDeployment);


logSuccessWithBg(`Deployed smart contracts on ${(networksMap as any)[networkName].name} (${blockNumPreDeployment} -> ${blockNumPostDeployment})`);
// Log data
Object
.entries(contractsDeployedMap)
Expand Down Expand Up @@ -347,6 +353,11 @@ export const getDeployedSmartContractsProduction = async (projectRootDir: string
))
);

const blockTransactionDeployedBytecode = await Promise.all(
blockTransactionReceipts.map(
(receipt) => providerProduction.send("eth_getCode", [receipt.contractAddress, receipt.blockNumber]))
);

// For all found transactions, get their Contract address, bytecode and name
const contractsDeployedMap: { [contractName: string]: { contractAddress: string; bytecode: string; abi: any } } = {};
const artifactFilesPath = shell
Expand All @@ -355,7 +366,7 @@ export const getDeployedSmartContractsProduction = async (projectRootDir: string
const artifacts = artifactFilesPath.map((path) => JSON.parse(shell.cat(path)));

for (let i = 0; i < blockTransactionReceipts.length; i++) {
const artifact = artifacts.find((artifact) => artifact.bytecode === blockTransactionsContractDeployments[i].input);
const artifact = artifacts.find((artifact) => artifact.deployedBytecode === blockTransactionDeployedBytecode[i]);

if (!artifact) continue;

Expand Down