Socket
Socket
Sign inDemoInstall

hardhat-deploy

Package Overview
Dependencies
Maintainers
1
Versions
189
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hardhat-deploy - npm Package Compare versions

Comparing version 0.12.3 to 0.12.4

7

dist/src/DeploymentFactory.d.ts

@@ -5,3 +5,3 @@ import { TransactionReceipt, TransactionRequest, TransactionResponse } from '@ethersproject/providers';

import * as zk from 'zksync-ethers';
import { Address, DeployOptions, ExtendedArtifact } from '../types';
import { Address, Deployment, DeployOptions, ExtendedArtifact } from '../types';
export declare class DeploymentFactory {

@@ -15,3 +15,4 @@ private factory;

constructor(getArtifact: (name: string) => Promise<Artifact>, artifact: Artifact | ExtendedArtifact, args: any[], network: any, ethersSigner?: Signer | zk.Signer, overrides?: PayableOverrides);
private extractFactoryDeps;
extractFactoryDeps(artifact: any): Promise<string[]>;
private _extractFactoryDepsRecursive;
getDeployTransaction(): Promise<TransactionRequest>;

@@ -21,5 +22,5 @@ private calculateEvmCreate2Address;

getCreate2Address(create2DeployerAddress: Address, create2Salt: string): Promise<Address>;
compareDeploymentTransaction(transaction: TransactionResponse): Promise<boolean>;
compareDeploymentTransaction(transaction: TransactionResponse, deployment: Deployment): Promise<boolean>;
getDeployedAddress(receipt: TransactionReceipt, options: DeployOptions, create2Address: string | undefined): string;
}
//# sourceMappingURL=DeploymentFactory.d.ts.map

@@ -46,4 +46,8 @@ "use strict";

}
// TODO add ZkSyncArtifact
async extractFactoryDeps(artifact) {
const visited = new Set();
visited.add(`${artifact.sourceName}:${artifact.contractName}`);
return await this._extractFactoryDepsRecursive(artifact, visited);
}
async _extractFactoryDepsRecursive(artifact, visited) {
// Load all the dependency bytecodes.

@@ -53,5 +57,12 @@ // We transform it into an array of bytecodes.

for (const dependencyHash in artifact.factoryDeps) {
if (!dependencyHash)
continue;
const dependencyContract = artifact.factoryDeps[dependencyHash];
const dependencyBytecodeString = (await this.getArtifact(dependencyContract)).bytecode;
factoryDeps.push(dependencyBytecodeString);
if (!visited.has(dependencyContract)) {
const dependencyArtifact = await this.getArtifact(dependencyContract);
factoryDeps.push(dependencyArtifact.bytecode);
visited.add(dependencyContract);
const transitiveDeps = await this._extractFactoryDepsRecursive(dependencyArtifact, visited);
factoryDeps.push(...transitiveDeps);
}
}

@@ -93,12 +104,10 @@ return factoryDeps;

}
async compareDeploymentTransaction(transaction) {
var _a;
async compareDeploymentTransaction(transaction, deployment) {
var _a, _b;
const newTransaction = await this.getDeployTransaction();
const newData = (_a = newTransaction.data) === null || _a === void 0 ? void 0 : _a.toString();
if (this.isZkSync) {
const deserialize = zk.utils.parseTransaction(transaction.data);
const desFlattened = bytes_1.hexConcat(deserialize.customData.factoryDeps);
const factoryDeps = await this.extractFactoryDeps(this.artifact);
const newFlattened = bytes_1.hexConcat(factoryDeps);
return deserialize.data !== newData || desFlattened != newFlattened;
const currentFlattened = bytes_1.hexConcat(deployment.factoryDeps || []);
const newFlattened = bytes_1.hexConcat((_b = newTransaction.customData) === null || _b === void 0 ? void 0 : _b.factoryDeps);
return transaction.data !== newData || currentFlattened != newFlattened;
}

@@ -114,3 +123,5 @@ else {

if (this.isZkSync) {
const deployedAddresses = zk.utils.getDeployedContracts(receipt).map((info) => info.deployedAddress);
const deployedAddresses = zk.utils
.getDeployedContracts(receipt)
.map((info) => info.deployedAddress);
return deployedAddresses[deployedAddresses.length - 1];

@@ -117,0 +128,0 @@ }

{
"name": "hardhat-deploy",
"version": "0.12.3",
"version": "0.12.4",
"description": "Hardhat Plugin For Replicable Deployments And Tests",

@@ -5,0 +5,0 @@ "repository": "github:wighawag/hardhat-deploy",

@@ -9,3 +9,3 @@ import {

import * as zk from 'zksync-ethers';
import { Address, DeployOptions, ExtendedArtifact } from '../types';
import { Address, Deployment, DeployOptions, ExtendedArtifact } from '../types';
import { getAddress } from '@ethersproject/address';

@@ -56,4 +56,12 @@ import { keccak256 as solidityKeccak256 } from '@ethersproject/solidity';

// TODO add ZkSyncArtifact
private async extractFactoryDeps(artifact: any): Promise<string[]> {
public async extractFactoryDeps(artifact: any): Promise<string[]> {
const visited = new Set<string>();
visited.add(`${artifact.sourceName}:${artifact.contractName}`);
return await this._extractFactoryDepsRecursive(artifact, visited);
}
private async _extractFactoryDepsRecursive(
artifact: any,
visited: Set<string>
): Promise<string[]> {
// Load all the dependency bytecodes.

@@ -63,9 +71,15 @@ // We transform it into an array of bytecodes.

for (const dependencyHash in artifact.factoryDeps) {
if (!dependencyHash) continue;
const dependencyContract = artifact.factoryDeps[dependencyHash];
const dependencyBytecodeString = (
await this.getArtifact(dependencyContract)
).bytecode;
factoryDeps.push(dependencyBytecodeString);
if (!visited.has(dependencyContract)) {
const dependencyArtifact = await this.getArtifact(dependencyContract);
factoryDeps.push(dependencyArtifact.bytecode);
visited.add(dependencyContract);
const transitiveDeps = await this._extractFactoryDepsRecursive(
dependencyArtifact,
visited
);
factoryDeps.push(...transitiveDeps);
}
}
return factoryDeps;

@@ -143,3 +157,4 @@ }

public async compareDeploymentTransaction(
transaction: TransactionResponse
transaction: TransactionResponse,
deployment: Deployment
): Promise<boolean> {

@@ -149,8 +164,6 @@ const newTransaction = await this.getDeployTransaction();

if (this.isZkSync) {
const deserialize = zk.utils.parseTransaction(transaction.data) as any;
const desFlattened = hexConcat(deserialize.customData.factoryDeps);
const factoryDeps = await this.extractFactoryDeps(this.artifact);
const newFlattened = hexConcat(factoryDeps);
const currentFlattened = hexConcat(deployment.factoryDeps || []);
const newFlattened = hexConcat(newTransaction.customData?.factoryDeps);
return deserialize.data !== newData || desFlattened != newFlattened;
return transaction.data !== newData || currentFlattened != newFlattened;
} else {

@@ -171,5 +184,5 @@ return transaction.data !== newData;

if (this.isZkSync) {
const deployedAddresses = zk.utils.getDeployedContracts(receipt).map(
(info) => info.deployedAddress,
);
const deployedAddresses = zk.utils
.getDeployedContracts(receipt)
.map((info) => info.deployedAddress);

@@ -176,0 +189,0 @@ return deployedAddresses[deployedAddresses.length - 1];

@@ -893,2 +893,3 @@ /* eslint-disable @typescript-eslint/no-explicit-any */

}
this.db.deployments[name] = obj;

@@ -895,0 +896,0 @@ if (obj.address === undefined && obj.transactionHash !== undefined) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc