From d49a8e484cbd7a3e43e67b7ab5f781e4f5e714c4 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Mon, 18 Dec 2023 14:58:57 +0200 Subject: [PATCH 01/34] Added handling of the custom chains specified in the Hardhat config --- src/tools/reporters/Reporter.ts | 48 ++++++++++++++++++-------- src/tools/runners/TransactionRunner.ts | 4 +-- src/types/verifier.ts | 9 +++++ 3 files changed, 44 insertions(+), 17 deletions(-) diff --git a/src/tools/reporters/Reporter.ts b/src/tools/reporters/Reporter.ts index 24af9ff5..ce439174 100644 --- a/src/tools/reporters/Reporter.ts +++ b/src/tools/reporters/Reporter.ts @@ -3,18 +3,19 @@ import ora from "ora"; import { Network, TransactionResponse, formatEther, formatUnits, TransactionReceipt, id } from "ethers"; +import { HardhatRuntimeEnvironment } from "hardhat/types"; + import { networkManager } from "../network/NetworkManager"; import { catchError, underline } from "../../utils"; import { MigrateConfig } from "../../types/migrations"; -import { ChainRecord, predefinedChains } from "../../types/verifier"; +import { ChainRecord, CustomChainRecord, predefinedChains } from "../../types/verifier"; import { ContractFieldsToSave, MigrationMetadata, TransactionFieldsToSave } from "../../types/tools"; -// TODO: parse everything that is possible from hardhat config (deployment on q devnet bad UI) - @catchError class Reporter { + private _hre: HardhatRuntimeEnvironment = {} as any; private _config: MigrateConfig = {} as any; private _network: Network = {} as any; @@ -26,8 +27,9 @@ class Reporter { private _warningsToPrint: Map = new Map(); - public async init(config: MigrateConfig) { - this._config = config; + public async init(hre: HardhatRuntimeEnvironment) { + this._hre = hre; + this._config = hre.config.migrate; this._network = await this._getNetwork(); this._nativeSymbol = await this._getNativeSymbol(); @@ -60,20 +62,24 @@ class Reporter { const spinner = ora(await formatPendingTimeTask()).start(); - const spinnerInterval = setInterval( - async () => (spinner.text = await formatPendingTimeTask()), - this._config.transactionStatusCheckInterval, - ); + const setSpinnerText = async () => { + if (!this._isSpinnerActive) return; + + spinner.text = await formatPendingTimeTask(); + + setTimeout(setSpinnerText, this._config.transactionStatusCheckInterval); + }; this._isSpinnerActive = true; - return { spinner, spinnerInterval }; - } + await setSpinnerText(); - public async stopTxReporting(spinner: ora.Ora, spinnerInterval: NodeJS.Timeout) { - clearInterval(spinnerInterval); + return spinner; + } + public stopTxReporting(spinner: ora.Ora) { this._isSpinnerActive = false; + this._spinnerMessageIfActive = null; spinner.stop(); @@ -356,6 +362,12 @@ class Reporter { return !explorers || explorers.length === 0 ? "" : explorers[0].url; } + const customChain = await this._tryGetInfoFromHardhatConfig(chainId); + + if (customChain) { + return customChain.urls.browserURL; + } + const chain = await this._getChainMetadataById(chainId); return chain.explorers[0].url; @@ -391,6 +403,12 @@ class Reporter { } } + private async _tryGetInfoFromHardhatConfig(chainId: number): Promise { + const customChains: CustomChainRecord[] = this._hre.config.etherscan.customChains || []; + + return customChains.find((chain) => chain.chainId === chainId); + } + private async _tryGetAllRecords(): Promise { const url = "https://chainid.network/chains.json"; const response = await networkManager!.axios.get(url); @@ -402,11 +420,11 @@ class Reporter { export let reporter: Reporter | null = null; -export async function initReporter(config: MigrateConfig) { +export async function initReporter(hre: HardhatRuntimeEnvironment) { if (reporter) { return; } reporter = new Reporter(); - await reporter.init(config); + await reporter.init(hre); } diff --git a/src/tools/runners/TransactionRunner.ts b/src/tools/runners/TransactionRunner.ts index c3d55933..69a4b5fb 100644 --- a/src/tools/runners/TransactionRunner.ts +++ b/src/tools/runners/TransactionRunner.ts @@ -51,7 +51,7 @@ class TransactionRunner { } protected async _showTransactionMining(tx: TransactionResponse) { - const { spinner, spinnerInterval } = await reporter!.startTxReporting(tx); + const spinner = await reporter!.startTxReporting(tx); let receipt: TransactionReceipt; try { @@ -60,7 +60,7 @@ class TransactionRunner { } catch (e: any) { throw new MigrateError(`Transaction failed: ${e.message}`); } finally { - await reporter!.stopTxReporting(spinner, spinnerInterval); + reporter!.stopTxReporting(spinner); } return receipt; diff --git a/src/types/verifier.ts b/src/types/verifier.ts index 199bb74b..be2f516b 100644 --- a/src/types/verifier.ts +++ b/src/types/verifier.ts @@ -85,3 +85,12 @@ export const predefinedChains: Record = { ], }, }; + +export interface CustomChainRecord { + network: string; + chainId: number; + urls: { + apiURL: string; + browserURL: string; + }; +} From a978a5601417a3e7eaa537c9e52d6bddb9377da7 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Mon, 18 Dec 2023 23:16:36 +0200 Subject: [PATCH 02/34] Refactored the architecture and made it consistent. --- src/deployer/Deployer.ts | 23 ++-- src/deployer/Linker.ts | 52 ++++---- src/deployer/MinimalContract.ts | 24 ++-- .../adapters/AbstractEthersAdapter.ts | 16 +-- src/deployer/adapters/TruffleAdapter.ts | 16 +-- src/index.ts | 12 +- src/migrator/Migrator.ts | 31 ++--- src/tools/Stats.ts | 10 +- src/tools/network/EthersProvider.ts | 2 +- src/tools/network/NetworkManager.ts | 35 +++--- src/tools/reporters/PublicReporter.ts | 4 +- src/tools/reporters/Reporter.ts | 18 +-- src/tools/runners/TransactionRunner.ts | 22 ++-- src/tools/storage/ArtifactProcessor.ts | 16 +-- src/tools/storage/MigrateStorage.ts | 112 +++++++++--------- src/tools/storage/TransactionProcessor.ts | 54 ++++----- src/tools/storage/VerificationProcessor.ts | 10 +- src/verifier/Verifier.ts | 24 ++-- test/integration/adapters/ethersAdapter.ts | 4 +- test/integration/adapters/truffleAdapter.ts | 4 +- test/integration/deployer/deployEthers.ts | 2 +- test/integration/deployer/deployTruffle.ts | 2 +- .../deployer/deployTypechainEthers.ts | 2 +- .../deployer/deployTypechainTruffle.ts | 2 +- test/integration/transaction-storage.ts | 24 ++-- test/unit/linker.ts | 4 +- 26 files changed, 272 insertions(+), 253 deletions(-) diff --git a/src/deployer/Deployer.ts b/src/deployer/Deployer.ts index f697600e..9d4455fa 100644 --- a/src/deployer/Deployer.ts +++ b/src/deployer/Deployer.ts @@ -20,8 +20,8 @@ import { KeyTransactionFields, MigrationMetadata } from "../types/tools"; import { isContractFactory, isEthersContract, isBytecodeFactory, isTruffleFactory } from "../types/type-checks"; import { Stats } from "../tools/Stats"; -import { reporter } from "../tools/reporters/Reporter"; -import { transactionRunner } from "../tools/runners/TransactionRunner"; +import { Reporter } from "../tools/reporters/Reporter"; +import { TransactionRunner } from "../tools/runners/TransactionRunner"; import { TransactionProcessor } from "../tools/storage/TransactionProcessor"; @catchError @@ -56,9 +56,9 @@ export class Deployer { let contractAddress; if (contractIdentifier === undefined) { - contractAddress = await TransactionProcessor.tryRestoreContractAddressByName(defaultContractName); + contractAddress = await TransactionProcessor?.tryRestoreContractAddressByName(defaultContractName); - return adapter.toInstance(contract, contractAddress, {}); + return adapter.toInstance(contract, contractAddress!, {}); } if (isAddress(contractIdentifier)) { @@ -69,11 +69,12 @@ export class Deployer { return adapter.toInstance(contract, contractIdentifier, {}); } - contractAddress = await TransactionProcessor.tryRestoreContractAddressByName(contractIdentifier); + contractAddress = await TransactionProcessor?.tryRestoreContractAddressByName(contractIdentifier); - return adapter.toInstance(contract, contractAddress, {}); + return adapter.toInstance(contract, contractAddress!, {}); } + // TODO: return receipt! public async sendNative(to: string, value: bigint, name: string = SEND_NATIVE_TX_NAME): Promise { const signer = await getSignerHelper(); @@ -83,13 +84,13 @@ export class Deployer { if (this._hre.config.migrate.continue) { try { - TransactionProcessor.tryRestoreSavedTransaction(tx); + TransactionProcessor?.tryRestoreSavedTransaction(tx); - reporter!.notifyTransactionRecovery(methodString); + Reporter!.notifyTransactionRecovery(methodString); return; } catch { - reporter!.notifyTransactionSendingInsteadOfRecovery(methodString); + Reporter!.notifyTransactionSendingInsteadOfRecovery(methodString); } } @@ -97,7 +98,7 @@ export class Deployer { const [receipt] = await Promise.all([ txResponse.wait(this._hre.config.migrate.wait), - transactionRunner!.reportTransactionResponse(txResponse, methodString), + TransactionRunner!.reportTransactionResponse(txResponse, methodString), ]); const saveMetadata: MigrationMetadata = { @@ -105,7 +106,7 @@ export class Deployer { methodName: methodString, }; - TransactionProcessor.saveTransaction(tx, receipt!, saveMetadata); + TransactionProcessor?.saveTransaction(tx, receipt!, saveMetadata); } public async getSigner(from?: string): Promise { diff --git a/src/deployer/Linker.ts b/src/deployer/Linker.ts index ceee8aeb..6981346d 100644 --- a/src/deployer/Linker.ts +++ b/src/deployer/Linker.ts @@ -11,23 +11,19 @@ import { catchError } from "../utils"; import { MigrateConfig } from "../types/migrations"; import { ArtifactExtended, Link, NeededLibrary } from "../types/deployer"; -import { reporter } from "../tools/reporters/Reporter"; +import { Reporter } from "../tools/reporters/Reporter"; import { ArtifactProcessor } from "../tools/storage/ArtifactProcessor"; import { TransactionProcessor } from "../tools/storage/TransactionProcessor"; @catchError -export class Linker { - private static _config: MigrateConfig; +class LinkerHelper { + constructor(private _config: MigrateConfig) {} - public static setConfig(config: MigrateConfig): void { - this._config = config; - } - - public static isBytecodeNeedsLinking(bytecode: string): boolean { + public isBytecodeNeedsLinking(bytecode: string): boolean { return bytecode.indexOf("__") === -1; } - public static async tryLinkBytecode(contractName: string, bytecode: string, libraries: Libraries): Promise { + public async tryLinkBytecode(contractName: string, bytecode: string, libraries: Libraries): Promise { const artifact: ArtifactExtended = this._mustGetContractArtifact(contractName); const neededLibraries = this._cleanNeededLibraries(bytecode, artifact, artifact.neededLibraries); @@ -57,7 +53,7 @@ export class Linker { return this._linkBytecode(bytecode, artifact, [...linksToApply.values()]); } - private static _mustGetNeededLibrary( + private _mustGetNeededLibrary( neededLibraries: NeededLibrary[], libraryName: string, linksToApply: Map, @@ -69,7 +65,7 @@ export class Linker { return this._validateMatchedNeededLibraries(neededLibraries, matchingNeededLibraries, linksToApply); } - private static _validateMatchedNeededLibraries( + private _validateMatchedNeededLibraries( neededLibraries: NeededLibrary[], matchingNeededLibraries: NeededLibrary[], linksToApply: Map, @@ -110,7 +106,7 @@ export class Linker { return neededLibrary; } - private static async _findMissingLibraries( + private async _findMissingLibraries( missingLibraries: { sourceName: string; libName: string }[], ): Promise> { const missingLibrariesMap: Map = new Map(); @@ -131,7 +127,7 @@ export class Linker { return missingLibrariesMap; } - private static _validateLibrariesToLink(linksToApply: Map, neededLibraries: NeededLibrary[]): void { + private _validateLibrariesToLink(linksToApply: Map, neededLibraries: NeededLibrary[]): void { if (linksToApply.size < neededLibraries.length) { const missingLibraries = neededLibraries .map((lib) => `${lib.sourceName}:${lib.libName}`) @@ -143,11 +139,7 @@ export class Linker { } } - private static _cleanNeededLibraries( - bytecode: string, - artifact: Artifact, - libraries: NeededLibrary[], - ): NeededLibrary[] { + private _cleanNeededLibraries(bytecode: string, artifact: Artifact, libraries: NeededLibrary[]): NeededLibrary[] { const actuallyNeededLibs: Map = new Map(); for (const { sourceName, libName } of libraries) { @@ -166,7 +158,7 @@ export class Linker { /** * The address of the linked library can be extracted like this: bytecode.slice(prefixLength + 2, suffixStart + 2) */ - private static _isLinkedLibrary(bytecode: string, start: number, length: number): boolean { + private _isLinkedLibrary(bytecode: string, start: number, length: number): boolean { const prefixLength = start * 2; const prefix = bytecode.slice(prefixLength + 2, prefixLength + 5); @@ -176,7 +168,7 @@ export class Linker { return `${prefix}${suffix}` !== "__$$__"; } - private static _linkBytecode(bytecode: string, artifact: Artifact, libraries: Link[]): string { + private _linkBytecode(bytecode: string, artifact: Artifact, libraries: Link[]): string { for (const { sourceName, libraryName, address } of libraries) { const linkReferences = artifact.linkReferences[sourceName][libraryName]; @@ -194,9 +186,9 @@ export class Linker { return bytecode; } - private static async _getOrDeployLibrary(libraryName: string) { + private async _getOrDeployLibrary(libraryName: string) { try { - return await TransactionProcessor.tryRestoreContractAddressByName(libraryName); + return (await TransactionProcessor?.tryRestoreContractAddressByName(libraryName))!; } catch { const artifact = this._mustGetLibraryArtifact(libraryName); @@ -204,13 +196,13 @@ export class Linker { // https://github.com/ethers-io/ethers.js/issues/1126 const core = new MinimalContract(this._config, artifact.bytecode, artifact.abi, libraryName); - reporter!.notifyDeploymentOfMissingLibrary(libraryName); + Reporter!.notifyDeploymentOfMissingLibrary(libraryName); return core.deploy(); } } - private static _mustGetContractArtifact(contractName: string): ArtifactExtended { + private _mustGetContractArtifact(contractName: string): ArtifactExtended { try { return ArtifactProcessor.tryGetArtifactByName(contractName); } catch { @@ -218,7 +210,7 @@ export class Linker { } } - private static _mustGetLibraryArtifact(libraryName: string): ArtifactExtended { + private _mustGetLibraryArtifact(libraryName: string): ArtifactExtended { try { return ArtifactProcessor.tryGetArtifactByName(libraryName); } catch { @@ -226,3 +218,13 @@ export class Linker { } } } + +export let Linker: LinkerHelper | null = null; + +export function createLinker(config: MigrateConfig) { + if (Linker) { + return; + } + + Linker = new LinkerHelper(config); +} diff --git a/src/deployer/MinimalContract.ts b/src/deployer/MinimalContract.ts index 84904359..1a6fefb9 100644 --- a/src/deployer/MinimalContract.ts +++ b/src/deployer/MinimalContract.ts @@ -13,8 +13,8 @@ import { MigrateConfig } from "../types/migrations"; import { ContractDeployTxWithName, OverridesAndLibs } from "../types/deployer"; import { Stats } from "../tools/Stats"; -import { reporter } from "../tools/reporters/Reporter"; -import { transactionRunner } from "../tools/runners/TransactionRunner"; +import { Reporter } from "../tools/reporters/Reporter"; +import { TransactionRunner } from "../tools/runners/TransactionRunner"; import { ArtifactProcessor } from "../tools/storage/ArtifactProcessor"; import { TransactionProcessor } from "../tools/storage/TransactionProcessor"; import { VerificationProcessor } from "../tools/storage/VerificationProcessor"; @@ -58,11 +58,11 @@ export class MinimalContract { private async _tryLinkLibraries(parameters: OverridesAndLibs): Promise { try { - if (Linker.isBytecodeNeedsLinking(this._bytecode)) { + if (Linker?.isBytecodeNeedsLinking(this._bytecode)) { return; } - this._bytecode = await Linker.tryLinkBytecode(this._contractName, this._bytecode, parameters.libraries || {}); + this._bytecode = (await Linker?.tryLinkBytecode(this._contractName, this._bytecode, parameters.libraries || {}))!; } catch (e: any) { throw new MigrateError( `Unable to link libraries for ${this._contractName}! Try manually deploy the libraries and link them.\n Error: ${e.message}`, @@ -83,18 +83,18 @@ export class MinimalContract { private async _recoverContractAddress(tx: ContractDeployTxWithName, args: any[]): Promise { try { - const contractAddress = await TransactionProcessor.tryRestoreContractAddressByKeyFields(tx); + const contractAddress = await TransactionProcessor?.tryRestoreContractAddressByKeyFields(tx); - reporter!.notifyContractRecovery(tx.contractName, contractAddress); + Reporter!.notifyContractRecovery(tx.contractName, contractAddress!); - await this._saveContractForVerification(contractAddress, tx, args); + await this._saveContractForVerification(contractAddress!, tx, args); - return contractAddress; + return contractAddress!; } catch { /* empty */ } - reporter!.notifyDeploymentInsteadOfRecovery(tx.contractName); + Reporter!.notifyDeploymentInsteadOfRecovery(tx.contractName); return this._processContractDeploymentTransaction(tx, args); } @@ -104,7 +104,7 @@ export class MinimalContract { const txResponse = await signer.sendTransaction(tx); - await transactionRunner!.reportTransactionResponse(txResponse, tx.contractName); + await TransactionRunner!.reportTransactionResponse(txResponse, tx.contractName); const contractAddress = (await txResponse.wait(0))!.contractAddress; @@ -119,7 +119,7 @@ export class MinimalContract { contractName: tx.contractName, }; - TransactionProcessor.saveDeploymentTransaction(tx, tx.contractName, contractAddress, saveMetadata); + TransactionProcessor?.saveDeploymentTransaction(tx, tx.contractName, contractAddress, saveMetadata); return contractAddress; } @@ -143,7 +143,7 @@ export class MinimalContract { chainId: Number(await getChainId()), }); } catch { - reporter!.reportVerificationFailedToSave(tx.contractName); + Reporter!.reportVerificationFailedToSave(tx.contractName); } } } diff --git a/src/deployer/adapters/AbstractEthersAdapter.ts b/src/deployer/adapters/AbstractEthersAdapter.ts index 7499f1fb..3a90fd67 100644 --- a/src/deployer/adapters/AbstractEthersAdapter.ts +++ b/src/deployer/adapters/AbstractEthersAdapter.ts @@ -24,8 +24,8 @@ import { EthersContract, BytecodeFactory } from "../../types/adapter"; import { KeyTransactionFields, MigrationMetadata, TransactionFieldsToSave } from "../../types/tools"; import { Stats } from "../../tools/Stats"; -import { reporter } from "../../tools/reporters/Reporter"; -import { transactionRunner } from "../../tools/runners/TransactionRunner"; +import { Reporter } from "../../tools/reporters/Reporter"; +import { TransactionRunner } from "../../tools/runners/TransactionRunner"; import { TransactionProcessor } from "../../tools/storage/TransactionProcessor"; type Factory = EthersContract | BytecodeFactory | ContractFactory; @@ -148,13 +148,13 @@ export abstract class AbstractEthersAdapter extends Adapter { args: any[], ) { try { - const savedTransaction = TransactionProcessor.tryRestoreSavedTransaction(tx); + const savedTransaction = TransactionProcessor?.tryRestoreSavedTransaction(tx); - reporter!.notifyTransactionRecovery(methodString); + Reporter!.notifyTransactionRecovery(methodString); - return this._wrapTransactionFieldsToSave(savedTransaction); + return this._wrapTransactionFieldsToSave(savedTransaction!); } catch { - reporter!.notifyTransactionSendingInsteadOfRecovery(methodString); + Reporter!.notifyTransactionSendingInsteadOfRecovery(methodString); return this._sendTransaction(methodString, tx, oldMethod, args); } @@ -173,9 +173,9 @@ export abstract class AbstractEthersAdapter extends Adapter { methodName: methodString, }; - await transactionRunner!.reportTransactionResponse(txResponse, methodString); + await TransactionRunner!.reportTransactionResponse(txResponse, methodString); - TransactionProcessor.saveTransaction(tx, (await txResponse.wait())!, saveMetadata); + TransactionProcessor?.saveTransaction(tx, (await txResponse.wait())!, saveMetadata); return txResponse; } diff --git a/src/deployer/adapters/TruffleAdapter.ts b/src/deployer/adapters/TruffleAdapter.ts index 2c804010..5d1216e0 100644 --- a/src/deployer/adapters/TruffleAdapter.ts +++ b/src/deployer/adapters/TruffleAdapter.ts @@ -20,13 +20,13 @@ import { bytecodeToString, catchError, fillParameters, getMethodString, getSigne import { UNKNOWN_CONTRACT_NAME, UNKNOWN_TRANSACTION_NAME } from "../../constants"; +import { KeyTransactionFields, MigrationMetadata } from "../../types/tools"; import { EthersContract, Instance, TruffleFactory } from "../../types/adapter"; import { OverridesAndName, TruffleTransactionResponse } from "../../types/deployer"; -import { KeyTransactionFields, MigrationMetadata } from "../../types/tools"; import { Stats } from "../../tools/Stats"; -import { reporter } from "../../tools/reporters/Reporter"; -import { transactionRunner } from "../../tools/runners/TransactionRunner"; +import { Reporter } from "../../tools/reporters/Reporter"; +import { TransactionRunner } from "../../tools/runners/TransactionRunner"; import { ArtifactProcessor } from "../../tools/storage/ArtifactProcessor"; import { TransactionProcessor } from "../../tools/storage/TransactionProcessor"; @@ -163,13 +163,13 @@ export class TruffleAdapter extends Adapter { args: any[], ): Promise { try { - const txResponse = TransactionProcessor.tryRestoreSavedTransaction(tx); + const txResponse = TransactionProcessor?.tryRestoreSavedTransaction(tx); - reporter!.notifyTransactionRecovery(methodString); + Reporter!.notifyTransactionRecovery(methodString); return txResponse as unknown as TruffleTransactionResponse; } catch { - reporter!.notifyTransactionSendingInsteadOfRecovery(methodString); + Reporter!.notifyTransactionSendingInsteadOfRecovery(methodString); return this._sendTransaction(methodString, tx, oldMethod, args); } @@ -188,10 +188,10 @@ export class TruffleAdapter extends Adapter { methodName: methodString, }; - await transactionRunner!.reportTransactionResponse(txResponse, methodString); + await TransactionRunner!.reportTransactionResponse(txResponse, methodString); const response = this._toTruffleTransactionResponse((await txResponse.wait())!); - TransactionProcessor.saveTransaction(tx, response.receipt, saveMetadata); + TransactionProcessor?.saveTransaction(tx, response.receipt, saveMetadata); return response; } diff --git a/src/index.ts b/src/index.ts index 0e3eb0c3..7b075c24 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,14 +12,14 @@ import { TASK_MIGRATE, TASK_MIGRATE_VERIFY } from "./constants"; import { MigrateConfig, MigrateVerifyConfig } from "./types/migrations"; -import { DefaultStorage, MigrateStorage } from "./tools/storage/MigrateStorage"; +import { UserStorage, DefaultStorage } from "./tools/storage/MigrateStorage"; import { VerificationProcessor } from "./tools/storage/VerificationProcessor"; import { Migrator } from "./migrator/Migrator"; import { Verifier } from "./verifier/Verifier"; export { Deployer } from "./deployer/Deployer"; -export { DefaultStorage } from "./tools/storage/MigrateStorage"; +export { UserStorage } from "./tools/storage/MigrateStorage"; export { PublicReporter as Reporter } from "./tools/reporters/PublicReporter"; extendConfig(migrateConfigExtender); @@ -33,7 +33,7 @@ const migrate: ActionType = async (taskArgs, env) => { force: env.config.migrate.force, }); - await Migrator.initialize(env); + await Migrator.buildMigrateTaskDeps(env); await new Migrator(env).migrate(); @@ -45,7 +45,7 @@ const migrate: ActionType = async (taskArgs, env) => { const migrateVerify: ActionType = async (taskArgs, env) => { const config = extendVerifyConfigs(taskArgs); - await Verifier.initialize(env); + await Verifier.buildVerifierTaskDeps(env); await new Verifier(env, config).verifyBatch( VerificationProcessor.restoreSavedVerificationFunctions(config.inputFile), @@ -57,11 +57,11 @@ extendEnvironment((hre) => { return new Migrator(hre); }); - hre.storage = lazyObject(() => DefaultStorage); + hre.storage = lazyObject(() => UserStorage); }); task(TASK_CLEAN, "Clears the cache and deletes all artifacts").setAction(async (conf, hre, runSuper) => { - MigrateStorage.clean(); + DefaultStorage.clean(); await runSuper(); }); diff --git a/src/migrator/Migrator.ts b/src/migrator/Migrator.ts index c138718d..311d1d08 100644 --- a/src/migrator/Migrator.ts +++ b/src/migrator/Migrator.ts @@ -12,20 +12,21 @@ import { MigrateError } from "../errors"; import { MigrateConfig } from "../types/migrations"; -import { Linker } from "../deployer/Linker"; import { Deployer } from "../deployer/Deployer"; import { Verifier } from "../verifier/Verifier"; +import { createLinker } from "../deployer/Linker"; + import { Stats } from "../tools/Stats"; -import { initReporter, reporter } from "../tools/reporters/Reporter"; -import { transactionRunner } from "../tools/runners/TransactionRunner"; +import { TransactionRunner } from "../tools/runners/TransactionRunner"; +import { createAndInitReporter, Reporter } from "../tools/reporters/Reporter"; -import { initNetworkManager } from "../tools/network/NetworkManager"; +import { buildNetworkDeps } from "../tools/network/NetworkManager"; -import { TransactionProcessor } from "../tools/storage/TransactionProcessor"; -import { MigrateStorage } from "../tools/storage/MigrateStorage"; +import { DefaultStorage } from "../tools/storage/MigrateStorage"; import { ArtifactProcessor } from "../tools/storage/ArtifactProcessor"; +import { createTransactionProcessor } from "../tools/storage/TransactionProcessor"; export class Migrator { private readonly _deployer: Deployer; @@ -47,12 +48,12 @@ export class Migrator { } public async migrate() { - reporter!.reportMigrationBegin(this._migrationFiles); + Reporter!.reportMigrationBegin(this._migrationFiles); for (const element of this._migrationFiles) { Stats.currentMigration = this._getMigrationNumber(element); - reporter!.reportMigrationFileBegin(element); + Reporter!.reportMigrationFileBegin(element); try { // eslint-disable-next-line @typescript-eslint/no-var-requires @@ -68,7 +69,7 @@ export class Migrator { } } - transactionRunner!.summary(); + TransactionRunner!.summary(); } private _getMigrationFiles() { @@ -107,15 +108,15 @@ export class Migrator { return parseInt(basename(file)); } - public static async initialize(hre: HardhatRuntimeEnvironment): Promise { - Linker.setConfig(hre.config.migrate); - TransactionProcessor.setConfig(hre.config.migrate); + public static async buildMigrateTaskDeps(hre: HardhatRuntimeEnvironment): Promise { + createLinker(hre.config.migrate); + createTransactionProcessor(hre.config.migrate); - initNetworkManager(hre); - await initReporter(hre.config.migrate); + buildNetworkDeps(hre); + await createAndInitReporter(hre); if (!hre.config.migrate.continue) { - MigrateStorage.clearAll(); + DefaultStorage.clearAll(); } await ArtifactProcessor.parseArtifacts(hre); diff --git a/src/tools/Stats.ts b/src/tools/Stats.ts index 800a6ced..82aa7f36 100644 --- a/src/tools/Stats.ts +++ b/src/tools/Stats.ts @@ -1,15 +1,17 @@ import { MigrationStats } from "../types/tools"; -export class Stats { - private static _stats: MigrationStats = { +class BaseStats { + private _stats: MigrationStats = { currentMigration: 0, }; - public static get currentMigration(): number { + public get currentMigration(): number { return this._stats.currentMigration; } - public static set currentMigration(currentMigration: number) { + public set currentMigration(currentMigration: number) { this._stats.currentMigration = currentMigration; } } + +export const Stats = new BaseStats(); diff --git a/src/tools/network/EthersProvider.ts b/src/tools/network/EthersProvider.ts index eeb2ed63..3bf91cf9 100644 --- a/src/tools/network/EthersProvider.ts +++ b/src/tools/network/EthersProvider.ts @@ -4,7 +4,7 @@ import type { HardhatEthersProvider as HardhatEthersProviderT } from "@nomicfoun export let ethersProvider: HardhatEthersProviderT | null = null; -export function initEthersProvider(hre: HardhatRuntimeEnvironment): void { +export function createEthersProvider(hre: HardhatRuntimeEnvironment): void { if (ethersProvider) { return; } diff --git a/src/tools/network/NetworkManager.ts b/src/tools/network/NetworkManager.ts index a0315e64..3ac8756d 100644 --- a/src/tools/network/NetworkManager.ts +++ b/src/tools/network/NetworkManager.ts @@ -4,15 +4,14 @@ import type { HardhatEthersProvider as HardhatEthersProviderT } from "@nomicfoun import { HardhatRuntimeEnvironment } from "hardhat/types"; -import { ethersProvider, initEthersProvider } from "./EthersProvider"; +import { ethersProvider, createEthersProvider } from "./EthersProvider"; -import { reporter } from "../reporters/Reporter"; +import { Reporter } from "../reporters/Reporter"; +import { createTransactionRunner } from "../runners/TransactionRunner"; import { sleep } from "../../utils"; import { MAX_RECONNECT_ATTEMPTS, RECONNECT_INTERVAL } from "../../constants"; -import { initTransactionRunner } from "../runners/TransactionRunner"; - class StateMiddleware { public static async retry any>( fn: T, @@ -46,8 +45,18 @@ class StateMiddleware { return this.retry(fn, args, retryCount + 1); } } +} + +class NetworkManager { + public axios: Axios; + public provider: HardhatEthersProviderT; + + constructor() { + this.axios = this.withRetry(axios); + this.provider = this.withRetry(ethersProvider!); + } - public static withRetry(instance: T): T { + public withRetry(instance: T): T { return new Proxy(instance, { get(target, propKey, receiver) { const origMethod = target[propKey as keyof T]; @@ -64,21 +73,11 @@ class StateMiddleware { } } -class NetworkManager { - public axios: Axios; - public provider: HardhatEthersProviderT; - - constructor() { - this.axios = StateMiddleware.withRetry(axios); - this.provider = StateMiddleware.withRetry(ethersProvider!); - } -} - export let networkManager: NetworkManager | null = null; -export function initNetworkManager(hre: HardhatRuntimeEnvironment) { - initEthersProvider(hre); - initTransactionRunner(hre); +export function buildNetworkDeps(hre: HardhatRuntimeEnvironment) { + createEthersProvider(hre); + createTransactionRunner(hre); if (networkManager) { return; diff --git a/src/tools/reporters/PublicReporter.ts b/src/tools/reporters/PublicReporter.ts index cdd65d68..abd745b6 100644 --- a/src/tools/reporters/PublicReporter.ts +++ b/src/tools/reporters/PublicReporter.ts @@ -1,7 +1,7 @@ /* eslint-disable no-console */ import { networkManager } from "../network/NetworkManager"; -import { transactionRunner } from "../runners/TransactionRunner"; +import { TransactionRunner } from "../runners/TransactionRunner"; import { MigrateError } from "../../errors"; @@ -13,7 +13,7 @@ export class PublicReporter { throw new MigrateError("Transaction not found."); } - await transactionRunner!.reportTransactionResponse(tx, name || "Unknown"); + await TransactionRunner!.reportTransactionResponse(tx, name || "Unknown"); } public static reportContracts(...contracts: [string, string][]): void { diff --git a/src/tools/reporters/Reporter.ts b/src/tools/reporters/Reporter.ts index ce439174..55ee97c3 100644 --- a/src/tools/reporters/Reporter.ts +++ b/src/tools/reporters/Reporter.ts @@ -13,8 +13,11 @@ import { MigrateConfig } from "../../types/migrations"; import { ChainRecord, CustomChainRecord, predefinedChains } from "../../types/verifier"; import { ContractFieldsToSave, MigrationMetadata, TransactionFieldsToSave } from "../../types/tools"; +/** + * Global error handling for network-related issues is conducted within the NetworkManager class + */ @catchError -class Reporter { +class BaseReporter { private _hre: HardhatRuntimeEnvironment = {} as any; private _config: MigrateConfig = {} as any; private _network: Network = {} as any; @@ -48,7 +51,7 @@ class Reporter { console.log(`\n${underline(`Running ${file}...`)}`); } - public async reportTransactionResponseHeader(tx: TransactionResponse, instanceName: string) { + public reportTransactionResponseHeader(tx: TransactionResponse, instanceName: string) { console.log("\n" + underline(this._parseTransactionTitle(tx, instanceName))); console.log(`> explorer: ${this._getExplorerLink(tx.hash)}`); @@ -418,13 +421,14 @@ class Reporter { } } -export let reporter: Reporter | null = null; +export let Reporter: BaseReporter | null = null; -export async function initReporter(hre: HardhatRuntimeEnvironment) { - if (reporter) { +export async function createAndInitReporter(hre: HardhatRuntimeEnvironment) { + if (Reporter) { return; } - reporter = new Reporter(); - await reporter.init(hre); + Reporter = new BaseReporter(); + + await Reporter.init(hre); } diff --git a/src/tools/runners/TransactionRunner.ts b/src/tools/runners/TransactionRunner.ts index 69a4b5fb..f858c2a4 100644 --- a/src/tools/runners/TransactionRunner.ts +++ b/src/tools/runners/TransactionRunner.ts @@ -2,7 +2,7 @@ import { TransactionResponse, TransactionReceipt } from "ethers"; import { HardhatRuntimeEnvironment } from "hardhat/types"; -import { reporter } from "../reporters/Reporter"; +import { Reporter } from "../reporters/Reporter"; import { networkManager } from "../network/NetworkManager"; @@ -13,7 +13,7 @@ import { MigrateError } from "../../errors"; import { MigrateConfig } from "../../types/migrations"; @catchError -class TransactionRunner { +class BaseTransactionRunner { protected _config: MigrateConfig; protected totalCost: bigint = 0n; @@ -31,7 +31,7 @@ class TransactionRunner { configurable: true, }); - await reporter!.reportTransactionResponseHeader(tx, instanceName); + Reporter!.reportTransactionResponseHeader(tx, instanceName); let receipt; if (tx.isMined()) { @@ -40,18 +40,18 @@ class TransactionRunner { receipt = await this._showTransactionMining(tx); } - await reporter!.reportTransactionReceipt(receipt); + await Reporter!.reportTransactionReceipt(receipt); this.totalCost += receipt.fee + tx.value ?? 0n; this.totalTransactions++; } public summary() { - reporter!.summary(this.totalTransactions, this.totalCost); + Reporter!.summary(this.totalTransactions, this.totalCost); } protected async _showTransactionMining(tx: TransactionResponse) { - const spinner = await reporter!.startTxReporting(tx); + await Reporter!.startTxReporting(tx); let receipt: TransactionReceipt; try { @@ -60,19 +60,19 @@ class TransactionRunner { } catch (e: any) { throw new MigrateError(`Transaction failed: ${e.message}`); } finally { - reporter!.stopTxReporting(spinner); + Reporter!.stopSpinner(); } return receipt; } } -export let transactionRunner: TransactionRunner | null = null; +export let TransactionRunner: BaseTransactionRunner | null = null; -export function initTransactionRunner(hre: HardhatRuntimeEnvironment) { - if (transactionRunner) { +export function createTransactionRunner(hre: HardhatRuntimeEnvironment) { + if (TransactionRunner) { return; } - transactionRunner = new TransactionRunner(hre.config.migrate); + TransactionRunner = new BaseTransactionRunner(hre.config.migrate); } diff --git a/src/tools/storage/ArtifactProcessor.ts b/src/tools/storage/ArtifactProcessor.ts index 4118592b..8670b59b 100644 --- a/src/tools/storage/ArtifactProcessor.ts +++ b/src/tools/storage/ArtifactProcessor.ts @@ -9,8 +9,8 @@ import { bytecodeHash, catchError } from "../../utils"; import { ArtifactExtended, NeededLibrary } from "../../types/deployer"; @catchError -export class ArtifactProcessor { - public static async parseArtifacts(_hre: HardhatRuntimeEnvironment): Promise { +class BaseArtifactProcessor { + public async parseArtifacts(_hre: HardhatRuntimeEnvironment): Promise { ArtifactStorage.clear(); const names = await _hre.artifacts.getAllFullyQualifiedNames(); @@ -32,7 +32,7 @@ export class ArtifactProcessor { } } - public static tryGetArtifactByName(contractName: string): ArtifactExtended { + public tryGetArtifactByName(contractName: string): ArtifactExtended { const artifact = ArtifactStorage.get(contractName); if (!artifact) { @@ -42,7 +42,7 @@ export class ArtifactProcessor { return artifact; } - public static tryGetArtifactByBytecode(bytecode: string): ArtifactExtended { + public tryGetArtifactByBytecode(bytecode: string): ArtifactExtended { const artifact = ArtifactStorage.get(bytecodeHash(bytecode)); if (!artifact) { @@ -52,13 +52,13 @@ export class ArtifactProcessor { return artifact; } - public static tryGetContractName(bytecode: string): string { + public tryGetContractName(bytecode: string): string { const artifact = this.tryGetArtifactByBytecode(bytecode); return `${artifact.sourceName}:${artifact.contractName}`; } - private static _parseLibrariesOfArtifact(artifact: Artifact): NeededLibrary[] { + private _parseLibrariesOfArtifact(artifact: Artifact): NeededLibrary[] { const libraries = artifact.linkReferences; const neededLibraries = []; @@ -77,7 +77,9 @@ export class ArtifactProcessor { return neededLibraries; } - private static _isNotDeployableArtifact(artifact: Artifact): boolean { + private _isNotDeployableArtifact(artifact: Artifact): boolean { return artifact.deployedBytecode === "0x"; } } + +export const ArtifactProcessor = new BaseArtifactProcessor(); diff --git a/src/tools/storage/MigrateStorage.ts b/src/tools/storage/MigrateStorage.ts index 86a23347..7e2e0cdb 100644 --- a/src/tools/storage/MigrateStorage.ts +++ b/src/tools/storage/MigrateStorage.ts @@ -9,31 +9,69 @@ import { catchError, resolvePathToFile, toJSON } from "../../utils"; import { StorageNamespaces } from "../../types/tools"; @catchError -export class MigrateStorage { - private static readonly _fileName = ".storage.json"; +class BaseStorage { + private readonly _fileName = ".storage.json"; - private static _state: Record = lazyObject(() => MigrateStorage._readFullStateFromFile()); + protected _state: Record = lazyObject(() => this._readFullStateFromFile()); - constructor(private _namespace: StorageNamespaces = StorageNamespaces.Storage) { - if (!MigrateStorage._state[this._namespace]) { - MigrateStorage._state[this._namespace] = {}; + public clearAll(): void { + for (const namespace of Object.values(StorageNamespaces)) { + this._state[namespace] = {}; } + + this._saveStateToFile(); } - public static clearAll(): void { - for (const namespace of Object.values(StorageNamespaces)) { - MigrateStorage._state[namespace] = {}; + public clean(): void { + if (this._stateExistsInFile()) { + rmSync(this._filePath(), { force: true }); } + } - MigrateStorage._saveStateToFile(); + protected _saveStateToFile() { + writeFileSync(this._filePath(), toJSON(this._state), { + flag: "w", + encoding: "utf8", + }); + } + + private _stateExistsInFile(): boolean { + return existsSync(this._filePath()); + } + + private _readFullStateFromFile(): Record> { + if (!this._stateExistsInFile()) { + return {}; + } + + const fileContent = readFileSync(this._filePath(), { + encoding: "utf8", + }); + + return JSON.parse(fileContent); + } + + private _filePath(): string { + return resolvePathToFile("cache", this._fileName); + } +} + +@catchError +export class MigrateStorage extends BaseStorage { + constructor(private _namespace: StorageNamespaces = StorageNamespaces.Storage) { + super(); + + if (!this._state[this._namespace]) { + this._state[this._namespace] = {}; + } } public get(key: string): any { - return MigrateStorage._state[this._namespace][key]; + return this._state[this._namespace][key]; } public getAll(): Record { - return MigrateStorage._state[this._namespace]; + return this._state[this._namespace]; } public set(key: string, value: any, force = false): void { @@ -41,9 +79,9 @@ export class MigrateStorage { throw new MigrateError(`Key already exists`); } - MigrateStorage._state[this._namespace][key] = value; + this._state[this._namespace][key] = value; - MigrateStorage._saveStateToFile(); + this._saveStateToFile(); } public delete(key: string, force = false): void { @@ -51,56 +89,24 @@ export class MigrateStorage { throw new MigrateError(`Key not found`); } - delete MigrateStorage._state[this._namespace][key]; + delete this._state[this._namespace][key]; - MigrateStorage._saveStateToFile(); + this._saveStateToFile(); } public has(key: string): boolean { - return MigrateStorage._state[this._namespace][key] !== undefined; + return this._state[this._namespace][key] !== undefined; } public clear(): void { - MigrateStorage._state[this._namespace] = {}; - - MigrateStorage._saveStateToFile(); - } - - public static clean(): void { - if (this._stateExistsInFile()) { - rmSync(this._filePath(), { force: true }); - } - } - - private static _stateExistsInFile(): boolean { - return existsSync(this._filePath()); - } - - private static _saveStateToFile() { - writeFileSync(this._filePath(), toJSON(MigrateStorage._state), { - flag: "w", - encoding: "utf8", - }); - } - - private static _readFullStateFromFile(): Record> { - if (!MigrateStorage._stateExistsInFile()) { - return {}; - } - - const fileContent = readFileSync(this._filePath(), { - encoding: "utf8", - }); - - return JSON.parse(fileContent); - } + this._state[this._namespace] = {}; - private static _filePath(): string { - return resolvePathToFile("cache", MigrateStorage._fileName); + this._saveStateToFile(); } } -export const DefaultStorage = lazyObject(() => new MigrateStorage(StorageNamespaces.Storage)); +export const DefaultStorage = lazyObject(() => new BaseStorage()); +export const UserStorage = lazyObject(() => new MigrateStorage(StorageNamespaces.Storage)); export const TransactionStorage = lazyObject(() => new MigrateStorage(StorageNamespaces.Transactions)); export const ArtifactStorage = lazyObject(() => new MigrateStorage(StorageNamespaces.Artifacts)); export const VerificationStorage = lazyObject(() => new MigrateStorage(StorageNamespaces.Verification)); diff --git a/src/tools/storage/TransactionProcessor.ts b/src/tools/storage/TransactionProcessor.ts index 94da82b9..7a1739c2 100644 --- a/src/tools/storage/TransactionProcessor.ts +++ b/src/tools/storage/TransactionProcessor.ts @@ -4,7 +4,7 @@ import { isFullyQualifiedName } from "hardhat/utils/contract-names"; import { TransactionStorage } from "./MigrateStorage"; -import { reporter } from "../reporters/Reporter"; +import { Reporter } from "../reporters/Reporter"; import { MigrateError } from "../../errors"; @@ -26,16 +26,11 @@ import { ContractDeployTxWithName, TransactionReceipt } from "../../types/deploy import { validateKeyDeploymentFields, validateKeyTxFields } from "../../types/type-checks"; @catchError -export class TransactionProcessor { - protected static _config: MigrateConfig; +export class BaseTransactionProcessor { + constructor(protected _config: MigrateConfig) {} - public static setConfig(config: MigrateConfig) { - this._config = config; - } - - @catchError @validateKeyDeploymentFields - public static saveDeploymentTransaction( + public saveDeploymentTransaction( args: ContractDeployTransaction, contractName: string, contractAddress: string, @@ -65,7 +60,7 @@ export class TransactionProcessor { * @param metadata */ @validateKeyTxFields - public static saveTransaction( + public saveTransaction( tx: KeyTransactionFields, receipt: TransactionReceiptParams | TransactionReceipt, metadata: MigrationMetadata, @@ -84,9 +79,8 @@ export class TransactionProcessor { ); } - @catchError @validateKeyDeploymentFields - public static async tryRestoreContractAddressByKeyFields(key: ContractDeployTxWithName): Promise { + public async tryRestoreContractAddressByKeyFields(key: ContractDeployTxWithName): Promise { const restoredData = this._tryGetDataFromStorage( createKeyDeploymentFieldsHash({ name: key.contractName, @@ -104,8 +98,7 @@ export class TransactionProcessor { return restoredData.contractAddress; } - @catchError - public static async tryRestoreContractAddressByName(contractName: string): Promise { + public async tryRestoreContractAddressByName(contractName: string): Promise { const restoredData: ContractFieldsToSave = this._tryGetDataFromStorage(contractName); if (!isAddress(restoredData.contractAddress) || !(await isDeployedContractAddress(restoredData.contractAddress))) { @@ -114,10 +107,8 @@ export class TransactionProcessor { return restoredData.contractAddress; } - - @catchError @validateKeyTxFields - public static tryRestoreSavedTransaction(key: KeyTransactionFields): TransactionFieldsToSave { + public tryRestoreSavedTransaction(key: KeyTransactionFields): TransactionFieldsToSave { return this._tryGetDataFromStorage( createKeyTxFieldsHash({ data: key.data, @@ -130,8 +121,7 @@ export class TransactionProcessor { ); } - @catchError - private static _saveTransaction( + private _saveTransaction( args: KeyTransactionFields, transaction: TransactionReceiptParams | TransactionReceipt, metadata: MigrationMetadata, @@ -158,7 +148,7 @@ export class TransactionProcessor { TransactionStorage.set(dataKey, dataToSave, true); } - private static _saveContract(keyByArgs: string, dataToSave: ContractFieldsToSave) { + private _saveContract(keyByArgs: string, dataToSave: ContractFieldsToSave) { if (TransactionStorage.has(keyByArgs) && !this._config.continue) { this._processCollision(keyByArgs, dataToSave); } @@ -166,7 +156,7 @@ export class TransactionProcessor { TransactionStorage.set(keyByArgs, dataToSave, true); } - private static _saveContractByName(contractName: string, dataToSave: ContractFieldsToSave) { + private _saveContractByName(contractName: string, dataToSave: ContractFieldsToSave) { if (TransactionStorage.has(contractName) && !this._config.continue) { this._processCollision(contractName, dataToSave); } @@ -174,7 +164,7 @@ export class TransactionProcessor { TransactionStorage.set(contractName, dataToSave, true); } - private static _processCollision(dataKey: string, dataToSave: TransactionFieldsToSave | ContractFieldsToSave) { + private _processCollision(dataKey: string, dataToSave: TransactionFieldsToSave | ContractFieldsToSave) { if (this._config.continue) { return; } @@ -186,27 +176,27 @@ export class TransactionProcessor { } = TransactionStorage.get(dataKey); if (oldData.contractAddress && isFullyQualifiedName(dataKey)) { - reporter!.notifyContractCollisionByName(oldData as ContractFieldsToSave, dataToSave as ContractFieldsToSave); + Reporter!.notifyContractCollisionByName(oldData as ContractFieldsToSave, dataToSave as ContractFieldsToSave); return; } if (oldData.contractAddress) { - reporter!.notifyContractCollisionByKeyFields(oldData as ContractFieldsToSave, dataToSave as ContractFieldsToSave); + Reporter!.notifyContractCollisionByKeyFields(oldData as ContractFieldsToSave, dataToSave as ContractFieldsToSave); return; } if (oldData.receipt) { - reporter!.notifyTransactionCollision(oldData as TransactionFieldsToSave, dataToSave as TransactionFieldsToSave); + Reporter!.notifyTransactionCollision(oldData as TransactionFieldsToSave, dataToSave as TransactionFieldsToSave); return; } - reporter!.notifyUnknownCollision(oldData.metadata, dataToSave); + Reporter!.notifyUnknownCollision(oldData.metadata, dataToSave); } - private static _tryGetDataFromStorage(key: string): any { + private _tryGetDataFromStorage(key: string): any { const value = TransactionStorage.get(key); if (!value) { @@ -216,3 +206,13 @@ export class TransactionProcessor { return value; } } + +export let TransactionProcessor: BaseTransactionProcessor | null = null; + +export function createTransactionProcessor(config: MigrateConfig) { + if (TransactionProcessor) { + return; + } + + TransactionProcessor = new BaseTransactionProcessor(config); +} diff --git a/src/tools/storage/VerificationProcessor.ts b/src/tools/storage/VerificationProcessor.ts index e00b2019..2dc738f1 100644 --- a/src/tools/storage/VerificationProcessor.ts +++ b/src/tools/storage/VerificationProcessor.ts @@ -7,14 +7,14 @@ import { catchError } from "../../utils"; import { VerifierArgs } from "../../types/verifier"; @catchError -export class VerificationProcessor { - public static saveVerificationFunction(verifierArgs: VerifierArgs) { +class BaseVerificationProcessor { + public saveVerificationFunction(verifierArgs: VerifierArgs) { const key = verifierArgs.contractAddress; VerificationStorage.set(key, verifierArgs, true); } - public static restoreSavedVerificationFunctions(filePath?: string): VerifierArgs[] { + public restoreSavedVerificationFunctions(filePath?: string): VerifierArgs[] { if (filePath) { const fileContent = readFileSync(filePath, { encoding: "utf8", @@ -28,7 +28,9 @@ export class VerificationProcessor { return Object.values(data); } - public static isVerificationDataSaved(contractAddress: string): boolean { + public isVerificationDataSaved(contractAddress: string): boolean { return VerificationStorage.has(contractAddress); } } + +export const VerificationProcessor = new BaseVerificationProcessor(); diff --git a/src/verifier/Verifier.ts b/src/verifier/Verifier.ts index 75396548..28cc9fb4 100644 --- a/src/verifier/Verifier.ts +++ b/src/verifier/Verifier.ts @@ -9,8 +9,8 @@ import { Args } from "../types/deployer"; import { VerifyConfig } from "../types/migrations"; import { VerifierArgs } from "../types/verifier"; -import { initReporter, reporter } from "../tools/reporters/Reporter"; -import { initNetworkManager } from "../tools/network/NetworkManager"; +import { createAndInitReporter, Reporter } from "../tools/reporters/Reporter"; +import { buildNetworkDeps } from "../tools/network/NetworkManager"; export class Verifier { private readonly _etherscanConfig: EtherscanConfig; @@ -29,11 +29,11 @@ export class Verifier { const toVerify = verifierBatchArgs.filter((args) => args.chainId && currentChainId == args.chainId); if (!toVerify || toVerify.length === 0) { - reporter!.reportNothingToVerify(); + Reporter!.reportNothingToVerify(); return; } - reporter!.reportVerificationBatchBegin(); + Reporter!.reportVerificationBatchBegin(); const parallel = this._config.parallel; @@ -52,7 +52,7 @@ export class Verifier { for (let attempts = 0; attempts < this._config.attempts; attempts++) { if (await instance.isVerified(contractAddress)) { - reporter!.reportAlreadyVerified(contractAddress, contractName); + Reporter!.reportAlreadyVerified(contractAddress, contractName); break; } @@ -80,20 +80,20 @@ export class Verifier { const isVerified = await instance.isVerified(contractAddress); if (isVerified) { - reporter!.reportSuccessfulVerification(contractAddress, contractName); + Reporter!.reportSuccessfulVerification(contractAddress, contractName); return; } else { - reporter!.reportVerificationError(contractAddress, contractName, "Verification failed"); + Reporter!.reportVerificationError(contractAddress, contractName, "Verification failed"); } } @catchError private _handleVerificationError(contractAddress: string, contractName: string, error: any) { if (error.message.toLowerCase().includes("already verified")) { - reporter!.reportAlreadyVerified(contractAddress, contractName); + Reporter!.reportAlreadyVerified(contractAddress, contractName); return; } else { - reporter!.reportVerificationError(contractAddress, contractName, error.message); + Reporter!.reportVerificationError(contractAddress, contractName, error.message); } } @@ -117,8 +117,8 @@ export class Verifier { }); } - public static async initialize(hre: HardhatRuntimeEnvironment): Promise { - initNetworkManager(hre); - await initReporter(hre.config.migrate); + public static async buildVerifierTaskDeps(hre: HardhatRuntimeEnvironment): Promise { + buildNetworkDeps(hre); + await createAndInitReporter(hre); } } diff --git a/test/integration/adapters/ethersAdapter.ts b/test/integration/adapters/ethersAdapter.ts index 45cbbcb6..346d2fad 100644 --- a/test/integration/adapters/ethersAdapter.ts +++ b/test/integration/adapters/ethersAdapter.ts @@ -51,7 +51,7 @@ describe("EthersAdapter", () => { let ContractWithConstructor: ContractFactory; beforeEach("setup", async function () { - await Migrator.initialize(this.hre); + await Migrator.buildMigrateTaskDeps(this.hre); pureEhtersAdapter = new EthersFactoryAdapter(this.hre); @@ -75,7 +75,7 @@ describe("EthersAdapter", () => { useEnvironment("minimal-typechain-ethers"); beforeEach(async function () { - await Migrator.initialize(this.hre); + await Migrator.buildMigrateTaskDeps(this.hre); ethersAdapter = new EthersContractAdapter(this.hre); }); diff --git a/test/integration/adapters/truffleAdapter.ts b/test/integration/adapters/truffleAdapter.ts index 8e4465cd..5f7b037a 100644 --- a/test/integration/adapters/truffleAdapter.ts +++ b/test/integration/adapters/truffleAdapter.ts @@ -55,7 +55,7 @@ describe("TruffleAdapter", () => { resetEthersProvider(); resetNetworkManager(); - await Migrator.initialize(this.hre); + await Migrator.buildMigrateTaskDeps(this.hre); adapter = new TruffleAdapter(this.hre); @@ -81,7 +81,7 @@ describe("TruffleAdapter", () => { let contractWithConstructorArtifact: TruffleContract; beforeEach("setup", async function () { - await Migrator.initialize(this.hre); + await Migrator.buildMigrateTaskDeps(this.hre); adapter = new TruffleAdapter(this.hre); diff --git a/test/integration/deployer/deployEthers.ts b/test/integration/deployer/deployEthers.ts index cdab3220..c112f224 100644 --- a/test/integration/deployer/deployEthers.ts +++ b/test/integration/deployer/deployEthers.ts @@ -22,7 +22,7 @@ describe("deployer", () => { let ContractWithPayableConstructor: ContractFactory; beforeEach("setup", async function () { - await Migrator.initialize(this.hre); + await Migrator.buildMigrateTaskDeps(this.hre); deployer = new Deployer(this.hre); diff --git a/test/integration/deployer/deployTruffle.ts b/test/integration/deployer/deployTruffle.ts index d0e94d89..396996e2 100644 --- a/test/integration/deployer/deployTruffle.ts +++ b/test/integration/deployer/deployTruffle.ts @@ -22,7 +22,7 @@ describe("Truffle -- deployer", () => { resetEthersProvider(); resetNetworkManager(); - await Migrator.initialize(this.hre); + await Migrator.buildMigrateTaskDeps(this.hre); deployer = new Deployer(this.hre); diff --git a/test/integration/deployer/deployTypechainEthers.ts b/test/integration/deployer/deployTypechainEthers.ts index 7382bc5f..e24b831b 100644 --- a/test/integration/deployer/deployTypechainEthers.ts +++ b/test/integration/deployer/deployTypechainEthers.ts @@ -22,7 +22,7 @@ describe("Ehters Typechain -- Deployer", () => { let deployer: Deployer; beforeEach("setup", async function () { - await Migrator.initialize(this.hre); + await Migrator.buildMigrateTaskDeps(this.hre); deployer = new Deployer(this.hre); diff --git a/test/integration/deployer/deployTypechainTruffle.ts b/test/integration/deployer/deployTypechainTruffle.ts index 92077f95..d866a765 100644 --- a/test/integration/deployer/deployTypechainTruffle.ts +++ b/test/integration/deployer/deployTypechainTruffle.ts @@ -31,7 +31,7 @@ describe("Truffle Typechain -- Deployer", () => { resetEthersProvider(); resetNetworkManager(); - await Migrator.initialize(this.hre); + await Migrator.buildMigrateTaskDeps(this.hre); deployer = new Deployer(this.hre); diff --git a/test/integration/transaction-storage.ts b/test/integration/transaction-storage.ts index edf03de6..65ca66a6 100644 --- a/test/integration/transaction-storage.ts +++ b/test/integration/transaction-storage.ts @@ -17,11 +17,11 @@ import { ContractWithPayableConstructor__factory, } from "../fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types"; -describe("TransactionStorage", async () => { +describe.only("TransactionStorage", async () => { useEnvironment("repeats-typechain-ethers"); beforeEach(async function () { - await Migrator.initialize(this.hre); + await Migrator.buildMigrateTaskDeps(this.hre); }); afterEach(async function () { @@ -57,7 +57,7 @@ describe("TransactionStorage", async () => { }; assert.equal( - await TransactionProcessor.tryRestoreContractAddressByKeyFields(keyFields), + await TransactionProcessor?.tryRestoreContractAddressByKeyFields(keyFields), await contract.getAddress(), ); }); @@ -66,7 +66,7 @@ describe("TransactionStorage", async () => { const contract = await deployer.deploy(ContractWithConstructorArguments__factory, ["hello"]); assert.equal( - await TransactionProcessor.tryRestoreContractAddressByName( + await TransactionProcessor?.tryRestoreContractAddressByName( "contracts/another-contracts/Contracts.sol:ContractWithConstructorArguments", ), await contract.getAddress(), @@ -97,7 +97,7 @@ describe("TransactionStorage", async () => { }; assert.equal( - await TransactionProcessor.tryRestoreContractAddressByKeyFields(keyFields), + await TransactionProcessor?.tryRestoreContractAddressByKeyFields(keyFields), await contract.getAddress(), ); }); @@ -121,8 +121,8 @@ describe("TransactionStorage", async () => { contractName: UNKNOWN_CONTRACT_NAME, }; - await expect(TransactionProcessor.tryRestoreContractAddressByKeyFields(keyFields)).to.be.rejectedWith( - "tryRestoreContractAddressByKeyFields(): Requested data not found in storage", + await expect(TransactionProcessor?.tryRestoreContractAddressByKeyFields(keyFields)).to.be.rejectedWith( + "BaseTransactionProcessor.tryRestoreContractAddressByKeyFields(): BaseTransactionProcessor._tryGetDataFromStorage(): Requested data not found in storage", ); }); @@ -145,8 +145,8 @@ describe("TransactionStorage", async () => { contractName: UNKNOWN_CONTRACT_NAME, }; - await expect(TransactionProcessor.tryRestoreContractAddressByKeyFields(keyFields)).to.be.rejectedWith( - "tryRestoreContractAddressByKeyFields(): Requested data not found in storage", + await expect(TransactionProcessor?.tryRestoreContractAddressByKeyFields(keyFields)).to.be.rejectedWith( + "BaseTransactionProcessor.tryRestoreContractAddressByKeyFields(): BaseTransactionProcessor._tryGetDataFromStorage(): Requested data not found in storage", ); }); @@ -173,7 +173,7 @@ describe("TransactionStorage", async () => { }; assert.equal( - await TransactionProcessor.tryRestoreContractAddressByKeyFields(keyFields), + await TransactionProcessor?.tryRestoreContractAddressByKeyFields(keyFields), await contract.getAddress(), ); }); @@ -197,8 +197,8 @@ describe("TransactionStorage", async () => { contractName: UNKNOWN_CONTRACT_NAME, }; - await expect(TransactionProcessor.tryRestoreContractAddressByKeyFields(keyFields)).to.be.rejectedWith( - "tryRestoreContractAddressByKeyFields(): Requested data not found in storage", + await expect(TransactionProcessor?.tryRestoreContractAddressByKeyFields(keyFields)).to.be.rejectedWith( + "BaseTransactionProcessor.tryRestoreContractAddressByKeyFields(): BaseTransactionProcessor._tryGetDataFromStorage(): Requested data not found in storage", ); }); }); diff --git a/test/unit/linker.ts b/test/unit/linker.ts index 4a93fec4..e43bbf56 100644 --- a/test/unit/linker.ts +++ b/test/unit/linker.ts @@ -5,11 +5,11 @@ import { Linker } from "../../src/deployer/Linker"; describe("Linker", () => { describe("validateBytecode", () => { it("should not throw error if bytecode does not contain unresolved libraries", () => { - expect(Linker.isBytecodeNeedsLinking("0x12345678")).to.be.true; + expect(Linker?.isBytecodeNeedsLinking("0x12345678")).to.be.true; }); it("should throw error if bytecode contains unresolved libraries", () => { - expect(Linker.isBytecodeNeedsLinking("0x1234__LibraryName__5678")).to.be.false; + expect(Linker?.isBytecodeNeedsLinking("0x1234__LibraryName__5678")).to.be.false; }); }); }); From 86dbdb079718b4cdb9fad04cb0a83f1863bd824d Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Mon, 18 Dec 2023 23:17:05 +0200 Subject: [PATCH 03/34] Used spinner instead of console.log for network errors. --- src/tools/network/NetworkManager.ts | 17 ++++++-- src/tools/reporters/Reporter.ts | 67 +++++++++++++++++++---------- 2 files changed, 58 insertions(+), 26 deletions(-) diff --git a/src/tools/network/NetworkManager.ts b/src/tools/network/NetworkManager.ts index 3ac8756d..cd45e752 100644 --- a/src/tools/network/NetworkManager.ts +++ b/src/tools/network/NetworkManager.ts @@ -13,6 +13,8 @@ import { sleep } from "../../utils"; import { MAX_RECONNECT_ATTEMPTS, RECONNECT_INTERVAL } from "../../constants"; class StateMiddleware { + private static _isNetworkIssue: boolean = false; + public static async retry any>( fn: T, args: Parameters, @@ -21,20 +23,29 @@ class StateMiddleware { try { const result = await fn(...args); - reporter?.resetSpinnerMessageIfActive(); + if (this._isNetworkIssue) { + Reporter?.stopSpinner(); + + this._isNetworkIssue = false; + } return result; } catch (e: any) { - // TODO: use spinner instead of console.log. const networkErrorCodes = ["EAI_AGAIN", "ENETDOWN", "ENETUNREACH", "ENOTFOUND", "ECONNABORTED"]; const isNetworkError = networkErrorCodes.includes(e.code) || e.isAxiosError; if (!isNetworkError) { + Reporter?.stopSpinner(); + throw e; } + await Reporter?.startSpinner("network-error"); + // TODO: set timeout manually. - reporter!.reportNetworkError(retryCount, fn.name, e); + Reporter!.reportNetworkError(retryCount, fn.name, e); + + this._isNetworkIssue = true; await sleep(RECONNECT_INTERVAL); diff --git a/src/tools/reporters/Reporter.ts b/src/tools/reporters/Reporter.ts index 55ee97c3..73ebe81e 100644 --- a/src/tools/reporters/Reporter.ts +++ b/src/tools/reporters/Reporter.ts @@ -22,8 +22,10 @@ class BaseReporter { private _config: MigrateConfig = {} as any; private _network: Network = {} as any; - private _isSpinnerActive: boolean = false; - private _spinnerMessageIfActive: string | null = null; + private _spinner: ora.Ora | null = null; + private _spinnerMessage: string | null = null; + private _spinnerInterval: NodeJS.Timeout | null = null; + private _spinnerState: string[] = []; private _nativeSymbol: string = ""; private _explorerUrl: string = ""; @@ -63,29 +65,44 @@ class BaseReporter { const formatPendingTimeTask = async () => this._formatPendingTime(tx, timeStart, blockStart); - const spinner = ora(await formatPendingTimeTask()).start(); + return this.startSpinner("tx-report", formatPendingTimeTask); + } - const setSpinnerText = async () => { - if (!this._isSpinnerActive) return; + public async startSpinner( + id: string, + getSpinnerText: (args?: any) => string | Promise = this._getDefaultMessage, + ) { + if (this._spinnerState.includes(id)) return; - spinner.text = await formatPendingTimeTask(); + if (this._spinnerState.length === 0) { + this._spinner = ora(await getSpinnerText()).start(); - setTimeout(setSpinnerText, this._config.transactionStatusCheckInterval); - }; + this._spinnerInterval = setInterval(async () => { + if (!this._spinner) { + clearInterval(this._spinnerInterval!); - this._isSpinnerActive = true; + return; + } - await setSpinnerText(); + this._spinner.text = await getSpinnerText(); + }, this._config.transactionStatusCheckInterval); + } - return spinner; + this._spinnerState.push(id); } - public stopTxReporting(spinner: ora.Ora) { - this._isSpinnerActive = false; + public stopSpinner() { + if (!this._spinner) return; - this._spinnerMessageIfActive = null; + this._spinnerMessage = null; + this._spinnerState.pop(); - spinner.stop(); + if (this._spinnerState.length === 0) { + clearInterval(this._spinnerInterval!); + + this._spinner.stop(); + this._spinner = null; + } } public async reportTransactionReceipt(receipt: TransactionReceipt) { @@ -277,13 +294,9 @@ class BaseReporter { this._warningsToPrint.set(key, output); } - public resetSpinnerMessageIfActive() { - this._spinnerMessageIfActive = null; - } - public reportNetworkError(retry: number, fnName: string, error: Error) { - if (this._isSpinnerActive) { - this._spinnerMessageIfActive = `Network error in '${fnName}': Reconnect attempt ${retry}...`; + if (this._spinner) { + this._spinnerMessage = `Network error in '${fnName}': Reconnect attempt ${retry}...`; return; } @@ -294,6 +307,14 @@ class BaseReporter { console.log(prefix + postfix); } + private _getDefaultMessage(): string { + if (this && this._spinnerMessage) { + return this._spinnerMessage; + } + + return `Awaiting network response...`; + } + private _parseTransactionTitle(tx: TransactionResponse, instanceName: string): string { if (tx.to === null) { if (instanceName.split(":").length == 1) { @@ -307,8 +328,8 @@ class BaseReporter { } private async _formatPendingTime(tx: TransactionResponse, startTime: number, blockStart: number): Promise { - if (this._spinnerMessageIfActive) { - return this._spinnerMessageIfActive; + if (this._spinnerMessage) { + return this._spinnerMessage; } return `Confirmations: ${await tx.confirmations()}; Blocks: ${ From 1a594b3b4344052ef9c104883bad8e187c00fa1e Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Mon, 18 Dec 2023 23:18:02 +0200 Subject: [PATCH 04/34] Removed fixed TODO --- src/tools/network/NetworkManager.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tools/network/NetworkManager.ts b/src/tools/network/NetworkManager.ts index cd45e752..d57e9ce3 100644 --- a/src/tools/network/NetworkManager.ts +++ b/src/tools/network/NetworkManager.ts @@ -42,7 +42,6 @@ class StateMiddleware { await Reporter?.startSpinner("network-error"); - // TODO: set timeout manually. Reporter!.reportNetworkError(retryCount, fn.name, e); this._isNetworkIssue = true; From 2110e37770f691bfdde470e30c9a0d7d453534cc Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Mon, 18 Dec 2023 23:19:37 +0200 Subject: [PATCH 05/34] Updated versions and CHANGELOG.md --- CHANGELOG.md | 6 + package-lock.json | 3837 +++++++++++++++++++++++++++++++++++++++++---- package.json | 2 +- 3 files changed, 3554 insertions(+), 291 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9daf9c7d..e8a44ee5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Version 2.0.0-beta.1 + +* Added handling of the custom chains specified in the Hardhat config +* Refactored the architecture and made it consistent +* Used spinner instead of console.log for network errors + ## Version 2.0.0-alpha.22 * Enforce the overwriting in ArtifactStorage in the case of bytecodeHash as a key diff --git a/package-lock.json b/package-lock.json index 3e7ba99c..f597a23d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@solarity/hardhat-migrate", - "version": "2.0.0-alpha.17", + "version": "2.0.0-beta.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@solarity/hardhat-migrate", - "version": "2.0.0-alpha.17", + "version": "2.0.0-beta.1", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -9598,6 +9598,215 @@ "utf-8-validate": "5.0.7" } }, + "node_modules/ganache/node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "extraneous": true, + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/ganache/node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "extraneous": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/ganache/node_modules/@discoveryjs/json-ext": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", + "integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==", + "extraneous": true, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/ganache/node_modules/@jridgewell/gen-mapping": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz", + "integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==", + "extraneous": true, + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/ganache/node_modules/@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "extraneous": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/ganache/node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "extraneous": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/ganache/node_modules/@jridgewell/source-map": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.2.tgz", + "integrity": "sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==", + "extraneous": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "node_modules/ganache/node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.17", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz", + "integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==", + "extraneous": true, + "dependencies": { + "@jridgewell/resolve-uri": "3.1.0", + "@jridgewell/sourcemap-codec": "1.4.14" + } + }, + "node_modules/ganache/node_modules/@microsoft/api-extractor": { + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.20.1.tgz", + "integrity": "sha512-T7cqcK+JpvHGOj7cD2ZCCWS7Xgru1uOqZwrV/FSUdyKVs5fopZcbBSuetwD/akst3O7Ypryg3UOLP54S/vnVmA==", + "extraneous": true, + "dependencies": { + "@microsoft/api-extractor-model": "7.16.0", + "@microsoft/tsdoc": "0.13.2", + "@microsoft/tsdoc-config": "~0.15.2", + "@rushstack/node-core-library": "3.45.1", + "@rushstack/rig-package": "0.3.8", + "@rushstack/ts-command-line": "4.10.7", + "colors": "~1.2.1", + "lodash": "~4.17.15", + "resolve": "~1.17.0", + "semver": "~7.3.0", + "source-map": "~0.6.1", + "typescript": "~4.5.2" + }, + "bin": { + "api-extractor": "bin/api-extractor" + } + }, + "node_modules/ganache/node_modules/@microsoft/api-extractor-model": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.16.0.tgz", + "integrity": "sha512-0FOrbNIny8mzBrzQnSIkEjAXk0JMSnPmWYxt3ZDTPVg9S8xIPzB6lfgTg9+Mimu0RKCpGKBpd+v2WcR5vGzyUQ==", + "extraneous": true, + "dependencies": { + "@microsoft/tsdoc": "0.13.2", + "@microsoft/tsdoc-config": "~0.15.2", + "@rushstack/node-core-library": "3.45.1" + } + }, + "node_modules/ganache/node_modules/@microsoft/api-extractor/node_modules/typescript": { + "version": "4.5.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", + "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", + "extraneous": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/ganache/node_modules/@microsoft/tsdoc": { + "version": "0.13.2", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.13.2.tgz", + "integrity": "sha512-WrHvO8PDL8wd8T2+zBGKrMwVL5IyzR3ryWUsl0PXgEV0QHup4mTLi0QcATefGI6Gx9Anu7vthPyyyLpY0EpiQg==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@microsoft/tsdoc-config": { + "version": "0.15.2", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.15.2.tgz", + "integrity": "sha512-mK19b2wJHSdNf8znXSMYVShAHktVr/ib0Ck2FA3lsVBSEhSI/TfXT7DJQkAYgcztTuwazGcg58ZjYdk0hTCVrA==", + "extraneous": true, + "dependencies": { + "@microsoft/tsdoc": "0.13.2", + "ajv": "~6.12.6", + "jju": "~1.4.0", + "resolve": "~1.19.0" + } + }, + "node_modules/ganache/node_modules/@microsoft/tsdoc-config/node_modules/resolve": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", + "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", + "extraneous": true, + "dependencies": { + "is-core-module": "^2.1.0", + "path-parse": "^1.0.6" + } + }, + "node_modules/ganache/node_modules/@rushstack/node-core-library": { + "version": "3.45.1", + "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.45.1.tgz", + "integrity": "sha512-BwdssTNe007DNjDBxJgInHg8ePytIPyT0La7ZZSQZF9+rSkT42AygXPGvbGsyFfEntjr4X37zZSJI7yGzL16cQ==", + "extraneous": true, + "dependencies": { + "@types/node": "12.20.24", + "colors": "~1.2.1", + "fs-extra": "~7.0.1", + "import-lazy": "~4.0.0", + "jju": "~1.4.0", + "resolve": "~1.17.0", + "semver": "~7.3.0", + "timsort": "~0.3.0", + "z-schema": "~5.0.2" + } + }, + "node_modules/ganache/node_modules/@rushstack/node-core-library/node_modules/@types/node": { + "version": "12.20.24", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.24.tgz", + "integrity": "sha512-yxDeaQIAJlMav7fH5AQqPH1u8YIuhYJXYBzxaQ4PifsU0GDO38MSdmEDeRlIxrKbC6NbEaaEHDanWb+y30U8SQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@rushstack/rig-package": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@rushstack/rig-package/-/rig-package-0.3.8.tgz", + "integrity": "sha512-MDWg1xovea99PWloSiYMjFcCLsrdjFtYt6aOyHNs5ojn5mxrzR6U9F83hvbQjTWnKPMvZtr0vcek+4n+OQOp3Q==", + "extraneous": true, + "dependencies": { + "resolve": "~1.17.0", + "strip-json-comments": "~3.1.1" + } + }, + "node_modules/ganache/node_modules/@rushstack/ts-command-line": { + "version": "4.10.7", + "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.10.7.tgz", + "integrity": "sha512-CjS+DfNXUSO5Ab2wD1GBGtUTnB02OglRWGqfaTcac9Jn45V5MeUOsq/wA8wEeS5Y/3TZ2P1k+IWdVDiuOFP9Og==", + "extraneous": true, + "dependencies": { + "@types/argparse": "1.0.38", + "argparse": "~1.0.9", + "colors": "~1.2.1", + "string-argv": "~0.3.1" + } + }, "node_modules/ganache/node_modules/@trufflesuite/bigint-buffer": { "version": "1.1.10", "resolved": "https://registry.npmjs.org/@trufflesuite/bigint-buffer/-/bigint-buffer-1.1.10.tgz", @@ -9694,6 +9903,42 @@ } } }, + "node_modules/ganache/node_modules/@tsconfig/node10": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@tsconfig/node16": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", + "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@types/abstract-leveldown": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@types/abstract-leveldown/-/abstract-leveldown-7.2.0.tgz", + "integrity": "sha512-q5veSX6zjUy/DlDhR4Y4cU0k2Ar+DT2LUraP00T19WLmTO6Se1djepCCaqU6nQrwcJ5Hyo/CWqxTzrrFg8eqbQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@types/argparse": { + "version": "1.0.38", + "resolved": "https://registry.npmjs.org/@types/argparse/-/argparse-1.0.38.tgz", + "integrity": "sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==", + "extraneous": true + }, "node_modules/ganache/node_modules/@types/bn.js": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", @@ -9704,6 +9949,38 @@ "@types/node": "*" } }, + "node_modules/ganache/node_modules/@types/eslint": { + "version": "8.4.10", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.4.10.tgz", + "integrity": "sha512-Sl/HOqN8NKPmhWo2VBEPm0nvHnu2LL3v9vKo8MEq0EtbJ4eVzGPl41VNPvn5E1i5poMk4/XD8UriLHpJvEP/Nw==", + "extraneous": true, + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "node_modules/ganache/node_modules/@types/eslint-scope": { + "version": "3.7.4", + "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.4.tgz", + "integrity": "sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA==", + "extraneous": true, + "dependencies": { + "@types/eslint": "*", + "@types/estree": "*" + } + }, + "node_modules/ganache/node_modules/@types/estree": { + "version": "0.0.50", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.50.tgz", + "integrity": "sha512-C6N5s2ZFtuZRj54k2/zyRhNDjJwwcViAM3Nbm8zjBpbqAdZ00mr0CFxvSKeO8Y/e03WVFLpQMdHYVfUd6SB+Hw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@types/json-schema": { + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "extraneous": true + }, "node_modules/ganache/node_modules/@types/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/@types/lru-cache/-/lru-cache-5.1.1.tgz", @@ -9711,6 +9988,12 @@ "dev": true, "peer": true }, + "node_modules/ganache/node_modules/@types/mocha": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.0.0.tgz", + "integrity": "sha512-scN0hAWyLVAvLR9AyW7HoFF5sJZglyBsbPuHO4fv7JRvfmPBMfp1ozWqOf/e4wwPNxezBZXRfWzMb6iFLgEVRA==", + "extraneous": true + }, "node_modules/ganache/node_modules/@types/node": { "version": "17.0.0", "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.0.tgz", @@ -9725,6 +10008,191 @@ "dev": true, "peer": true }, + "node_modules/ganache/node_modules/@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@webassemblyjs/ast": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz", + "integrity": "sha512-ukBh14qFLjxTQNTXocdyksN5QdM28S1CxHt2rdskFyL+xFV7VremuBLVbmCePj+URalXBENx/9Lm7lnhihtCSw==", + "extraneous": true, + "dependencies": { + "@webassemblyjs/helper-numbers": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1" + } + }, + "node_modules/ganache/node_modules/@webassemblyjs/floating-point-hex-parser": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.1.tgz", + "integrity": "sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@webassemblyjs/helper-api-error": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.1.tgz", + "integrity": "sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@webassemblyjs/helper-buffer": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.1.tgz", + "integrity": "sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@webassemblyjs/helper-numbers": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.1.tgz", + "integrity": "sha512-vDkbxiB8zfnPdNK9Rajcey5C0w+QJugEglN0of+kmO8l7lDb77AnlKYQF7aarZuCrv+l0UvqL+68gSDr3k9LPQ==", + "extraneous": true, + "dependencies": { + "@webassemblyjs/floating-point-hex-parser": "1.11.1", + "@webassemblyjs/helper-api-error": "1.11.1", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/ganache/node_modules/@webassemblyjs/helper-wasm-bytecode": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.1.tgz", + "integrity": "sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@webassemblyjs/helper-wasm-section": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.1.tgz", + "integrity": "sha512-10P9No29rYX1j7F3EVPX3JvGPQPae+AomuSTPiF9eBQeChHI6iqjMIwR9JmOJXwpnn/oVGDk7I5IlskuMwU/pg==", + "extraneous": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1" + } + }, + "node_modules/ganache/node_modules/@webassemblyjs/ieee754": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.1.tgz", + "integrity": "sha512-hJ87QIPtAMKbFq6CGTkZYJivEwZDbQUgYd3qKSadTNOhVY7p+gfP6Sr0lLRVTaG1JjFj+r3YchoqRYxNH3M0GQ==", + "extraneous": true, + "dependencies": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "node_modules/ganache/node_modules/@webassemblyjs/leb128": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.1.tgz", + "integrity": "sha512-BJ2P0hNZ0u+Th1YZXJpzW6miwqQUGcIHT1G/sf72gLVD9DZ5AdYTqPNbHZh6K1M5VmKvFXwGSWZADz+qBWxeRw==", + "extraneous": true, + "dependencies": { + "@xtuc/long": "4.2.2" + } + }, + "node_modules/ganache/node_modules/@webassemblyjs/utf8": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.1.tgz", + "integrity": "sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@webassemblyjs/wasm-edit": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.1.tgz", + "integrity": "sha512-g+RsupUC1aTHfR8CDgnsVRVZFJqdkFHpsHMfJuWQzWU3tvnLC07UqHICfP+4XyL2tnr1amvl1Sdp06TnYCmVkA==", + "extraneous": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/helper-wasm-section": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1", + "@webassemblyjs/wasm-opt": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1", + "@webassemblyjs/wast-printer": "1.11.1" + } + }, + "node_modules/ganache/node_modules/@webassemblyjs/wasm-gen": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.1.tgz", + "integrity": "sha512-F7QqKXwwNlMmsulj6+O7r4mmtAlCWfO/0HdgOxSklZfQcDu0TpLiD1mRt/zF25Bk59FIjEuGAIyn5ei4yMfLhA==", + "extraneous": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/ieee754": "1.11.1", + "@webassemblyjs/leb128": "1.11.1", + "@webassemblyjs/utf8": "1.11.1" + } + }, + "node_modules/ganache/node_modules/@webassemblyjs/wasm-opt": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.1.tgz", + "integrity": "sha512-VqnkNqnZlU5EB64pp1l7hdm3hmQw7Vgqa0KF/KCNO9sIpI6Fk6brDEiX+iCOYrvMuBWDws0NkTOxYEb85XQHHw==", + "extraneous": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1" + } + }, + "node_modules/ganache/node_modules/@webassemblyjs/wasm-parser": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.1.tgz", + "integrity": "sha512-rrBujw+dJu32gYB7/Lup6UhdkPx9S9SnobZzRVL7VcBH9Bt9bCBLEuX/YXOOtBsOZ4NQrRykKhffRWHvigQvOA==", + "extraneous": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-api-error": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/ieee754": "1.11.1", + "@webassemblyjs/leb128": "1.11.1", + "@webassemblyjs/utf8": "1.11.1" + } + }, + "node_modules/ganache/node_modules/@webassemblyjs/wast-printer": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.1.tgz", + "integrity": "sha512-IQboUWM4eKzWW+N/jij2sRatKMh99QEelo3Eb2q0qXkvPRISAj8Qxtmw5itwqK+TTkBuUIE45AxYPToqPtL5gg==", + "extraneous": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/ganache/node_modules/@webpack-cli/configtest": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.2.0.tgz", + "integrity": "sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@webpack-cli/info": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.5.0.tgz", + "integrity": "sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ==", + "extraneous": true, + "dependencies": { + "envinfo": "^7.7.3" + } + }, + "node_modules/ganache/node_modules/@webpack-cli/serve": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.7.0.tgz", + "integrity": "sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/@xtuc/long": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", + "extraneous": true + }, "node_modules/ganache/node_modules/abstract-level": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/abstract-level/-/abstract-level-1.0.3.tgz", @@ -9774,6 +10242,139 @@ "node": ">=10" } }, + "node_modules/ganache/node_modules/acorn": { + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", + "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", + "extraneous": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ganache/node_modules/acorn-import-assertions": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz", + "integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "extraneous": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ganache/node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "extraneous": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "node_modules/ganache/node_modules/ajv-keywords": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "extraneous": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "extraneous": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "extraneous": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/ganache/node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "extraneous": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/ganache/node_modules/asn1.js": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", + "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", + "extraneous": true, + "dependencies": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "safer-buffer": "^2.1.0" + } + }, + "node_modules/ganache/node_modules/asn1.js/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/assert": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-2.0.0.tgz", + "integrity": "sha512-se5Cd+js9dXJnu6Ag2JFc00t+HmHOen+8Q+L7O9zI0PqQXr20uk2J0XQqMxZEeo5U50o8Nvmmx7dZrl+Ufr35A==", + "extraneous": true, + "dependencies": { + "es6-object-assign": "^1.1.0", + "is-nan": "^1.2.1", + "object-is": "^1.0.1", + "util": "^0.12.0" + } + }, "node_modules/ganache/node_modules/async": { "version": "2.6.4", "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", @@ -9794,6 +10395,21 @@ "async": "^2.4.0" } }, + "node_modules/ganache/node_modules/available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "extraneous": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "extraneous": true + }, "node_modules/ganache/node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -9817,6 +10433,52 @@ "license": "MIT", "peer": true }, + "node_modules/ganache/node_modules/big.js": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", + "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", + "extraneous": true, + "engines": { + "node": "*" + } + }, + "node_modules/ganache/node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "extraneous": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/ganache/node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "extraneous": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/ganache/node_modules/brorand": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", @@ -9826,160 +10488,98 @@ "license": "MIT", "peer": true }, - "node_modules/ganache/node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "inBundle": true, - "license": "MIT", - "peer": true, - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } + "node_modules/ganache/node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "extraneous": true }, - "node_modules/ganache/node_modules/bufferutil": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz", - "integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "peer": true, + "node_modules/ganache/node_modules/browserify-aes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "extraneous": true, "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" } }, - "node_modules/ganache/node_modules/catering": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/catering/-/catering-2.1.1.tgz", - "integrity": "sha512-K7Qy8O9p76sL3/3m7/zLKbRkyOlSZAgzEaLhyj2mXS8PsCud2Eo4hAb8aLtZqHh0QGqLcb9dlJSu6lHRVENm1w==", - "dev": true, - "inBundle": true, - "license": "MIT", - "peer": true, - "engines": { - "node": ">=6" + "node_modules/ganache/node_modules/browserify-cipher": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", + "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", + "extraneous": true, + "dependencies": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" } }, - "node_modules/ganache/node_modules/elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "dev": true, - "inBundle": true, - "license": "MIT", - "peer": true, + "node_modules/ganache/node_modules/browserify-des": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", + "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", + "extraneous": true, "dependencies": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" } }, - "node_modules/ganache/node_modules/elliptic/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true, - "inBundle": true, - "license": "MIT", - "peer": true - }, - "node_modules/ganache/node_modules/emittery": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.10.0.tgz", - "integrity": "sha512-AGvFfs+d0JKCJQ4o01ASQLGPmSCxgfU9RFXvzPvZdjKK8oscynksuJhWrSTSw7j7Ep/sZct5b5ZhYCi8S/t0HQ==", - "dev": true, - "peer": true, - "engines": { - "node": ">=12" + "node_modules/ganache/node_modules/browserify-rsa": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.1.0.tgz", + "integrity": "sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog==", + "extraneous": true, + "dependencies": { + "bn.js": "^5.0.0", + "randombytes": "^2.0.1" } }, - "node_modules/ganache/node_modules/hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "dev": true, - "inBundle": true, - "license": "MIT", - "peer": true, + "node_modules/ganache/node_modules/browserify-sign": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", + "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==", + "extraneous": true, "dependencies": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" + "bn.js": "^5.1.1", + "browserify-rsa": "^4.0.1", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "elliptic": "^6.5.3", + "inherits": "^2.0.4", + "parse-asn1": "^5.1.5", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" } }, - "node_modules/ganache/node_modules/hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "dev": true, - "inBundle": true, - "license": "MIT", - "peer": true, + "node_modules/ganache/node_modules/browserslist": { + "version": "4.21.4", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.4.tgz", + "integrity": "sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw==", + "extraneous": true, "dependencies": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" + "caniuse-lite": "^1.0.30001400", + "electron-to-chromium": "^1.4.251", + "node-releases": "^2.0.6", + "update-browserslist-db": "^1.0.9" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, - "node_modules/ganache/node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "inBundle": true, - "license": "BSD-3-Clause", - "peer": true - }, - "node_modules/ganache/node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true, - "inBundle": true, - "license": "ISC", - "peer": true - }, - "node_modules/ganache/node_modules/is-buffer": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", - "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", + "node_modules/ganache/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", "dev": true, "funding": [ { @@ -9998,158 +10598,2114 @@ "inBundle": true, "license": "MIT", "peer": true, - "engines": { - "node": ">=4" + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" } }, - "node_modules/ganache/node_modules/keccak": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.2.tgz", - "integrity": "sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ==", + "node_modules/ganache/node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/bufferutil": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz", + "integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==", "dev": true, "hasInstallScript": true, - "inBundle": true, - "license": "MIT", + "optional": true, "peer": true, "dependencies": { - "node-addon-api": "^2.0.0", - "node-gyp-build": "^4.2.0", - "readable-stream": "^3.6.0" + "node-gyp-build": "^4.3.0" }, "engines": { - "node": ">=10.0.0" + "node": ">=6.14.2" } }, - "node_modules/ganache/node_modules/level-concat-iterator": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-3.1.0.tgz", - "integrity": "sha512-BWRCMHBxbIqPxJ8vHOvKUsaO0v1sLYZtjN3K2iZJsRBYtp+ONsY6Jfi6hy9K3+zolgQRryhIn2NRZjZnWJ9NmQ==", - "dev": true, - "inBundle": true, - "license": "MIT", - "peer": true, + "node_modules/ganache/node_modules/builtin-status-codes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", + "integrity": "sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "extraneous": true, "dependencies": { - "catering": "^2.1.0" - }, + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "node_modules/ganache/node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "extraneous": true, "engines": { "node": ">=10" } }, - "node_modules/ganache/node_modules/level-supports": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-2.1.0.tgz", - "integrity": "sha512-E486g1NCjW5cF78KGPrMDRBYzPuueMZ6VBXHT6gC7A8UYWGiM14fGgp+s/L1oFfDWSPV/+SFkYCmZ0SiESkRKA==", + "node_modules/ganache/node_modules/caniuse-lite": { + "version": "1.0.30001435", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001435.tgz", + "integrity": "sha512-kdCkUTjR+v4YAJelyiDTqiu82BDr4W4CP5sgTA0ZBmqn30XfS2ZghPLMowik9TPhS+psWJiUNxsqLyurDbmutA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/catering": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/catering/-/catering-2.1.1.tgz", + "integrity": "sha512-K7Qy8O9p76sL3/3m7/zLKbRkyOlSZAgzEaLhyj2mXS8PsCud2Eo4hAb8aLtZqHh0QGqLcb9dlJSu6lHRVENm1w==", "dev": true, "inBundle": true, "license": "MIT", "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "extraneous": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, "engines": { "node": ">=10" } }, - "node_modules/ganache/node_modules/level-transcoder": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/level-transcoder/-/level-transcoder-1.0.1.tgz", - "integrity": "sha512-t7bFwFtsQeD8cl8NIoQ2iwxA0CL/9IFw7/9gAjOonH0PWTTiRfY7Hq+Ejbsxh86tXobDQ6IOiddjNYIfOBs06w==", - "dev": true, - "peer": true, + "node_modules/ganache/node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "extraneous": true, "dependencies": { - "buffer": "^6.0.3", - "module-error": "^1.0.1" + "has-flag": "^4.0.0" }, "engines": { - "node": ">=12" + "node": ">=8" } }, - "node_modules/ganache/node_modules/leveldown": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/leveldown/-/leveldown-6.1.0.tgz", - "integrity": "sha512-8C7oJDT44JXxh04aSSsfcMI8YiaGRhOFI9/pMEL7nWJLVsWajDPTRxsSHTM2WcTVY5nXM+SuRHzPPi0GbnDX+w==", - "dev": true, - "hasInstallScript": true, - "inBundle": true, - "license": "MIT", - "peer": true, + "node_modules/ganache/node_modules/chokidar": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.2.tgz", + "integrity": "sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==", + "extraneous": true, "dependencies": { - "abstract-leveldown": "^7.2.0", - "napi-macros": "~2.0.0", - "node-gyp-build": "^4.3.0" + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" }, "engines": { - "node": ">=10.12.0" + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" } }, - "node_modules/ganache/node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true, - "peer": true + "node_modules/ganache/node_modules/chrome-trace-event": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz", + "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==", + "extraneous": true, + "engines": { + "node": ">=6.0" + } }, - "node_modules/ganache/node_modules/minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", - "dev": true, - "inBundle": true, - "license": "ISC", - "peer": true + "node_modules/ganache/node_modules/cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "extraneous": true, + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } }, - "node_modules/ganache/node_modules/minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", - "dev": true, - "inBundle": true, - "license": "MIT", - "peer": true + "node_modules/ganache/node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "extraneous": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } }, - "node_modules/ganache/node_modules/module-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/module-error/-/module-error-1.0.2.tgz", - "integrity": "sha512-0yuvsqSCv8LbaOKhnsQ/T5JhyFlCYLPXK3U2sgV10zoKQwzs/MyfuQUOZQ1V/6OCOJsK/TRgNVrPuPDqtdMFtA==", - "dev": true, - "peer": true, + "node_modules/ganache/node_modules/clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "extraneous": true, + "dependencies": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "extraneous": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/ganache/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/colorette": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.19.tgz", + "integrity": "sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/colors": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.2.5.tgz", + "integrity": "sha512-erNRLao/Y3Fv54qUa0LBB+//Uf3YwMUmdJinN20yMXm9zdKKqH9wt7R9IIVZ+K7ShzfpLV/Zg8+VyrBJYB4lpg==", + "extraneous": true, + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/ganache/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "extraneous": true + }, + "node_modules/ganache/node_modules/create-ecdh": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz", + "integrity": "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==", + "extraneous": true, + "dependencies": { + "bn.js": "^4.1.0", + "elliptic": "^6.5.3" + } + }, + "node_modules/ganache/node_modules/create-ecdh/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "extraneous": true, + "dependencies": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "node_modules/ganache/node_modules/create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "extraneous": true, + "dependencies": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "node_modules/ganache/node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/cross-env": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", + "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", + "extraneous": true, + "dependencies": { + "cross-spawn": "^7.0.1" + }, + "bin": { + "cross-env": "src/bin/cross-env.js", + "cross-env-shell": "src/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=10.14", + "npm": ">=6", + "yarn": ">=1" + } + }, + "node_modules/ganache/node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "extraneous": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/ganache/node_modules/crypto-browserify": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", + "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "extraneous": true, + "dependencies": { + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" + }, + "engines": { + "node": "*" + } + }, + "node_modules/ganache/node_modules/debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "extraneous": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + } + }, + "node_modules/ganache/node_modules/debug/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "extraneous": true + }, + "node_modules/ganache/node_modules/decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "extraneous": true, "engines": { "node": ">=10" } }, - "node_modules/ganache/node_modules/napi-macros": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.0.0.tgz", - "integrity": "sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg==", + "node_modules/ganache/node_modules/define-properties": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", + "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", + "extraneous": true, + "dependencies": { + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/des.js": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", + "integrity": "sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA==", + "extraneous": true, + "dependencies": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "node_modules/ganache/node_modules/diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "extraneous": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/ganache/node_modules/diffie-hellman": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", + "extraneous": true, + "dependencies": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + } + }, + "node_modules/ganache/node_modules/diffie-hellman/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/electron-to-chromium": { + "version": "1.4.284", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.284.tgz", + "integrity": "sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/elliptic": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", "dev": true, "inBundle": true, "license": "MIT", - "peer": true + "peer": true, + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } }, - "node_modules/ganache/node_modules/node-addon-api": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", - "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", + "node_modules/ganache/node_modules/elliptic/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", "dev": true, "inBundle": true, "license": "MIT", "peer": true }, - "node_modules/ganache/node_modules/node-gyp-build": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", - "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==", + "node_modules/ganache/node_modules/emittery": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.10.0.tgz", + "integrity": "sha512-AGvFfs+d0JKCJQ4o01ASQLGPmSCxgfU9RFXvzPvZdjKK8oscynksuJhWrSTSw7j7Ep/sZct5b5ZhYCi8S/t0HQ==", "dev": true, - "inBundle": true, - "license": "MIT", "peer": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/ganache/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "extraneous": true + }, + "node_modules/ganache/node_modules/emojis-list": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", + "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", + "extraneous": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/ganache/node_modules/enhanced-resolve": { + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz", + "integrity": "sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ==", + "extraneous": true, + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/ganache/node_modules/envinfo": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.8.1.tgz", + "integrity": "sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==", + "extraneous": true, "bin": { - "node-gyp-build": "bin.js", - "node-gyp-build-optional": "optional.js", - "node-gyp-build-test": "build-test.js" + "envinfo": "dist/cli.js" + }, + "engines": { + "node": ">=4" } }, - "node_modules/ganache/node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "node_modules/ganache/node_modules/es-module-lexer": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", + "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/es6-object-assign": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", + "integrity": "sha512-MEl9uirslVwqQU369iHNWZXsI8yaZYGg/D65aOgZkeyFJwHYSxilf7rQzXKI7DdDuBPrBXbfk3sl9hJhmd5AUw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "extraneous": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "extraneous": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "extraneous": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/ganache/node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "extraneous": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/ganache/node_modules/esrecurse/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "extraneous": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/ganache/node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "extraneous": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/ganache/node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "extraneous": true, + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/ganache/node_modules/evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "extraneous": true, + "dependencies": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/ganache/node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "extraneous": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "extraneous": true + }, + "node_modules/ganache/node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/fastest-levenshtein": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", + "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", + "extraneous": true, + "engines": { + "node": ">= 4.9.1" + } + }, + "node_modules/ganache/node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "extraneous": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "extraneous": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "extraneous": true, + "bin": { + "flat": "cli.js" + } + }, + "node_modules/ganache/node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "extraneous": true, + "dependencies": { + "is-callable": "^1.1.3" + } + }, + "node_modules/ganache/node_modules/fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "extraneous": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/ganache/node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "extraneous": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/ganache/node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "extraneous": true + }, + "node_modules/ganache/node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "extraneous": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/ganache/node_modules/get-intrinsic": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", + "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "extraneous": true, + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" + } + }, + "node_modules/ganache/node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "extraneous": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "extraneous": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/ganache/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "extraneous": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/ganache/node_modules/glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "extraneous": true, + "dependencies": { + "get-intrinsic": "^1.1.3" + } + }, + "node_modules/ganache/node_modules/graceful-fs": { + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "extraneous": true, + "engines": { + "node": ">=4.x" + } + }, + "node_modules/ganache/node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "extraneous": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/ganache/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/has-property-descriptors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "extraneous": true, + "dependencies": { + "get-intrinsic": "^1.1.1" + } + }, + "node_modules/ganache/node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "extraneous": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "extraneous": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "extraneous": true, + "dependencies": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ganache/node_modules/hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dev": true, + "inBundle": true, + "license": "MIT", + "peer": true, + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "node_modules/ganache/node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "extraneous": true, + "bin": { + "he": "bin/he" + } + }, + "node_modules/ganache/node_modules/hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "dev": true, + "inBundle": true, + "license": "MIT", + "peer": true, + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/ganache/node_modules/https-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", + "integrity": "sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg==", + "extraneous": true + }, + "node_modules/ganache/node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "extraneous": true, + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/ganache/node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "inBundle": true, + "license": "BSD-3-Clause", + "peer": true + }, + "node_modules/ganache/node_modules/import-lazy": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-4.0.0.tgz", + "integrity": "sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/import-local": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", + "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", + "extraneous": true, + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "extraneous": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/ganache/node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, + "inBundle": true, + "license": "ISC", + "peer": true + }, + "node_modules/ganache/node_modules/interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "extraneous": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/ganache/node_modules/is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "extraneous": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "extraneous": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/is-buffer": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "inBundle": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/ganache/node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "extraneous": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/is-core-module": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "extraneous": true, + "dependencies": { + "has": "^1.0.3" + } + }, + "node_modules/ganache/node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "extraneous": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ganache/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "extraneous": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "extraneous": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ganache/node_modules/is-nan": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", + "integrity": "sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==", + "extraneous": true, + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "extraneous": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/ganache/node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "extraneous": true, + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ganache/node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/is-typed-array": { + "version": "1.1.10", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", + "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", + "extraneous": true, + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "extraneous": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "extraneous": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ganache/node_modules/jest-worker": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", + "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", + "extraneous": true, + "dependencies": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/ganache/node_modules/jju": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz", + "integrity": "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "extraneous": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/ganache/node_modules/js-yaml/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "extraneous": true + }, + "node_modules/ganache/node_modules/json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "extraneous": true + }, + "node_modules/ganache/node_modules/json5": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", + "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", + "extraneous": true, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "extraneous": true, + "dependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/ganache/node_modules/keccak": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.2.tgz", + "integrity": "sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ==", + "dev": true, + "hasInstallScript": true, + "inBundle": true, + "license": "MIT", + "peer": true, + "dependencies": { + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/ganache/node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "extraneous": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ganache/node_modules/level-concat-iterator": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-3.1.0.tgz", + "integrity": "sha512-BWRCMHBxbIqPxJ8vHOvKUsaO0v1sLYZtjN3K2iZJsRBYtp+ONsY6Jfi6hy9K3+zolgQRryhIn2NRZjZnWJ9NmQ==", + "dev": true, + "inBundle": true, + "license": "MIT", + "peer": true, + "dependencies": { + "catering": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/level-js": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/level-js/-/level-js-6.1.0.tgz", + "integrity": "sha512-i7mPtkZm68aewfv0FnIUWvFUFfoyzIvVKnUmuQGrelEkP72vSPTaA1SGneWWoCV5KZJG4wlzbJLp1WxVNGuc6A==", + "extraneous": true, + "dependencies": { + "abstract-leveldown": "^7.2.0", + "buffer": "^6.0.3", + "inherits": "^2.0.3", + "ltgt": "^2.1.2", + "run-parallel-limit": "^1.1.0" + } + }, + "node_modules/ganache/node_modules/level-supports": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-2.1.0.tgz", + "integrity": "sha512-E486g1NCjW5cF78KGPrMDRBYzPuueMZ6VBXHT6gC7A8UYWGiM14fGgp+s/L1oFfDWSPV/+SFkYCmZ0SiESkRKA==", + "dev": true, + "inBundle": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/level-transcoder": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/level-transcoder/-/level-transcoder-1.0.1.tgz", + "integrity": "sha512-t7bFwFtsQeD8cl8NIoQ2iwxA0CL/9IFw7/9gAjOonH0PWTTiRfY7Hq+Ejbsxh86tXobDQ6IOiddjNYIfOBs06w==", + "dev": true, + "peer": true, + "dependencies": { + "buffer": "^6.0.3", + "module-error": "^1.0.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/ganache/node_modules/leveldown": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/leveldown/-/leveldown-6.1.0.tgz", + "integrity": "sha512-8C7oJDT44JXxh04aSSsfcMI8YiaGRhOFI9/pMEL7nWJLVsWajDPTRxsSHTM2WcTVY5nXM+SuRHzPPi0GbnDX+w==", + "dev": true, + "hasInstallScript": true, + "inBundle": true, + "license": "MIT", + "peer": true, + "dependencies": { + "abstract-leveldown": "^7.2.0", + "napi-macros": "~2.0.0", + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/ganache/node_modules/loader-runner": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", + "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", + "extraneous": true, + "engines": { + "node": ">=6.11.5" + } + }, + "node_modules/ganache/node_modules/loader-utils": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz", + "integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==", + "extraneous": true, + "dependencies": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" + }, + "engines": { + "node": ">=8.9.0" + } + }, + "node_modules/ganache/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "extraneous": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true, + "peer": true + }, + "node_modules/ganache/node_modules/lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "extraneous": true, + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "extraneous": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/ltgt": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ltgt/-/ltgt-2.2.1.tgz", + "integrity": "sha512-AI2r85+4MquTw9ZYqabu4nMwy9Oftlfa/e/52t9IjtfG+mGBbTNdAoZ3RQKLHR6r0wQnwZnPIEh/Ya6XTWAKNA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/mcl-wasm": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/mcl-wasm/-/mcl-wasm-0.9.0.tgz", + "integrity": "sha512-rvU7L/68ZrDk4dpPZteiEqvK9nB/1XbbHmuLK6qIvc4xuuJb/iv1p5X3KEyq6AYatLnc+zbdSlLXTlKgTnCRZQ==", + "extraneous": true, + "engines": { + "node": ">=8.9.0" + } + }, + "node_modules/ganache/node_modules/md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "extraneous": true, + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/ganache/node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "extraneous": true + }, + "node_modules/ganache/node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "extraneous": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/ganache/node_modules/miller-rabin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", + "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", + "extraneous": true, + "dependencies": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + }, + "bin": { + "miller-rabin": "bin/miller-rabin" + } + }, + "node_modules/ganache/node_modules/miller-rabin/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "extraneous": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ganache/node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "extraneous": true, + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ganache/node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "extraneous": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true, + "inBundle": true, + "license": "ISC", + "peer": true + }, + "node_modules/ganache/node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", + "dev": true, + "inBundle": true, + "license": "MIT", + "peer": true + }, + "node_modules/ganache/node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "extraneous": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/ganache/node_modules/minimist": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", + "extraneous": true + }, + "node_modules/ganache/node_modules/mocha": { + "version": "9.1.3", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.3.tgz", + "integrity": "sha512-Xcpl9FqXOAYqI3j79pEtHBBnQgVXIhpULjGQa7DVb0Po+VzmSIK9kanAiWLHoRR/dbZ2qpdPshuXr8l1VaHCzw==", + "extraneous": true, + "dependencies": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.2", + "debug": "4.3.2", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.1.7", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "3.0.4", + "ms": "2.1.3", + "nanoid": "3.1.25", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "which": "2.0.2", + "workerpool": "6.1.5", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha" + }, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/ganache/node_modules/module-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/module-error/-/module-error-1.0.2.tgz", + "integrity": "sha512-0yuvsqSCv8LbaOKhnsQ/T5JhyFlCYLPXK3U2sgV10zoKQwzs/MyfuQUOZQ1V/6OCOJsK/TRgNVrPuPDqtdMFtA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/nanoid": { + "version": "3.1.25", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz", + "integrity": "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==", + "extraneous": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/ganache/node_modules/napi-macros": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.0.0.tgz", + "integrity": "sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg==", + "dev": true, + "inBundle": true, + "license": "MIT", + "peer": true + }, + "node_modules/ganache/node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/node-addon-api": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", + "dev": true, + "inBundle": true, + "license": "MIT", + "peer": true + }, + "node_modules/ganache/node_modules/node-gyp-build": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", + "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==", + "dev": true, + "inBundle": true, + "license": "MIT", + "peer": true, + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/ganache/node_modules/node-loader": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/node-loader/-/node-loader-1.0.2.tgz", + "integrity": "sha512-myxAxpyMR7knjA4Uzwf3gjxaMtxSWj2vpm9o6AYWWxQ1S3XMBNeG2vzYcp/5eW03cBGfgSxyP+wntP8qhBJNhQ==", + "extraneous": true, + "dependencies": { + "loader-utils": "^2.0.0", + "schema-utils": "^3.0.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/ganache/node_modules/node-releases": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.6.tgz", + "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==", + "extraneous": true + }, + "node_modules/ganache/node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "extraneous": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ganache/node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "extraneous": true, + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/object-is": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", + "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", + "extraneous": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "extraneous": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "extraneous": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/ganache/node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "extraneous": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/os-browserify": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", + "integrity": "sha512-gjcpUc3clBf9+210TRaDWbf+rZZZEshZ+DlXMRCeAjp0xhTrnQsKHypIy1J3d5hKdUzj69t708EHtU8P6bUn0A==", + "extraneous": true + }, + "node_modules/ganache/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "extraneous": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "extraneous": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "extraneous": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/parse-asn1": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz", + "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==", + "extraneous": true, + "dependencies": { + "asn1.js": "^5.2.0", + "browserify-aes": "^1.0.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/ganache/node_modules/path-browserify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", + "extraneous": true + }, + "node_modules/ganache/node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "extraneous": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ganache/node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/pbkdf2": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", + "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", + "extraneous": true, + "dependencies": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/ganache/node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "extraneous": true, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/ganache/node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "extraneous": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/pkg-dir/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "extraneous": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/pkg-dir/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "extraneous": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/pkg-dir/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "extraneous": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/pkg-dir/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "extraneous": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "extraneous": true, + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/ganache/node_modules/public-encrypt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", + "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", + "extraneous": true, + "dependencies": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/ganache/node_modules/public-encrypt/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "extraneous": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "inBundle": true, + "license": "MIT", + "peer": true + }, + "node_modules/ganache/node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "extraneous": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/ganache/node_modules/randomfill": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "extraneous": true, + "dependencies": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "node_modules/ganache/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "inBundle": true, + "license": "MIT", + "peer": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/ganache/node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "extraneous": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/ganache/node_modules/rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", + "extraneous": true, + "dependencies": { + "resolve": "^1.1.6" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/ganache/node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "extraneous": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ganache/node_modules/resolve": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", + "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "extraneous": true, + "dependencies": { + "path-parse": "^1.0.6" + } + }, + "node_modules/ganache/node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "extraneous": true, + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "extraneous": true, + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "node_modules/ganache/node_modules/run-parallel-limit": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/run-parallel-limit/-/run-parallel-limit-1.1.0.tgz", + "integrity": "sha512-jJA7irRNM91jaKc3Hcl1npHsFLOXOoTkPCUL1JEa1R82O2miplXXRaGdjW/KM/98YQWDhJLiSs793CnXfblJUw==", + "extraneous": true, + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/ganache/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "dev": true, "funding": [ { @@ -10169,74 +12725,451 @@ "license": "MIT", "peer": true }, - "node_modules/ganache/node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "node_modules/ganache/node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "extraneous": true + }, + "node_modules/ganache/node_modules/schema-utils": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", + "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", + "extraneous": true, + "dependencies": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/ganache/node_modules/scrypt-js": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", + "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/secp256k1": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", + "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", "dev": true, + "hasInstallScript": true, "inBundle": true, "license": "MIT", "peer": true, "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" + "elliptic": "^6.5.4", + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/ganache/node_modules/semver": { + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "extraneous": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "extraneous": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/ganache/node_modules/setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "extraneous": true, + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "bin": { + "sha.js": "bin.js" + } + }, + "node_modules/ganache/node_modules/shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "extraneous": true, + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "extraneous": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/shebang-loader": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/shebang-loader/-/shebang-loader-0.0.1.tgz", + "integrity": "sha512-nQvhUHvKyzGK5aqPxHfHB5nlAN2EZ2U61S2G0YrxAuCRU5iGhFcxxRiaAdb18UoRS1zVMhRz4gdQ1xFEg3AOyA==", + "extraneous": true + }, + "node_modules/ganache/node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/shelljs": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", + "extraneous": true, + "dependencies": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + }, + "bin": { + "shjs": "bin/shjs" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ganache/node_modules/shx": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.3.tgz", + "integrity": "sha512-nZJ3HFWVoTSyyB+evEKjJ1STiixGztlqwKLTUNV5KqMWtGey9fTd4KU1gdZ1X9BV6215pswQ/Jew9NsuS/fNDA==", + "extraneous": true, + "dependencies": { + "minimist": "^1.2.3", + "shelljs": "^0.8.4" + }, + "bin": { + "shx": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "extraneous": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ganache/node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "extraneous": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/ganache/node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "extraneous": true + }, + "node_modules/ganache/node_modules/stream-browserify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-3.0.0.tgz", + "integrity": "sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==", + "extraneous": true, + "dependencies": { + "inherits": "~2.0.4", + "readable-stream": "^3.5.0" + } + }, + "node_modules/ganache/node_modules/stream-http": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-3.2.0.tgz", + "integrity": "sha512-Oq1bLqisTyK3TSCXpPbT4sdeYNdmyZJv1LxpEm2vu1ZhK89kSE5YXwZc3cWk0MagGaKriBh9mCFbVGtO+vY29A==", + "extraneous": true, + "dependencies": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "xtend": "^4.0.2" + } + }, + "node_modules/ganache/node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "inBundle": true, + "license": "MIT", + "peer": true, + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/ganache/node_modules/string-argv": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.1.tgz", + "integrity": "sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg==", + "extraneous": true, + "engines": { + "node": ">=0.6.19" + } + }, + "node_modules/ganache/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "extraneous": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "extraneous": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "extraneous": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ganache/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "extraneous": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/tapable": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "extraneous": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/terser": { + "version": "5.16.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.16.1.tgz", + "integrity": "sha512-xvQfyfA1ayT0qdK47zskQgRZeWLoOQ8JQ6mIgRGVNwZKdQMU+5FkCBjmv4QjcrTzyZquRw2FVtlJSRUmMKQslw==", + "extraneous": true, + "dependencies": { + "@jridgewell/source-map": "^0.3.2", + "acorn": "^8.5.0", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/terser-webpack-plugin": { + "version": "5.2.5", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.2.5.tgz", + "integrity": "sha512-3luOVHku5l0QBeYS8r4CdHYWEGMmIj3H1U64jgkdZzECcSOJAyJ9TjuqcQZvw1Y+4AOBN9SeYJPJmFn2cM4/2g==", + "extraneous": true, + "dependencies": { + "jest-worker": "^27.0.6", + "schema-utils": "^3.1.1", + "serialize-javascript": "^6.0.0", + "source-map": "^0.6.1", + "terser": "^5.7.2" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/ganache/node_modules/timsort": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz", + "integrity": "sha512-qsdtZH+vMoCARQtyod4imc2nIJwg9Cc7lPRrw9CzF8ZKR0khdr8+2nX80PBhET3tcyTtJDxAffGh2rXH4tyU8A==", + "extraneous": true + }, + "node_modules/ganache/node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "extraneous": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/ganache/node_modules/ts-loader": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.3.1.tgz", + "integrity": "sha512-OkyShkcZTsTwyS3Kt7a4rsT/t2qvEVQuKCTg4LJmpj9fhFR7ukGdZwV6Qq3tRUkqcXtfGpPR7+hFKHCG/0d3Lw==", + "extraneous": true, + "dependencies": { + "chalk": "^4.1.0", + "enhanced-resolve": "^5.0.0", + "micromatch": "^4.0.0", + "semver": "^7.3.4" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/ganache/node_modules/ts-node": { + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", + "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "extraneous": true, + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + } + }, + "node_modules/ganache/node_modules/ts-node/node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "extraneous": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/ganache/node_modules/typescript": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", + "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "extraneous": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" }, "engines": { - "node": ">= 6" + "node": ">=14.17" } }, - "node_modules/ganache/node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "inBundle": true, - "license": "MIT", - "peer": true + "node_modules/ganache/node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "extraneous": true, + "engines": { + "node": ">= 4.0.0" + } }, - "node_modules/ganache/node_modules/secp256k1": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", - "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", - "dev": true, - "hasInstallScript": true, - "inBundle": true, - "license": "MIT", - "peer": true, + "node_modules/ganache/node_modules/update-browserslist-db": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz", + "integrity": "sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==", + "extraneous": true, "dependencies": { - "elliptic": "^6.5.4", - "node-addon-api": "^2.0.0", - "node-gyp-build": "^4.2.0" + "escalade": "^3.1.1", + "picocolors": "^1.0.0" }, - "engines": { - "node": ">=10.0.0" + "bin": { + "browserslist-lint": "cli.js" } }, - "node_modules/ganache/node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dev": true, - "inBundle": true, - "license": "MIT", - "peer": true, + "node_modules/ganache/node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "extraneous": true, "dependencies": { - "safe-buffer": "~5.2.0" + "punycode": "^2.1.0" } }, "node_modules/ganache/node_modules/utf-8-validate": { @@ -10254,6 +13187,20 @@ "node": ">=6.14.2" } }, + "node_modules/ganache/node_modules/util": { + "version": "0.12.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.4.tgz", + "integrity": "sha512-bxZ9qtSlGUWSOy9Qa9Xgk11kSslpuZwaxCg4sNIDj6FLucDab2JxnHwyNTCpHMtK1MjoQiWQ6DiUMZYbSrO+Sw==", + "extraneous": true, + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "safe-buffer": "^5.1.2", + "which-typed-array": "^1.1.2" + } + }, "node_modules/ganache/node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -10263,6 +13210,316 @@ "license": "MIT", "peer": true }, + "node_modules/ganache/node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "extraneous": true + }, + "node_modules/ganache/node_modules/validator": { + "version": "13.7.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.7.0.tgz", + "integrity": "sha512-nYXQLCBkpJ8X6ltALua9dRrZDHVYxjJ1wgskNt1lH9fzGjs3tgojGSCBjmEPwkWS1y29+DrizMTW19Pr9uB2nw==", + "extraneous": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/ganache/node_modules/watchpack": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", + "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", + "extraneous": true, + "dependencies": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/ganache/node_modules/webpack": { + "version": "5.65.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.65.0.tgz", + "integrity": "sha512-Q5or2o6EKs7+oKmJo7LaqZaMOlDWQse9Tm5l1WAfU/ujLGN5Pb0SqGeVkN/4bpPmEqEP5RnVhiqsOtWtUVwGRw==", + "extraneous": true, + "dependencies": { + "@types/eslint-scope": "^3.7.0", + "@types/estree": "^0.0.50", + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/wasm-edit": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1", + "acorn": "^8.4.1", + "acorn-import-assertions": "^1.7.6", + "browserslist": "^4.14.5", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^5.8.3", + "es-module-lexer": "^0.9.0", + "eslint-scope": "5.1.1", + "events": "^3.2.0", + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.2.4", + "json-parse-better-errors": "^1.0.2", + "loader-runner": "^4.2.0", + "mime-types": "^2.1.27", + "neo-async": "^2.6.2", + "schema-utils": "^3.1.0", + "tapable": "^2.1.1", + "terser-webpack-plugin": "^5.1.3", + "watchpack": "^2.3.1", + "webpack-sources": "^3.2.2" + }, + "bin": { + "webpack": "bin/webpack.js" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/ganache/node_modules/webpack-cli": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.9.1.tgz", + "integrity": "sha512-JYRFVuyFpzDxMDB+v/nanUdQYcZtqFPGzmlW4s+UkPMFhSpfRNmf1z4AwYcHJVdvEFAM7FFCQdNTpsBYhDLusQ==", + "extraneous": true, + "dependencies": { + "@discoveryjs/json-ext": "^0.5.0", + "@webpack-cli/configtest": "^1.1.0", + "@webpack-cli/info": "^1.4.0", + "@webpack-cli/serve": "^1.6.0", + "colorette": "^2.0.14", + "commander": "^7.0.0", + "execa": "^5.0.0", + "fastest-levenshtein": "^1.0.12", + "import-local": "^3.0.2", + "interpret": "^2.2.0", + "rechoir": "^0.7.0", + "webpack-merge": "^5.7.3" + }, + "bin": { + "webpack-cli": "bin/cli.js" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/ganache/node_modules/webpack-cli/node_modules/commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "extraneous": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/ganache/node_modules/webpack-cli/node_modules/interpret": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", + "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==", + "extraneous": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/ganache/node_modules/webpack-cli/node_modules/rechoir": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz", + "integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==", + "extraneous": true, + "dependencies": { + "resolve": "^1.9.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/ganache/node_modules/webpack-merge": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.8.0.tgz", + "integrity": "sha512-/SaI7xY0831XwP6kzuwhKWVKDP9t1QY1h65lAFLbZqMPIuYcD9QAW4u9STIbU9kaJbPBB/geU/gLr1wDjOhQ+Q==", + "extraneous": true, + "dependencies": { + "clone-deep": "^4.0.1", + "wildcard": "^2.0.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/ganache/node_modules/webpack-sources": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", + "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", + "extraneous": true, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/ganache/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "extraneous": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/ganache/node_modules/which-typed-array": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", + "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", + "extraneous": true, + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ganache/node_modules/wildcard": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.0.tgz", + "integrity": "sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/workerpool": { + "version": "6.1.5", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.5.tgz", + "integrity": "sha512-XdKkCK0Zqc6w3iTxLckiuJ81tiD/o5rBE/m+nXpRCB+/Sq4DqkfXZ/x0jW02DG1tGsfUGXbTJyZDP+eu67haSw==", + "extraneous": true + }, + "node_modules/ganache/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "extraneous": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "extraneous": true + }, + "node_modules/ganache/node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "extraneous": true, + "engines": { + "node": ">=0.4" + } + }, + "node_modules/ganache/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "extraneous": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "extraneous": true + }, + "node_modules/ganache/node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "extraneous": true, + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "extraneous": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "extraneous": true, + "dependencies": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "extraneous": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ganache/node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "extraneous": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ganache/node_modules/z-schema": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/z-schema/-/z-schema-5.0.4.tgz", + "integrity": "sha512-gm/lx3hDzJNcLwseIeQVm1UcwhWIKpSB4NqH89pTBtFns4k/HDHudsICtvG05Bvw/Mv3jMyk700y5dadueLHdA==", + "extraneous": true, + "dependencies": { + "commander": "^2.20.3", + "lodash.get": "^4.4.2", + "lodash.isequal": "^4.5.0", + "validator": "^13.7.0" + }, + "bin": { + "z-schema": "bin/z-schema" + }, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", diff --git a/package.json b/package.json index 2e150b1d..0eb70f21 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@solarity/hardhat-migrate", - "version": "2.0.0-alpha.22", + "version": "2.0.0-beta.1", "description": "Automatic deployment and verification of smart contracts", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", From 56b7c8aeb166a36d2a9a779ac44456405ccd47cb Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Mon, 18 Dec 2023 23:21:35 +0200 Subject: [PATCH 06/34] Removed .only --- test/integration/transaction-storage.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/transaction-storage.ts b/test/integration/transaction-storage.ts index 65ca66a6..cabb535e 100644 --- a/test/integration/transaction-storage.ts +++ b/test/integration/transaction-storage.ts @@ -17,7 +17,7 @@ import { ContractWithPayableConstructor__factory, } from "../fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types"; -describe.only("TransactionStorage", async () => { +describe("TransactionStorage", async () => { useEnvironment("repeats-typechain-ethers"); beforeEach(async function () { From a374b499f5f6d6b2b34cf84b31f493bae18fd757 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Tue, 19 Dec 2023 11:13:55 +0200 Subject: [PATCH 07/34] Added `TransactionFieldsToSave` as a return value to the `sendNative` function --- CHANGELOG.md | 3 ++- src/deployer/Deployer.ts | 17 +++++++++++------ src/tools/storage/TransactionProcessor.ts | 4 +++- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8a44ee5..450142b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,10 @@ ## Version 2.0.0-beta.1 +* Added `TransactionFieldsToSave` as a return value to the `sendNative` function * Added handling of the custom chains specified in the Hardhat config * Refactored the architecture and made it consistent -* Used spinner instead of console.log for network errors +* Used spinner instead of `console.log` for network errors ## Version 2.0.0-alpha.22 diff --git a/src/deployer/Deployer.ts b/src/deployer/Deployer.ts index 9d4455fa..e840d612 100644 --- a/src/deployer/Deployer.ts +++ b/src/deployer/Deployer.ts @@ -16,7 +16,7 @@ import { EthersFactoryAdapter } from "./adapters/EthersFactoryAdapter"; import { OverridesAndLibs } from "../types/deployer"; import { Instance, TypedArgs } from "../types/adapter"; -import { KeyTransactionFields, MigrationMetadata } from "../types/tools"; +import { KeyTransactionFields, MigrationMetadata, TransactionFieldsToSave } from "../types/tools"; import { isContractFactory, isEthersContract, isBytecodeFactory, isTruffleFactory } from "../types/type-checks"; import { Stats } from "../tools/Stats"; @@ -74,8 +74,11 @@ export class Deployer { return adapter.toInstance(contract, contractAddress!, {}); } - // TODO: return receipt! - public async sendNative(to: string, value: bigint, name: string = SEND_NATIVE_TX_NAME): Promise { + public async sendNative( + to: string, + value: bigint, + name: string = SEND_NATIVE_TX_NAME, + ): Promise { const signer = await getSignerHelper(); const tx = await this._buildSendTransaction(to, value, name); @@ -84,11 +87,11 @@ export class Deployer { if (this._hre.config.migrate.continue) { try { - TransactionProcessor?.tryRestoreSavedTransaction(tx); + const savedTx = TransactionProcessor?.tryRestoreSavedTransaction(tx); Reporter!.notifyTransactionRecovery(methodString); - return; + return savedTx!; } catch { Reporter!.notifyTransactionSendingInsteadOfRecovery(methodString); } @@ -106,7 +109,9 @@ export class Deployer { methodName: methodString, }; - TransactionProcessor?.saveTransaction(tx, receipt!, saveMetadata); + const savedTx = TransactionProcessor?.saveTransaction(tx, receipt!, saveMetadata); + + return savedTx!; } public async getSigner(from?: string): Promise { diff --git a/src/tools/storage/TransactionProcessor.ts b/src/tools/storage/TransactionProcessor.ts index 7a1739c2..6ed0561b 100644 --- a/src/tools/storage/TransactionProcessor.ts +++ b/src/tools/storage/TransactionProcessor.ts @@ -65,7 +65,7 @@ export class BaseTransactionProcessor { receipt: TransactionReceiptParams | TransactionReceipt, metadata: MigrationMetadata, ) { - this._saveTransaction( + return this._saveTransaction( { data: tx.data, from: tx.from, @@ -146,6 +146,8 @@ export class BaseTransactionProcessor { } TransactionStorage.set(dataKey, dataToSave, true); + + return dataToSave; } private _saveContract(keyByArgs: string, dataToSave: ContractFieldsToSave) { From 98c21d01e2894ab9e62b1d3202cba9b64668bf69 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Tue, 19 Dec 2023 12:13:51 +0200 Subject: [PATCH 08/34] Deleted auto generated files from tests --- README.md | 2 +- package-lock.json | 16 +- package.json | 9 +- .../deploy/1_deploy.ts | 1 + .../hardhat.config.js | 3 - .../migrates/1_deploy.ts | 12 - .../hardhat.config.js | 5 - .../.gitignore | 5 +- .../migrates/1_deploy.ts | 13 - .../ContractWithConstructorArguments.ts | 70 ---- .../ContractWithExternalLibrary.ts | 85 ---- .../ContractWithPayableConstructor.ts | 45 -- .../typechain-types/Library1.ts | 70 ---- .../typechain-types/Library2.ts | 70 ---- .../typechain-types/common.ts | 92 ---- ...ntractWithConstructorArguments__factory.ts | 84 ---- .../ContractWithExternalLibrary__factory.ts | 136 ------ ...ContractWithPayableConstructor__factory.ts | 62 --- .../factories/Library1__factory.ts | 66 --- .../factories/Library2__factory.ts | 66 --- .../typechain-types/factories/index.ts | 8 - .../typechain-types/hardhat.d.ts | 125 ------ .../typechain-types/index.ts | 14 - .../ContractWithConstructorArguments.d.ts | 30 -- .../ContractWithExternalLibrary.d.ts | 41 -- .../ContractWithPayableConstructor.d.ts | 26 -- .../typechain-types/Library1.d.ts | 29 -- .../typechain-types/Library2.d.ts | 29 -- .../typechain-types/index.d.ts | 36 -- .../typechain-types/types.d.ts | 120 ------ .../ContractWithConstructorArguments.ts | 70 ---- .../ContractWithExternalLibrary.ts | 85 ---- .../ContractWithPayableConstructor.ts | 45 -- .../typechain-types/Contracts.sol/Library1.ts | 70 ---- .../typechain-types/Contracts.sol/Library2.ts | 70 ---- .../typechain-types/Contracts.sol/index.ts | 8 - .../ContractWithConstructorArguments.ts | 70 ---- .../ContractWithExternalLibrary.ts | 85 ---- .../ContractWithPayableConstructor.ts | 45 -- .../Contracts2.sol/Library1.ts | 70 ---- .../Contracts2.sol/Library2.ts | 70 ---- .../typechain-types/Contracts2.sol/index.ts | 8 - .../ContractWithConstructorArguments.ts | 70 ---- .../ContractWithExternalLibrary.ts | 85 ---- .../ContractWithPayableConstructor.ts | 45 -- .../Contracts.sol/Library1.ts | 70 ---- .../Contracts.sol/Library2.ts | 70 ---- .../another-contracts/Contracts.sol/index.ts | 8 - .../ContractWithConstructorArguments.ts | 70 ---- .../ContractWithExternalLibrary.ts | 85 ---- .../ContractWithPayableConstructor.ts | 45 -- .../Contracts2.sol/Library1.ts | 70 ---- .../Contracts2.sol/Library2.ts | 70 ---- .../another-contracts/Contracts2.sol/index.ts | 8 - .../another-contracts/index.ts | 7 - .../typechain-types/common.ts | 92 ---- ...ntractWithConstructorArguments__factory.ts | 84 ---- .../ContractWithExternalLibrary__factory.ts | 139 ------ ...ContractWithPayableConstructor__factory.ts | 62 --- .../Contracts.sol/Library1__factory.ts | 66 --- .../Contracts.sol/Library2__factory.ts | 66 --- .../factories/Contracts.sol/index.ts | 8 - ...ntractWithConstructorArguments__factory.ts | 84 ---- .../ContractWithExternalLibrary__factory.ts | 139 ------ ...ContractWithPayableConstructor__factory.ts | 62 --- .../Contracts2.sol/Library1__factory.ts | 66 --- .../Contracts2.sol/Library2__factory.ts | 66 --- .../factories/Contracts2.sol/index.ts | 8 - ...ntractWithConstructorArguments__factory.ts | 84 ---- .../ContractWithExternalLibrary__factory.ts | 139 ------ ...ContractWithPayableConstructor__factory.ts | 62 --- .../Contracts.sol/Library1__factory.ts | 66 --- .../Contracts.sol/Library2__factory.ts | 66 --- .../another-contracts/Contracts.sol/index.ts | 8 - ...ntractWithConstructorArguments__factory.ts | 84 ---- .../ContractWithExternalLibrary__factory.ts | 139 ------ ...ContractWithPayableConstructor__factory.ts | 62 --- .../Contracts2.sol/Library1__factory.ts | 66 --- .../Contracts2.sol/Library2__factory.ts | 66 --- .../another-contracts/Contracts2.sol/index.ts | 8 - .../factories/another-contracts/index.ts | 5 - .../typechain-types/factories/index.ts | 6 - .../typechain-types/hardhat.d.ts | 395 ------------------ .../typechain-types/index.ts | 20 - 84 files changed, 24 insertions(+), 4963 deletions(-) delete mode 100644 test/fixture-projects/hardhat-project-minimal-ethers/hardhat.config.js delete mode 100644 test/fixture-projects/hardhat-project-minimal-ethers/migrates/1_deploy.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-truffle/hardhat.config.js delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/migrates/1_deploy.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/ContractWithConstructorArguments.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/ContractWithExternalLibrary.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/ContractWithPayableConstructor.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/Library1.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/Library2.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/common.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/ContractWithConstructorArguments__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/ContractWithExternalLibrary__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/ContractWithPayableConstructor__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/Library1__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/Library2__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/index.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/hardhat.d.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/index.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/ContractWithConstructorArguments.d.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/ContractWithExternalLibrary.d.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/ContractWithPayableConstructor.d.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/Library1.d.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/Library2.d.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/index.d.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/types.d.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/ContractWithConstructorArguments.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/ContractWithExternalLibrary.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/ContractWithPayableConstructor.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/Library1.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/Library2.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/index.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/ContractWithConstructorArguments.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/ContractWithExternalLibrary.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/ContractWithPayableConstructor.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/Library1.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/Library2.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/index.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/ContractWithConstructorArguments.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/ContractWithExternalLibrary.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/ContractWithPayableConstructor.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/Library1.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/Library2.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/index.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/ContractWithConstructorArguments.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/ContractWithExternalLibrary.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/ContractWithPayableConstructor.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/Library1.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/Library2.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/index.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/index.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/common.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/ContractWithConstructorArguments__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/ContractWithExternalLibrary__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/ContractWithPayableConstructor__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/Library1__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/Library2__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/index.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/ContractWithConstructorArguments__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/ContractWithExternalLibrary__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/ContractWithPayableConstructor__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/Library1__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/Library2__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/index.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/ContractWithConstructorArguments__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/ContractWithExternalLibrary__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/ContractWithPayableConstructor__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/Library1__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/Library2__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/index.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/ContractWithConstructorArguments__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/ContractWithExternalLibrary__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/ContractWithPayableConstructor__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/Library1__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/Library2__factory.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/index.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/index.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/index.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/hardhat.d.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/index.ts diff --git a/README.md b/README.md index 68bbfa72..31fb9989 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ This is a fairly simple and rather straightforward Hardhat plugin: npm install --save-dev @solarity/hardhat-migrate ``` -And add the following statement to your `hardhat.config.js`: +And add the following statement to your `hardhat.config.ts`: ```js require("@solarity/hardhat-migrate"); diff --git a/package-lock.json b/package-lock.json index f597a23d..ca36dc36 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,19 +9,22 @@ "version": "2.0.0-beta.1", "hasInstallScript": true, "license": "MIT", + "workspaces": [ + "test/fixture-projects/*" + ], "dependencies": { - "@nomicfoundation/hardhat-ethers": "3.0.4", + "@nomicfoundation/hardhat-ethers": "3.0.5", "@nomicfoundation/hardhat-verify": "1.1.1", "@nomiclabs/hardhat-truffle5": "2.0.7", "axios": "1.5.0", - "ethers": "6.8.0", + "ethers": "6.9.0", "ora": "5.4.1" }, "devDependencies": { "@nomicfoundation/hardhat-ethers": "^3.0.4", "@nomiclabs/hardhat-truffle5": "^2.0.0", "@typechain/ethers-v6": "^0.5.0", - "@typechain/hardhat": "^9.0.0", + "@typechain/hardhat": "^9.1.0", "@typechain/truffle-v5": "^8.0.6", "@types/chai": "^4.3.4", "@types/chai-as-promised": "^7.1.1", @@ -13851,6 +13854,10 @@ } } }, + "node_modules/hardhat-project-minimal-ethers": { + "resolved": "test/fixture-projects/hardhat-project-minimal-ethers", + "link": true + }, "node_modules/hardhat/node_modules/@noble/hashes": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.2.0.tgz", @@ -21279,6 +21286,9 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } + }, + "test/fixture-projects/hardhat-project-minimal-ethers": { + "version": "1.0.0" } } } diff --git a/package.json b/package.json index 0eb70f21..bc779849 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,9 @@ "type": "git", "url": "git+https://github.com/dl-solarity/hardhat-migrate.git" }, + "workspaces": [ + "test/fixture-projects/*" + ], "keywords": [ "ethereum", "solidity", @@ -40,11 +43,11 @@ "publish-to-npm": "npm run build && npm run lint-fix && npm publish ./ --access public" }, "dependencies": { - "@nomicfoundation/hardhat-ethers": "3.0.4", + "@nomicfoundation/hardhat-ethers": "3.0.5", "@nomicfoundation/hardhat-verify": "1.1.1", "@nomiclabs/hardhat-truffle5": "2.0.7", "axios": "1.5.0", - "ethers": "6.8.0", + "ethers": "6.9.0", "ora": "5.4.1" }, "peerDependencies": { @@ -55,7 +58,7 @@ "@nomicfoundation/hardhat-ethers": "^3.0.4", "@nomiclabs/hardhat-truffle5": "^2.0.0", "@typechain/ethers-v6": "^0.5.0", - "@typechain/hardhat": "^9.0.0", + "@typechain/hardhat": "^9.1.0", "@typechain/truffle-v5": "^8.0.6", "@types/chai": "^4.3.4", "@types/chai-as-promised": "^7.1.1", diff --git a/test/fixture-projects/hardhat-project-minimal-ethers/deploy/1_deploy.ts b/test/fixture-projects/hardhat-project-minimal-ethers/deploy/1_deploy.ts index a17e5426..1ba52478 100644 --- a/test/fixture-projects/hardhat-project-minimal-ethers/deploy/1_deploy.ts +++ b/test/fixture-projects/hardhat-project-minimal-ethers/deploy/1_deploy.ts @@ -1,4 +1,5 @@ import { getContractFactory } from "@nomicfoundation/hardhat-ethers/types"; + import { Deployer } from "../../../../src/deployer/Deployer"; export = async (deployer: Deployer) => { diff --git a/test/fixture-projects/hardhat-project-minimal-ethers/hardhat.config.js b/test/fixture-projects/hardhat-project-minimal-ethers/hardhat.config.js deleted file mode 100644 index 10cdd35b..00000000 --- a/test/fixture-projects/hardhat-project-minimal-ethers/hardhat.config.js +++ /dev/null @@ -1,3 +0,0 @@ -require("../../../src"); - -module.exports = {}; diff --git a/test/fixture-projects/hardhat-project-minimal-ethers/migrates/1_deploy.ts b/test/fixture-projects/hardhat-project-minimal-ethers/migrates/1_deploy.ts deleted file mode 100644 index 772d2171..00000000 --- a/test/fixture-projects/hardhat-project-minimal-ethers/migrates/1_deploy.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { getContractFactory } from "@nomicfoundation/hardhat-ethers/types"; -import { Deployer } from "../../../../src/deployer/Deployer"; - -export = async (deployer: Deployer) => { - const ContractWithConstructorArguments = await getContractFactory("ContractWithConstructorArguments"); - - const contract = await deployer.deploy(ContractWithConstructorArguments, ["hello"], { - gasLimit: 1000000, - }); - - await contract.name(); -}; diff --git a/test/fixture-projects/hardhat-project-minimal-truffle/hardhat.config.js b/test/fixture-projects/hardhat-project-minimal-truffle/hardhat.config.js deleted file mode 100644 index 6673e78e..00000000 --- a/test/fixture-projects/hardhat-project-minimal-truffle/hardhat.config.js +++ /dev/null @@ -1,5 +0,0 @@ -require("../../../src"); - -require("@nomiclabs/hardhat-truffle5"); - -module.exports = {}; diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/.gitignore b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/.gitignore index f61ce9c7..730c6306 100644 --- a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/.gitignore +++ b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/.gitignore @@ -1,2 +1,3 @@ -/cache -/artifacts +cache +artifacts +typechain-types diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/migrates/1_deploy.ts b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/migrates/1_deploy.ts deleted file mode 100644 index 3dc7785b..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/migrates/1_deploy.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Deployer } from "../../../../src/deployer/Deployer"; - -import { ContractWithConstructorArguments__factory } from "../typechain-types"; - -export = async (deployer: Deployer) => { - let contract = await deployer.deploy(ContractWithConstructorArguments__factory, ["hello"], { - gasLimit: 1000000, - }); - - let contract2 = await deployer.deploy({ bytecode: "", abi: "", contractName: "" }, ["hello"], {}); - - await contract.name(); -}; diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/ContractWithConstructorArguments.ts b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/ContractWithConstructorArguments.ts deleted file mode 100644 index f787944e..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/ContractWithConstructorArguments.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BytesLike, - FunctionFragment, - Result, - Interface, - ContractRunner, - ContractMethod, - Listener, -} from "ethers"; -import type { - TypedContractEvent, - TypedDeferredTopicFilter, - TypedEventLog, - TypedListener, - TypedContractMethod, -} from "./common"; - -export interface ContractWithConstructorArgumentsInterface extends Interface { - getFunction(nameOrSignature: "name"): FunctionFragment; - - encodeFunctionData(functionFragment: "name", values?: undefined): string; - - decodeFunctionResult(functionFragment: "name", data: BytesLike): Result; -} - -export interface ContractWithConstructorArguments extends BaseContract { - connect(runner?: ContractRunner | null): ContractWithConstructorArguments; - waitForDeployment(): Promise; - - interface: ContractWithConstructorArgumentsInterface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - name: TypedContractMethod<[], [string], "view">; - - getFunction(key: string | FunctionFragment): T; - - getFunction(nameOrSignature: "name"): TypedContractMethod<[], [string], "view">; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/ContractWithExternalLibrary.ts b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/ContractWithExternalLibrary.ts deleted file mode 100644 index de770711..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/ContractWithExternalLibrary.ts +++ /dev/null @@ -1,85 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BytesLike, - FunctionFragment, - Result, - Interface, - ContractRunner, - ContractMethod, - Listener, -} from "ethers"; -import type { - TypedContractEvent, - TypedDeferredTopicFilter, - TypedEventLog, - TypedListener, - TypedContractMethod, -} from "./common"; - -export interface ContractWithExternalLibraryInterface extends Interface { - getFunction(nameOrSignature: "lib" | "lib2" | "lib3" | "lib4"): FunctionFragment; - - encodeFunctionData(functionFragment: "lib", values?: undefined): string; - encodeFunctionData(functionFragment: "lib2", values?: undefined): string; - encodeFunctionData(functionFragment: "lib3", values?: undefined): string; - encodeFunctionData(functionFragment: "lib4", values?: undefined): string; - - decodeFunctionResult(functionFragment: "lib", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "lib2", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "lib3", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "lib4", data: BytesLike): Result; -} - -export interface ContractWithExternalLibrary extends BaseContract { - connect(runner?: ContractRunner | null): ContractWithExternalLibrary; - waitForDeployment(): Promise; - - interface: ContractWithExternalLibraryInterface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - lib: TypedContractMethod<[], [bigint], "view">; - - lib2: TypedContractMethod<[], [bigint], "view">; - - lib3: TypedContractMethod<[], [bigint], "view">; - - lib4: TypedContractMethod<[], [bigint], "view">; - - getFunction(key: string | FunctionFragment): T; - - getFunction(nameOrSignature: "lib"): TypedContractMethod<[], [bigint], "view">; - getFunction(nameOrSignature: "lib2"): TypedContractMethod<[], [bigint], "view">; - getFunction(nameOrSignature: "lib3"): TypedContractMethod<[], [bigint], "view">; - getFunction(nameOrSignature: "lib4"): TypedContractMethod<[], [bigint], "view">; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/ContractWithPayableConstructor.ts b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/ContractWithPayableConstructor.ts deleted file mode 100644 index c926d730..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/ContractWithPayableConstructor.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { BaseContract, FunctionFragment, Interface, ContractRunner, ContractMethod, Listener } from "ethers"; -import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedListener } from "./common"; - -export interface ContractWithPayableConstructorInterface extends Interface {} - -export interface ContractWithPayableConstructor extends BaseContract { - connect(runner?: ContractRunner | null): ContractWithPayableConstructor; - waitForDeployment(): Promise; - - interface: ContractWithPayableConstructorInterface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - getFunction(key: string | FunctionFragment): T; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/Library1.ts b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/Library1.ts deleted file mode 100644 index 71c7c2f7..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/Library1.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BytesLike, - FunctionFragment, - Result, - Interface, - ContractRunner, - ContractMethod, - Listener, -} from "ethers"; -import type { - TypedContractEvent, - TypedDeferredTopicFilter, - TypedEventLog, - TypedListener, - TypedContractMethod, -} from "./common"; - -export interface Library1Interface extends Interface { - getFunction(nameOrSignature: "lib"): FunctionFragment; - - encodeFunctionData(functionFragment: "lib", values?: undefined): string; - - decodeFunctionResult(functionFragment: "lib", data: BytesLike): Result; -} - -export interface Library1 extends BaseContract { - connect(runner?: ContractRunner | null): Library1; - waitForDeployment(): Promise; - - interface: Library1Interface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - lib: TypedContractMethod<[], [bigint], "view">; - - getFunction(key: string | FunctionFragment): T; - - getFunction(nameOrSignature: "lib"): TypedContractMethod<[], [bigint], "view">; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/Library2.ts b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/Library2.ts deleted file mode 100644 index 84c29002..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/Library2.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BytesLike, - FunctionFragment, - Result, - Interface, - ContractRunner, - ContractMethod, - Listener, -} from "ethers"; -import type { - TypedContractEvent, - TypedDeferredTopicFilter, - TypedEventLog, - TypedListener, - TypedContractMethod, -} from "./common"; - -export interface Library2Interface extends Interface { - getFunction(nameOrSignature: "lib"): FunctionFragment; - - encodeFunctionData(functionFragment: "lib", values?: undefined): string; - - decodeFunctionResult(functionFragment: "lib", data: BytesLike): Result; -} - -export interface Library2 extends BaseContract { - connect(runner?: ContractRunner | null): Library2; - waitForDeployment(): Promise; - - interface: Library2Interface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - lib: TypedContractMethod<[], [bigint], "view">; - - getFunction(key: string | FunctionFragment): T; - - getFunction(nameOrSignature: "lib"): TypedContractMethod<[], [bigint], "view">; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/common.ts b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/common.ts deleted file mode 100644 index e9519244..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/common.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - FunctionFragment, - Typed, - EventFragment, - ContractTransaction, - ContractTransactionResponse, - DeferredTopicFilter, - EventLog, - TransactionRequest, - LogDescription, -} from "ethers"; - -export interface TypedDeferredTopicFilter<_TCEvent extends TypedContractEvent> extends DeferredTopicFilter {} - -export interface TypedContractEvent< - InputTuple extends Array = any, - OutputTuple extends Array = any, - OutputObject = any, -> { - (...args: Partial): TypedDeferredTopicFilter>; - name: string; - fragment: EventFragment; - getFragment(...args: Partial): EventFragment; -} - -type __TypechainAOutputTuple = T extends TypedContractEvent ? W : never; -type __TypechainOutputObject = T extends TypedContractEvent ? V : never; - -export interface TypedEventLog extends Omit { - args: __TypechainAOutputTuple & __TypechainOutputObject; -} - -export interface TypedLogDescription extends Omit { - args: __TypechainAOutputTuple & __TypechainOutputObject; -} - -export type TypedListener = ( - ...listenerArg: [...__TypechainAOutputTuple, TypedEventLog, ...undefined[]] -) => void; - -export type MinEthersFactory = { - deploy(...a: ARGS[]): Promise; -}; - -export type GetContractTypeFromFactory = F extends MinEthersFactory ? C : never; -export type GetARGsTypeFromFactory = F extends MinEthersFactory ? Parameters : never; - -export type StateMutability = "nonpayable" | "payable" | "view"; - -export type BaseOverrides = Omit; -export type NonPayableOverrides = Omit; -export type PayableOverrides = Omit; -export type ViewOverrides = Omit; -export type Overrides = S extends "nonpayable" - ? NonPayableOverrides - : S extends "payable" - ? PayableOverrides - : ViewOverrides; - -export type PostfixOverrides, S extends StateMutability> = A | [...A, Overrides]; -export type ContractMethodArgs, S extends StateMutability> = PostfixOverrides< - { [I in keyof A]-?: A[I] | Typed }, - S ->; - -export type DefaultReturnType = R extends Array ? R[0] : R; - -// export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> { -export interface TypedContractMethod< - A extends Array = Array, - R = any, - S extends StateMutability = "payable", -> { - ( - ...args: ContractMethodArgs - ): S extends "view" ? Promise> : Promise; - - name: string; - - fragment: FunctionFragment; - - getFragment(...args: ContractMethodArgs): FunctionFragment; - - populateTransaction(...args: ContractMethodArgs): Promise; - staticCall(...args: ContractMethodArgs): Promise>; - send(...args: ContractMethodArgs): Promise; - estimateGas(...args: ContractMethodArgs): Promise; - staticCallResult(...args: ContractMethodArgs): Promise; -} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/ContractWithConstructorArguments__factory.ts b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/ContractWithConstructorArguments__factory.ts deleted file mode 100644 index d128b8c3..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/ContractWithConstructorArguments__factory.ts +++ /dev/null @@ -1,84 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { NonPayableOverrides } from "../common"; -import type { - ContractWithConstructorArguments, - ContractWithConstructorArgumentsInterface, -} from "../ContractWithConstructorArguments"; - -const _abi = [ - { - inputs: [ - { - internalType: "string", - name: "_name", - type: "string", - }, - ], - stateMutability: "nonpayable", - type: "constructor", - }, - { - inputs: [], - name: "name", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], - stateMutability: "view", - type: "function", - }, -] as const; - -const _bytecode = - "0x608060405234801561001057600080fd5b5060405161033e38038061033e8339818101604052602081101561003357600080fd5b810190808051604051939291908464010000000082111561005357600080fd5b8382019150602082018581111561006957600080fd5b825186600182028301116401000000008211171561008657600080fd5b8083526020830192505050908051906020019080838360005b838110156100ba57808201518184015260208101905061009f565b50505050905090810190601f1680156100e75780820380516001836020036101000a031916815260200191505b50604052505050806000908051906020019061010492919061010b565b50506101a8565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061014c57805160ff191683800117855561017a565b8280016001018555821561017a579182015b8281111561017957825182559160200191906001019061015e565b5b509050610187919061018b565b5090565b5b808211156101a457600081600090555060010161018c565b5090565b610187806101b76000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806306fdde0314610030575b600080fd5b6100386100b3565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561007857808201518184015260208101905061005d565b50505050905090810190601f1680156100a55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156101495780601f1061011e57610100808354040283529160200191610149565b820191906000526020600020905b81548152906001019060200180831161012c57829003601f168201915b50505050508156fea2646970667358221220fafcb337be24b0cc0bd237410e96c0372e20d83b64721391a45edbe34a57235764736f6c63430007030033"; - -type ContractWithConstructorArgumentsConstructorParams = - | [signer?: Signer] - | ConstructorParameters; - -const isSuperArgs = ( - xs: ContractWithConstructorArgumentsConstructorParams, -): xs is ConstructorParameters => xs.length > 1; - -export class ContractWithConstructorArguments__factory extends ContractFactory { - constructor(...args: ContractWithConstructorArgumentsConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override getDeployTransaction( - _name: string, - overrides?: NonPayableOverrides & { from?: string }, - ): Promise { - return super.getDeployTransaction(_name, overrides || {}); - } - override deploy(_name: string, overrides?: NonPayableOverrides & { from?: string }) { - return super.deploy(_name, overrides || {}) as Promise< - ContractWithConstructorArguments & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): ContractWithConstructorArguments__factory { - return super.connect(runner) as ContractWithConstructorArguments__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): ContractWithConstructorArgumentsInterface { - return new Interface(_abi) as ContractWithConstructorArgumentsInterface; - } - static connect(address: string, runner?: ContractRunner | null): ContractWithConstructorArguments { - return new Contract(address, _abi, runner) as unknown as ContractWithConstructorArguments; - } -} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/ContractWithExternalLibrary__factory.ts b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/ContractWithExternalLibrary__factory.ts deleted file mode 100644 index 57f8abef..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/ContractWithExternalLibrary__factory.ts +++ /dev/null @@ -1,136 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { NonPayableOverrides } from "../common"; -import type { ContractWithExternalLibrary, ContractWithExternalLibraryInterface } from "../ContractWithExternalLibrary"; - -const _abi = [ - { - inputs: [], - name: "lib", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "lib2", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "lib3", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "lib4", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, -] as const; - -const _bytecode = - "0x608060405234801561001057600080fd5b5061023b806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806336ecdf8f14610051578063928012301461006f578063eaebdc061461008d578063ff1a250f146100ab575b600080fd5b6100596100c9565b6040518082815260200191505060405180910390f35b6100776100d8565b6040518082815260200191505060405180910390f35b61009561015e565b6040518082815260200191505060405180910390f35b6100b361016d565b6040518082815260200191505060405180910390f35b60006100d36101f3565b905090565b600073__$b9c1a48d6c9f5a88b03589aab3a8427642$__63928012306040518163ffffffff1660e01b815260040160206040518083038186803b15801561011e57600080fd5b505af4158015610132573d6000803e3d6000fd5b505050506040513d602081101561014857600080fd5b8101908080519060200190929190505050905090565b60006101686101fc565b905090565b600073__$3f2d97621aa449c79a29870f919f014493$__63928012306040518163ffffffff1660e01b815260040160206040518083038186803b1580156101b357600080fd5b505af41580156101c7573d6000803e3d6000fd5b505050506040513d60208110156101dd57600080fd5b8101908080519060200190929190505050905090565b60006003905090565b6000600390509056fea26469706673582212207f27d96db02fe0d602297d8eae80067e49ac743b710c03df9e035a2cb49cb77864736f6c63430007030033"; - -type ContractWithExternalLibraryConstructorParams = - | [linkLibraryAddresses: ContractWithExternalLibraryLibraryAddresses, signer?: Signer] - | ConstructorParameters; - -const isSuperArgs = ( - xs: ContractWithExternalLibraryConstructorParams, -): xs is ConstructorParameters => { - return ( - typeof xs[0] === "string" || - (Array.isArray as (arg: any) => arg is readonly any[])(xs[0]) || - "_isInterface" in xs[0] - ); -}; - -export class ContractWithExternalLibrary__factory extends ContractFactory { - constructor(...args: ContractWithExternalLibraryConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - const [linkLibraryAddresses, signer] = args; - super(_abi, ContractWithExternalLibrary__factory.linkBytecode(linkLibraryAddresses), signer); - } - } - - static linkBytecode(linkLibraryAddresses: ContractWithExternalLibraryLibraryAddresses): string { - let linkedBytecode = _bytecode; - - linkedBytecode = linkedBytecode.replace( - new RegExp("__\\$b9c1a48d6c9f5a88b03589aab3a8427642\\$__", "g"), - linkLibraryAddresses["contracts/Contracts.sol:Library1"].replace(/^0x/, "").toLowerCase(), - ); - - linkedBytecode = linkedBytecode.replace( - new RegExp("__\\$3f2d97621aa449c79a29870f919f014493\\$__", "g"), - linkLibraryAddresses["contracts/Contracts.sol:Library2"].replace(/^0x/, "").toLowerCase(), - ); - - return linkedBytecode; - } - - override getDeployTransaction( - overrides?: NonPayableOverrides & { from?: string }, - ): Promise { - return super.getDeployTransaction(overrides || {}); - } - override deploy(overrides?: NonPayableOverrides & { from?: string }) { - return super.deploy(overrides || {}) as Promise< - ContractWithExternalLibrary & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): ContractWithExternalLibrary__factory { - return super.connect(runner) as ContractWithExternalLibrary__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): ContractWithExternalLibraryInterface { - return new Interface(_abi) as ContractWithExternalLibraryInterface; - } - static connect(address: string, runner?: ContractRunner | null): ContractWithExternalLibrary { - return new Contract(address, _abi, runner) as unknown as ContractWithExternalLibrary; - } -} - -export interface ContractWithExternalLibraryLibraryAddresses { - ["contracts/Contracts.sol:Library1"]: string; - ["contracts/Contracts.sol:Library2"]: string; -} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/ContractWithPayableConstructor__factory.ts b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/ContractWithPayableConstructor__factory.ts deleted file mode 100644 index 21b2d192..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/ContractWithPayableConstructor__factory.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { PayableOverrides } from "../common"; -import type { - ContractWithPayableConstructor, - ContractWithPayableConstructorInterface, -} from "../ContractWithPayableConstructor"; - -const _abi = [ - { - inputs: [], - stateMutability: "payable", - type: "constructor", - }, -] as const; - -const _bytecode = - "0x6080604052603f8060116000396000f3fe6080604052600080fdfea26469706673582212208f55b5c68e6835992b311d3c2bcfd3dfa3767dc43866ee1c95ec4943468ead0a64736f6c63430007030033"; - -type ContractWithPayableConstructorConstructorParams = - | [signer?: Signer] - | ConstructorParameters; - -const isSuperArgs = ( - xs: ContractWithPayableConstructorConstructorParams, -): xs is ConstructorParameters => xs.length > 1; - -export class ContractWithPayableConstructor__factory extends ContractFactory { - constructor(...args: ContractWithPayableConstructorConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override getDeployTransaction(overrides?: PayableOverrides & { from?: string }): Promise { - return super.getDeployTransaction(overrides || {}); - } - override deploy(overrides?: PayableOverrides & { from?: string }) { - return super.deploy(overrides || {}) as Promise< - ContractWithPayableConstructor & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): ContractWithPayableConstructor__factory { - return super.connect(runner) as ContractWithPayableConstructor__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): ContractWithPayableConstructorInterface { - return new Interface(_abi) as ContractWithPayableConstructorInterface; - } - static connect(address: string, runner?: ContractRunner | null): ContractWithPayableConstructor { - return new Contract(address, _abi, runner) as unknown as ContractWithPayableConstructor; - } -} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/Library1__factory.ts b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/Library1__factory.ts deleted file mode 100644 index 8e0a9077..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/Library1__factory.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { NonPayableOverrides } from "../common"; -import type { Library1, Library1Interface } from "../Library1"; - -const _abi = [ - { - inputs: [], - name: "lib", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, -] as const; - -const _bytecode = - "0x6093610024600b82828239805160001a607314601757fe5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361060335760003560e01c806392801230146038575b600080fd5b603e6054565b6040518082815260200191505060405180910390f35b6000600190509056fea26469706673582212203e47a5b791b76105fd08cfba94579f50d47bc0630b28334a3eb62c9fd8dd6dbd64736f6c63430007030033"; - -type Library1ConstructorParams = [signer?: Signer] | ConstructorParameters; - -const isSuperArgs = (xs: Library1ConstructorParams): xs is ConstructorParameters => - xs.length > 1; - -export class Library1__factory extends ContractFactory { - constructor(...args: Library1ConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override getDeployTransaction( - overrides?: NonPayableOverrides & { from?: string }, - ): Promise { - return super.getDeployTransaction(overrides || {}); - } - override deploy(overrides?: NonPayableOverrides & { from?: string }) { - return super.deploy(overrides || {}) as Promise< - Library1 & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): Library1__factory { - return super.connect(runner) as Library1__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): Library1Interface { - return new Interface(_abi) as Library1Interface; - } - static connect(address: string, runner?: ContractRunner | null): Library1 { - return new Contract(address, _abi, runner) as unknown as Library1; - } -} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/Library2__factory.ts b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/Library2__factory.ts deleted file mode 100644 index 6cedf15d..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/Library2__factory.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { NonPayableOverrides } from "../common"; -import type { Library2, Library2Interface } from "../Library2"; - -const _abi = [ - { - inputs: [], - name: "lib", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, -] as const; - -const _bytecode = - "0x6093610024600b82828239805160001a607314601757fe5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361060335760003560e01c806392801230146038575b600080fd5b603e6054565b6040518082815260200191505060405180910390f35b6000600290509056fea26469706673582212208113d4aa65b5894b50a8939595f43f1546915b5f9df1d9837defe0d87eee131164736f6c63430007030033"; - -type Library2ConstructorParams = [signer?: Signer] | ConstructorParameters; - -const isSuperArgs = (xs: Library2ConstructorParams): xs is ConstructorParameters => - xs.length > 1; - -export class Library2__factory extends ContractFactory { - constructor(...args: Library2ConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override getDeployTransaction( - overrides?: NonPayableOverrides & { from?: string }, - ): Promise { - return super.getDeployTransaction(overrides || {}); - } - override deploy(overrides?: NonPayableOverrides & { from?: string }) { - return super.deploy(overrides || {}) as Promise< - Library2 & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): Library2__factory { - return super.connect(runner) as Library2__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): Library2Interface { - return new Interface(_abi) as Library2Interface; - } - static connect(address: string, runner?: ContractRunner | null): Library2 { - return new Contract(address, _abi, runner) as unknown as Library2; - } -} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/index.ts b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/index.ts deleted file mode 100644 index 2098d616..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/factories/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -export { ContractWithConstructorArguments__factory } from "./ContractWithConstructorArguments__factory"; -export { ContractWithExternalLibrary__factory } from "./ContractWithExternalLibrary__factory"; -export { ContractWithPayableConstructor__factory } from "./ContractWithPayableConstructor__factory"; -export { Library1__factory } from "./Library1__factory"; -export { Library2__factory } from "./Library2__factory"; diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/hardhat.d.ts b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/hardhat.d.ts deleted file mode 100644 index ffdc4d50..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/hardhat.d.ts +++ /dev/null @@ -1,125 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { ethers } from "ethers"; -import { - DeployContractOptions, - FactoryOptions, - HardhatEthersHelpers as HardhatEthersHelpersBase, -} from "@nomicfoundation/hardhat-ethers/types"; - -import * as Contracts from "."; - -declare module "hardhat/types/runtime" { - interface HardhatEthersHelpers extends HardhatEthersHelpersBase { - getContractFactory( - name: "ContractWithConstructorArguments", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - getContractFactory( - name: "ContractWithExternalLibrary", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - getContractFactory( - name: "ContractWithPayableConstructor", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - getContractFactory( - name: "Library1", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - getContractFactory( - name: "Library2", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - - getContractAt( - name: "ContractWithConstructorArguments", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - getContractAt( - name: "ContractWithExternalLibrary", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - getContractAt( - name: "ContractWithPayableConstructor", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - getContractAt( - name: "Library1", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - getContractAt( - name: "Library2", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - - deployContract( - name: "ContractWithConstructorArguments", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithExternalLibrary", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithPayableConstructor", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "Library1", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "Library2", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - - deployContract( - name: "ContractWithConstructorArguments", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithExternalLibrary", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithPayableConstructor", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "Library1", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "Library2", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - - // default types - getContractFactory(name: string, signerOrOptions?: ethers.Signer | FactoryOptions): Promise; - getContractFactory(abi: any[], bytecode: ethers.BytesLike, signer?: ethers.Signer): Promise; - getContractAt( - nameOrAbi: string | any[], - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - deployContract(name: string, signerOrOptions?: ethers.Signer | DeployContractOptions): Promise; - deployContract( - name: string, - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - } -} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/index.ts b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/index.ts deleted file mode 100644 index c1bff910..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -export type { ContractWithConstructorArguments } from "./ContractWithConstructorArguments"; -export type { ContractWithExternalLibrary } from "./ContractWithExternalLibrary"; -export type { ContractWithPayableConstructor } from "./ContractWithPayableConstructor"; -export type { Library1 } from "./Library1"; -export type { Library2 } from "./Library2"; -export * as factories from "./factories"; -export { ContractWithConstructorArguments__factory } from "./factories/ContractWithConstructorArguments__factory"; -export { ContractWithExternalLibrary__factory } from "./factories/ContractWithExternalLibrary__factory"; -export { ContractWithPayableConstructor__factory } from "./factories/ContractWithPayableConstructor__factory"; -export { Library1__factory } from "./factories/Library1__factory"; -export { Library2__factory } from "./factories/Library2__factory"; diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/ContractWithConstructorArguments.d.ts b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/ContractWithConstructorArguments.d.ts deleted file mode 100644 index dacd126e..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/ContractWithConstructorArguments.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import BN from "bn.js"; -import { EventData, PastEventOptions } from "web3-eth-contract"; - -export interface ContractWithConstructorArgumentsContract - extends Truffle.Contract { - "new"(_name: string, meta?: Truffle.TransactionDetails): Promise; -} - -type AllEvents = never; - -export interface ContractWithConstructorArgumentsInstance extends Truffle.ContractInstance { - name(txDetails?: Truffle.TransactionDetails): Promise; - - methods: { - name(txDetails?: Truffle.TransactionDetails): Promise; - }; - - getPastEvents(event: string): Promise; - getPastEvents( - event: string, - options: PastEventOptions, - callback: (error: Error, event: EventData) => void, - ): Promise; - getPastEvents(event: string, options: PastEventOptions): Promise; - getPastEvents(event: string, callback: (error: Error, event: EventData) => void): Promise; -} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/ContractWithExternalLibrary.d.ts b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/ContractWithExternalLibrary.d.ts deleted file mode 100644 index 866bb52b..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/ContractWithExternalLibrary.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import BN from "bn.js"; -import { EventData, PastEventOptions } from "web3-eth-contract"; - -export interface ContractWithExternalLibraryContract extends Truffle.Contract { - "new"(meta?: Truffle.TransactionDetails): Promise; -} - -type AllEvents = never; - -export interface ContractWithExternalLibraryInstance extends Truffle.ContractInstance { - lib(txDetails?: Truffle.TransactionDetails): Promise; - - lib2(txDetails?: Truffle.TransactionDetails): Promise; - - lib3(txDetails?: Truffle.TransactionDetails): Promise; - - lib4(txDetails?: Truffle.TransactionDetails): Promise; - - methods: { - lib(txDetails?: Truffle.TransactionDetails): Promise; - - lib2(txDetails?: Truffle.TransactionDetails): Promise; - - lib3(txDetails?: Truffle.TransactionDetails): Promise; - - lib4(txDetails?: Truffle.TransactionDetails): Promise; - }; - - getPastEvents(event: string): Promise; - getPastEvents( - event: string, - options: PastEventOptions, - callback: (error: Error, event: EventData) => void, - ): Promise; - getPastEvents(event: string, options: PastEventOptions): Promise; - getPastEvents(event: string, callback: (error: Error, event: EventData) => void): Promise; -} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/ContractWithPayableConstructor.d.ts b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/ContractWithPayableConstructor.d.ts deleted file mode 100644 index 51f880a6..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/ContractWithPayableConstructor.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import BN from "bn.js"; -import { EventData, PastEventOptions } from "web3-eth-contract"; - -export interface ContractWithPayableConstructorContract - extends Truffle.Contract { - "new"(meta?: Truffle.TransactionDetails): Promise; -} - -type AllEvents = never; - -export interface ContractWithPayableConstructorInstance extends Truffle.ContractInstance { - methods: {}; - - getPastEvents(event: string): Promise; - getPastEvents( - event: string, - options: PastEventOptions, - callback: (error: Error, event: EventData) => void, - ): Promise; - getPastEvents(event: string, options: PastEventOptions): Promise; - getPastEvents(event: string, callback: (error: Error, event: EventData) => void): Promise; -} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/Library1.d.ts b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/Library1.d.ts deleted file mode 100644 index 00c3c449..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/Library1.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import BN from "bn.js"; -import { EventData, PastEventOptions } from "web3-eth-contract"; - -export interface Library1Contract extends Truffle.Contract { - "new"(meta?: Truffle.TransactionDetails): Promise; -} - -type AllEvents = never; - -export interface Library1Instance extends Truffle.ContractInstance { - lib(txDetails?: Truffle.TransactionDetails): Promise; - - methods: { - lib(txDetails?: Truffle.TransactionDetails): Promise; - }; - - getPastEvents(event: string): Promise; - getPastEvents( - event: string, - options: PastEventOptions, - callback: (error: Error, event: EventData) => void, - ): Promise; - getPastEvents(event: string, options: PastEventOptions): Promise; - getPastEvents(event: string, callback: (error: Error, event: EventData) => void): Promise; -} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/Library2.d.ts b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/Library2.d.ts deleted file mode 100644 index 225a085f..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/Library2.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import BN from "bn.js"; -import { EventData, PastEventOptions } from "web3-eth-contract"; - -export interface Library2Contract extends Truffle.Contract { - "new"(meta?: Truffle.TransactionDetails): Promise; -} - -type AllEvents = never; - -export interface Library2Instance extends Truffle.ContractInstance { - lib(txDetails?: Truffle.TransactionDetails): Promise; - - methods: { - lib(txDetails?: Truffle.TransactionDetails): Promise; - }; - - getPastEvents(event: string): Promise; - getPastEvents( - event: string, - options: PastEventOptions, - callback: (error: Error, event: EventData) => void, - ): Promise; - getPastEvents(event: string, options: PastEventOptions): Promise; - getPastEvents(event: string, callback: (error: Error, event: EventData) => void): Promise; -} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/index.d.ts b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/index.d.ts deleted file mode 100644 index 19632a7c..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/index.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { ContractWithConstructorArgumentsContract } from "./ContractWithConstructorArguments"; -import { ContractWithExternalLibraryContract } from "./ContractWithExternalLibrary"; -import { ContractWithPayableConstructorContract } from "./ContractWithPayableConstructor"; -import { Library1Contract } from "./Library1"; -import { Library2Contract } from "./Library2"; - -declare global { - namespace Truffle { - interface Artifacts { - require(name: "ContractWithConstructorArguments"): ContractWithConstructorArgumentsContract; - require(name: "ContractWithExternalLibrary"): ContractWithExternalLibraryContract; - require(name: "ContractWithPayableConstructor"): ContractWithPayableConstructorContract; - require(name: "Library1"): Library1Contract; - require(name: "Library2"): Library2Contract; - } - } -} - -export { - ContractWithConstructorArgumentsContract, - ContractWithConstructorArgumentsInstance, -} from "./ContractWithConstructorArguments"; -export { - ContractWithExternalLibraryContract, - ContractWithExternalLibraryInstance, -} from "./ContractWithExternalLibrary"; -export { - ContractWithPayableConstructorContract, - ContractWithPayableConstructorInstance, -} from "./ContractWithPayableConstructor"; -export { Library1Contract, Library1Instance } from "./Library1"; -export { Library2Contract, Library2Instance } from "./Library2"; diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/types.d.ts b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/types.d.ts deleted file mode 100644 index 54dd0d3b..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/typechain-types/types.d.ts +++ /dev/null @@ -1,120 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -/** - * Globals - */ -/// -/// - -declare type EventEmitter = import("events").EventEmitter; - -declare type BN = import("bn.js"); -declare type Web3 = import("web3").default; -declare type AbiItem = import("web3-utils").AbiItem; -declare type TransactionConfig = import("web3-core").TransactionConfig; -declare type PromiEvent = import("web3-core").PromiEvent; -declare type TransactionReceipt = import("web3-core").TransactionReceipt; -declare type Web3EventOptions = import("web3-eth-contract").EventOptions; - -declare const assert: Chai.AssertStatic; -declare const expect: Chai.ExpectStatic; - -declare const web3: Web3; - -declare const artifacts: Truffle.Artifacts; - -/** - * Global contract function - */ -interface ContractFunction extends Mocha.SuiteFunction { - (title: string, fn: (this: Mocha.Suite, accounts: Truffle.Accounts) => void): Mocha.Suite; - only: ExclusiveContractFunction; - skip: PendingContractFunction; -} - -interface ExclusiveContractFunction extends Mocha.ExclusiveSuiteFunction { - (title: string, fn: (this: Mocha.Suite, accounts: Truffle.Accounts) => void): Mocha.Suite; -} - -interface PendingContractFunction extends Mocha.PendingSuiteFunction { - (title: string, fn: (this: Mocha.Suite, accounts: Truffle.Accounts) => void): Mocha.Suite | void; -} - -declare const contract: ContractFunction; - -/** - * Namespace - */ -declare namespace Truffle { - type Accounts = string[]; - - interface TransactionDetails { - from?: string; - gas?: BN | number | string; - gasPrice?: BN | number | string; - maxPriorityFeePerGas?: BN | number | string; - maxFeePerGas?: BN | number | string; - value?: BN | string; - } - - export interface TransactionLog { - address: string; - event: EVENTS["name"]; - args: EVENTS["args"]; - blockHash: string; - blockNumber: number; - logIndex: number; - transactionHash: string; - transactionIndex: number; - type: string; - } - - export interface TransactionResponse { - tx: string; - receipt: any; - logs: TransactionLog[]; - } - - export interface AnyEvent { - name: string; - args: any; - } - - interface Contract extends ContractNew { - deployed(): Promise; - at(address: string): Promise; - link(name: string, address: string): void; - link(contract: Contract): void; - address: string; - contractName: string; - } - - interface EventOptions { - filter?: Web3EventOptions["filter"]; - fromBlock?: Web3EventOptions["fromBlock"]; - topics?: Web3EventOptions["topics"]; - } - - interface ContractInstance { - address: string; - contract: any; - transactionHash: string; - abi: AbiItem[]; - allEvents(params?: EventOptions): EventEmitter; - send(value: Required["value"], txParams?: TransactionConfig): PromiEvent; - sendTransaction(transactionConfig: TransactionConfig): PromiEvent; - } - - interface ContractNew { - "new"(...args: ARGs): any; - } - - interface Deployer { - link(library: Truffle.Contract, destination: Truffle.Contract): Deployer; - link(library: Truffle.Contract, destinations: Array>): Deployer; - deploy(c: ContractNew, ...args: T): Deployer; - } - - type Migration = (deploy: Deployer, network: string, accounts: Accounts) => void; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/ContractWithConstructorArguments.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/ContractWithConstructorArguments.ts deleted file mode 100644 index c6404da0..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/ContractWithConstructorArguments.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BytesLike, - FunctionFragment, - Result, - Interface, - ContractRunner, - ContractMethod, - Listener, -} from "ethers"; -import type { - TypedContractEvent, - TypedDeferredTopicFilter, - TypedEventLog, - TypedListener, - TypedContractMethod, -} from "../common"; - -export interface ContractWithConstructorArgumentsInterface extends Interface { - getFunction(nameOrSignature: "name"): FunctionFragment; - - encodeFunctionData(functionFragment: "name", values?: undefined): string; - - decodeFunctionResult(functionFragment: "name", data: BytesLike): Result; -} - -export interface ContractWithConstructorArguments extends BaseContract { - connect(runner?: ContractRunner | null): ContractWithConstructorArguments; - waitForDeployment(): Promise; - - interface: ContractWithConstructorArgumentsInterface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - name: TypedContractMethod<[], [string], "view">; - - getFunction(key: string | FunctionFragment): T; - - getFunction(nameOrSignature: "name"): TypedContractMethod<[], [string], "view">; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/ContractWithExternalLibrary.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/ContractWithExternalLibrary.ts deleted file mode 100644 index a5ce6497..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/ContractWithExternalLibrary.ts +++ /dev/null @@ -1,85 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BytesLike, - FunctionFragment, - Result, - Interface, - ContractRunner, - ContractMethod, - Listener, -} from "ethers"; -import type { - TypedContractEvent, - TypedDeferredTopicFilter, - TypedEventLog, - TypedListener, - TypedContractMethod, -} from "../common"; - -export interface ContractWithExternalLibraryInterface extends Interface { - getFunction(nameOrSignature: "lib" | "lib2" | "lib3" | "lib4"): FunctionFragment; - - encodeFunctionData(functionFragment: "lib", values?: undefined): string; - encodeFunctionData(functionFragment: "lib2", values?: undefined): string; - encodeFunctionData(functionFragment: "lib3", values?: undefined): string; - encodeFunctionData(functionFragment: "lib4", values?: undefined): string; - - decodeFunctionResult(functionFragment: "lib", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "lib2", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "lib3", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "lib4", data: BytesLike): Result; -} - -export interface ContractWithExternalLibrary extends BaseContract { - connect(runner?: ContractRunner | null): ContractWithExternalLibrary; - waitForDeployment(): Promise; - - interface: ContractWithExternalLibraryInterface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - lib: TypedContractMethod<[], [bigint], "view">; - - lib2: TypedContractMethod<[], [bigint], "view">; - - lib3: TypedContractMethod<[], [bigint], "view">; - - lib4: TypedContractMethod<[], [bigint], "view">; - - getFunction(key: string | FunctionFragment): T; - - getFunction(nameOrSignature: "lib"): TypedContractMethod<[], [bigint], "view">; - getFunction(nameOrSignature: "lib2"): TypedContractMethod<[], [bigint], "view">; - getFunction(nameOrSignature: "lib3"): TypedContractMethod<[], [bigint], "view">; - getFunction(nameOrSignature: "lib4"): TypedContractMethod<[], [bigint], "view">; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/ContractWithPayableConstructor.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/ContractWithPayableConstructor.ts deleted file mode 100644 index 820e27e9..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/ContractWithPayableConstructor.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { BaseContract, FunctionFragment, Interface, ContractRunner, ContractMethod, Listener } from "ethers"; -import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedListener } from "../common"; - -export interface ContractWithPayableConstructorInterface extends Interface {} - -export interface ContractWithPayableConstructor extends BaseContract { - connect(runner?: ContractRunner | null): ContractWithPayableConstructor; - waitForDeployment(): Promise; - - interface: ContractWithPayableConstructorInterface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - getFunction(key: string | FunctionFragment): T; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/Library1.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/Library1.ts deleted file mode 100644 index b6d1a664..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/Library1.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BytesLike, - FunctionFragment, - Result, - Interface, - ContractRunner, - ContractMethod, - Listener, -} from "ethers"; -import type { - TypedContractEvent, - TypedDeferredTopicFilter, - TypedEventLog, - TypedListener, - TypedContractMethod, -} from "../common"; - -export interface Library1Interface extends Interface { - getFunction(nameOrSignature: "lib"): FunctionFragment; - - encodeFunctionData(functionFragment: "lib", values?: undefined): string; - - decodeFunctionResult(functionFragment: "lib", data: BytesLike): Result; -} - -export interface Library1 extends BaseContract { - connect(runner?: ContractRunner | null): Library1; - waitForDeployment(): Promise; - - interface: Library1Interface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - lib: TypedContractMethod<[], [bigint], "view">; - - getFunction(key: string | FunctionFragment): T; - - getFunction(nameOrSignature: "lib"): TypedContractMethod<[], [bigint], "view">; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/Library2.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/Library2.ts deleted file mode 100644 index ae7e81c3..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/Library2.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BytesLike, - FunctionFragment, - Result, - Interface, - ContractRunner, - ContractMethod, - Listener, -} from "ethers"; -import type { - TypedContractEvent, - TypedDeferredTopicFilter, - TypedEventLog, - TypedListener, - TypedContractMethod, -} from "../common"; - -export interface Library2Interface extends Interface { - getFunction(nameOrSignature: "lib"): FunctionFragment; - - encodeFunctionData(functionFragment: "lib", values?: undefined): string; - - decodeFunctionResult(functionFragment: "lib", data: BytesLike): Result; -} - -export interface Library2 extends BaseContract { - connect(runner?: ContractRunner | null): Library2; - waitForDeployment(): Promise; - - interface: Library2Interface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - lib: TypedContractMethod<[], [bigint], "view">; - - getFunction(key: string | FunctionFragment): T; - - getFunction(nameOrSignature: "lib"): TypedContractMethod<[], [bigint], "view">; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/index.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/index.ts deleted file mode 100644 index 20a920bf..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts.sol/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -export type { ContractWithConstructorArguments } from "./ContractWithConstructorArguments"; -export type { ContractWithExternalLibrary } from "./ContractWithExternalLibrary"; -export type { ContractWithPayableConstructor } from "./ContractWithPayableConstructor"; -export type { Library1 } from "./Library1"; -export type { Library2 } from "./Library2"; diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/ContractWithConstructorArguments.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/ContractWithConstructorArguments.ts deleted file mode 100644 index c6404da0..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/ContractWithConstructorArguments.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BytesLike, - FunctionFragment, - Result, - Interface, - ContractRunner, - ContractMethod, - Listener, -} from "ethers"; -import type { - TypedContractEvent, - TypedDeferredTopicFilter, - TypedEventLog, - TypedListener, - TypedContractMethod, -} from "../common"; - -export interface ContractWithConstructorArgumentsInterface extends Interface { - getFunction(nameOrSignature: "name"): FunctionFragment; - - encodeFunctionData(functionFragment: "name", values?: undefined): string; - - decodeFunctionResult(functionFragment: "name", data: BytesLike): Result; -} - -export interface ContractWithConstructorArguments extends BaseContract { - connect(runner?: ContractRunner | null): ContractWithConstructorArguments; - waitForDeployment(): Promise; - - interface: ContractWithConstructorArgumentsInterface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - name: TypedContractMethod<[], [string], "view">; - - getFunction(key: string | FunctionFragment): T; - - getFunction(nameOrSignature: "name"): TypedContractMethod<[], [string], "view">; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/ContractWithExternalLibrary.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/ContractWithExternalLibrary.ts deleted file mode 100644 index a5ce6497..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/ContractWithExternalLibrary.ts +++ /dev/null @@ -1,85 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BytesLike, - FunctionFragment, - Result, - Interface, - ContractRunner, - ContractMethod, - Listener, -} from "ethers"; -import type { - TypedContractEvent, - TypedDeferredTopicFilter, - TypedEventLog, - TypedListener, - TypedContractMethod, -} from "../common"; - -export interface ContractWithExternalLibraryInterface extends Interface { - getFunction(nameOrSignature: "lib" | "lib2" | "lib3" | "lib4"): FunctionFragment; - - encodeFunctionData(functionFragment: "lib", values?: undefined): string; - encodeFunctionData(functionFragment: "lib2", values?: undefined): string; - encodeFunctionData(functionFragment: "lib3", values?: undefined): string; - encodeFunctionData(functionFragment: "lib4", values?: undefined): string; - - decodeFunctionResult(functionFragment: "lib", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "lib2", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "lib3", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "lib4", data: BytesLike): Result; -} - -export interface ContractWithExternalLibrary extends BaseContract { - connect(runner?: ContractRunner | null): ContractWithExternalLibrary; - waitForDeployment(): Promise; - - interface: ContractWithExternalLibraryInterface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - lib: TypedContractMethod<[], [bigint], "view">; - - lib2: TypedContractMethod<[], [bigint], "view">; - - lib3: TypedContractMethod<[], [bigint], "view">; - - lib4: TypedContractMethod<[], [bigint], "view">; - - getFunction(key: string | FunctionFragment): T; - - getFunction(nameOrSignature: "lib"): TypedContractMethod<[], [bigint], "view">; - getFunction(nameOrSignature: "lib2"): TypedContractMethod<[], [bigint], "view">; - getFunction(nameOrSignature: "lib3"): TypedContractMethod<[], [bigint], "view">; - getFunction(nameOrSignature: "lib4"): TypedContractMethod<[], [bigint], "view">; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/ContractWithPayableConstructor.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/ContractWithPayableConstructor.ts deleted file mode 100644 index 820e27e9..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/ContractWithPayableConstructor.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { BaseContract, FunctionFragment, Interface, ContractRunner, ContractMethod, Listener } from "ethers"; -import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedListener } from "../common"; - -export interface ContractWithPayableConstructorInterface extends Interface {} - -export interface ContractWithPayableConstructor extends BaseContract { - connect(runner?: ContractRunner | null): ContractWithPayableConstructor; - waitForDeployment(): Promise; - - interface: ContractWithPayableConstructorInterface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - getFunction(key: string | FunctionFragment): T; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/Library1.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/Library1.ts deleted file mode 100644 index b6d1a664..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/Library1.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BytesLike, - FunctionFragment, - Result, - Interface, - ContractRunner, - ContractMethod, - Listener, -} from "ethers"; -import type { - TypedContractEvent, - TypedDeferredTopicFilter, - TypedEventLog, - TypedListener, - TypedContractMethod, -} from "../common"; - -export interface Library1Interface extends Interface { - getFunction(nameOrSignature: "lib"): FunctionFragment; - - encodeFunctionData(functionFragment: "lib", values?: undefined): string; - - decodeFunctionResult(functionFragment: "lib", data: BytesLike): Result; -} - -export interface Library1 extends BaseContract { - connect(runner?: ContractRunner | null): Library1; - waitForDeployment(): Promise; - - interface: Library1Interface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - lib: TypedContractMethod<[], [bigint], "view">; - - getFunction(key: string | FunctionFragment): T; - - getFunction(nameOrSignature: "lib"): TypedContractMethod<[], [bigint], "view">; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/Library2.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/Library2.ts deleted file mode 100644 index ae7e81c3..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/Library2.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BytesLike, - FunctionFragment, - Result, - Interface, - ContractRunner, - ContractMethod, - Listener, -} from "ethers"; -import type { - TypedContractEvent, - TypedDeferredTopicFilter, - TypedEventLog, - TypedListener, - TypedContractMethod, -} from "../common"; - -export interface Library2Interface extends Interface { - getFunction(nameOrSignature: "lib"): FunctionFragment; - - encodeFunctionData(functionFragment: "lib", values?: undefined): string; - - decodeFunctionResult(functionFragment: "lib", data: BytesLike): Result; -} - -export interface Library2 extends BaseContract { - connect(runner?: ContractRunner | null): Library2; - waitForDeployment(): Promise; - - interface: Library2Interface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - lib: TypedContractMethod<[], [bigint], "view">; - - getFunction(key: string | FunctionFragment): T; - - getFunction(nameOrSignature: "lib"): TypedContractMethod<[], [bigint], "view">; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/index.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/index.ts deleted file mode 100644 index 20a920bf..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/Contracts2.sol/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -export type { ContractWithConstructorArguments } from "./ContractWithConstructorArguments"; -export type { ContractWithExternalLibrary } from "./ContractWithExternalLibrary"; -export type { ContractWithPayableConstructor } from "./ContractWithPayableConstructor"; -export type { Library1 } from "./Library1"; -export type { Library2 } from "./Library2"; diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/ContractWithConstructorArguments.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/ContractWithConstructorArguments.ts deleted file mode 100644 index 0a14345d..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/ContractWithConstructorArguments.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BytesLike, - FunctionFragment, - Result, - Interface, - ContractRunner, - ContractMethod, - Listener, -} from "ethers"; -import type { - TypedContractEvent, - TypedDeferredTopicFilter, - TypedEventLog, - TypedListener, - TypedContractMethod, -} from "../../common"; - -export interface ContractWithConstructorArgumentsInterface extends Interface { - getFunction(nameOrSignature: "name"): FunctionFragment; - - encodeFunctionData(functionFragment: "name", values?: undefined): string; - - decodeFunctionResult(functionFragment: "name", data: BytesLike): Result; -} - -export interface ContractWithConstructorArguments extends BaseContract { - connect(runner?: ContractRunner | null): ContractWithConstructorArguments; - waitForDeployment(): Promise; - - interface: ContractWithConstructorArgumentsInterface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - name: TypedContractMethod<[], [string], "view">; - - getFunction(key: string | FunctionFragment): T; - - getFunction(nameOrSignature: "name"): TypedContractMethod<[], [string], "view">; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/ContractWithExternalLibrary.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/ContractWithExternalLibrary.ts deleted file mode 100644 index 7cd7cf82..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/ContractWithExternalLibrary.ts +++ /dev/null @@ -1,85 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BytesLike, - FunctionFragment, - Result, - Interface, - ContractRunner, - ContractMethod, - Listener, -} from "ethers"; -import type { - TypedContractEvent, - TypedDeferredTopicFilter, - TypedEventLog, - TypedListener, - TypedContractMethod, -} from "../../common"; - -export interface ContractWithExternalLibraryInterface extends Interface { - getFunction(nameOrSignature: "lib" | "lib2" | "lib3" | "lib4"): FunctionFragment; - - encodeFunctionData(functionFragment: "lib", values?: undefined): string; - encodeFunctionData(functionFragment: "lib2", values?: undefined): string; - encodeFunctionData(functionFragment: "lib3", values?: undefined): string; - encodeFunctionData(functionFragment: "lib4", values?: undefined): string; - - decodeFunctionResult(functionFragment: "lib", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "lib2", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "lib3", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "lib4", data: BytesLike): Result; -} - -export interface ContractWithExternalLibrary extends BaseContract { - connect(runner?: ContractRunner | null): ContractWithExternalLibrary; - waitForDeployment(): Promise; - - interface: ContractWithExternalLibraryInterface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - lib: TypedContractMethod<[], [bigint], "view">; - - lib2: TypedContractMethod<[], [bigint], "view">; - - lib3: TypedContractMethod<[], [bigint], "view">; - - lib4: TypedContractMethod<[], [bigint], "view">; - - getFunction(key: string | FunctionFragment): T; - - getFunction(nameOrSignature: "lib"): TypedContractMethod<[], [bigint], "view">; - getFunction(nameOrSignature: "lib2"): TypedContractMethod<[], [bigint], "view">; - getFunction(nameOrSignature: "lib3"): TypedContractMethod<[], [bigint], "view">; - getFunction(nameOrSignature: "lib4"): TypedContractMethod<[], [bigint], "view">; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/ContractWithPayableConstructor.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/ContractWithPayableConstructor.ts deleted file mode 100644 index 7da39a2e..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/ContractWithPayableConstructor.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { BaseContract, FunctionFragment, Interface, ContractRunner, ContractMethod, Listener } from "ethers"; -import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedListener } from "../../common"; - -export interface ContractWithPayableConstructorInterface extends Interface {} - -export interface ContractWithPayableConstructor extends BaseContract { - connect(runner?: ContractRunner | null): ContractWithPayableConstructor; - waitForDeployment(): Promise; - - interface: ContractWithPayableConstructorInterface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - getFunction(key: string | FunctionFragment): T; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/Library1.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/Library1.ts deleted file mode 100644 index 1e853866..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/Library1.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BytesLike, - FunctionFragment, - Result, - Interface, - ContractRunner, - ContractMethod, - Listener, -} from "ethers"; -import type { - TypedContractEvent, - TypedDeferredTopicFilter, - TypedEventLog, - TypedListener, - TypedContractMethod, -} from "../../common"; - -export interface Library1Interface extends Interface { - getFunction(nameOrSignature: "lib"): FunctionFragment; - - encodeFunctionData(functionFragment: "lib", values?: undefined): string; - - decodeFunctionResult(functionFragment: "lib", data: BytesLike): Result; -} - -export interface Library1 extends BaseContract { - connect(runner?: ContractRunner | null): Library1; - waitForDeployment(): Promise; - - interface: Library1Interface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - lib: TypedContractMethod<[], [bigint], "view">; - - getFunction(key: string | FunctionFragment): T; - - getFunction(nameOrSignature: "lib"): TypedContractMethod<[], [bigint], "view">; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/Library2.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/Library2.ts deleted file mode 100644 index 735341ba..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/Library2.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BytesLike, - FunctionFragment, - Result, - Interface, - ContractRunner, - ContractMethod, - Listener, -} from "ethers"; -import type { - TypedContractEvent, - TypedDeferredTopicFilter, - TypedEventLog, - TypedListener, - TypedContractMethod, -} from "../../common"; - -export interface Library2Interface extends Interface { - getFunction(nameOrSignature: "lib"): FunctionFragment; - - encodeFunctionData(functionFragment: "lib", values?: undefined): string; - - decodeFunctionResult(functionFragment: "lib", data: BytesLike): Result; -} - -export interface Library2 extends BaseContract { - connect(runner?: ContractRunner | null): Library2; - waitForDeployment(): Promise; - - interface: Library2Interface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - lib: TypedContractMethod<[], [bigint], "view">; - - getFunction(key: string | FunctionFragment): T; - - getFunction(nameOrSignature: "lib"): TypedContractMethod<[], [bigint], "view">; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/index.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/index.ts deleted file mode 100644 index 20a920bf..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts.sol/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -export type { ContractWithConstructorArguments } from "./ContractWithConstructorArguments"; -export type { ContractWithExternalLibrary } from "./ContractWithExternalLibrary"; -export type { ContractWithPayableConstructor } from "./ContractWithPayableConstructor"; -export type { Library1 } from "./Library1"; -export type { Library2 } from "./Library2"; diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/ContractWithConstructorArguments.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/ContractWithConstructorArguments.ts deleted file mode 100644 index 0a14345d..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/ContractWithConstructorArguments.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BytesLike, - FunctionFragment, - Result, - Interface, - ContractRunner, - ContractMethod, - Listener, -} from "ethers"; -import type { - TypedContractEvent, - TypedDeferredTopicFilter, - TypedEventLog, - TypedListener, - TypedContractMethod, -} from "../../common"; - -export interface ContractWithConstructorArgumentsInterface extends Interface { - getFunction(nameOrSignature: "name"): FunctionFragment; - - encodeFunctionData(functionFragment: "name", values?: undefined): string; - - decodeFunctionResult(functionFragment: "name", data: BytesLike): Result; -} - -export interface ContractWithConstructorArguments extends BaseContract { - connect(runner?: ContractRunner | null): ContractWithConstructorArguments; - waitForDeployment(): Promise; - - interface: ContractWithConstructorArgumentsInterface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - name: TypedContractMethod<[], [string], "view">; - - getFunction(key: string | FunctionFragment): T; - - getFunction(nameOrSignature: "name"): TypedContractMethod<[], [string], "view">; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/ContractWithExternalLibrary.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/ContractWithExternalLibrary.ts deleted file mode 100644 index 7cd7cf82..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/ContractWithExternalLibrary.ts +++ /dev/null @@ -1,85 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BytesLike, - FunctionFragment, - Result, - Interface, - ContractRunner, - ContractMethod, - Listener, -} from "ethers"; -import type { - TypedContractEvent, - TypedDeferredTopicFilter, - TypedEventLog, - TypedListener, - TypedContractMethod, -} from "../../common"; - -export interface ContractWithExternalLibraryInterface extends Interface { - getFunction(nameOrSignature: "lib" | "lib2" | "lib3" | "lib4"): FunctionFragment; - - encodeFunctionData(functionFragment: "lib", values?: undefined): string; - encodeFunctionData(functionFragment: "lib2", values?: undefined): string; - encodeFunctionData(functionFragment: "lib3", values?: undefined): string; - encodeFunctionData(functionFragment: "lib4", values?: undefined): string; - - decodeFunctionResult(functionFragment: "lib", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "lib2", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "lib3", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "lib4", data: BytesLike): Result; -} - -export interface ContractWithExternalLibrary extends BaseContract { - connect(runner?: ContractRunner | null): ContractWithExternalLibrary; - waitForDeployment(): Promise; - - interface: ContractWithExternalLibraryInterface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - lib: TypedContractMethod<[], [bigint], "view">; - - lib2: TypedContractMethod<[], [bigint], "view">; - - lib3: TypedContractMethod<[], [bigint], "view">; - - lib4: TypedContractMethod<[], [bigint], "view">; - - getFunction(key: string | FunctionFragment): T; - - getFunction(nameOrSignature: "lib"): TypedContractMethod<[], [bigint], "view">; - getFunction(nameOrSignature: "lib2"): TypedContractMethod<[], [bigint], "view">; - getFunction(nameOrSignature: "lib3"): TypedContractMethod<[], [bigint], "view">; - getFunction(nameOrSignature: "lib4"): TypedContractMethod<[], [bigint], "view">; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/ContractWithPayableConstructor.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/ContractWithPayableConstructor.ts deleted file mode 100644 index 7da39a2e..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/ContractWithPayableConstructor.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { BaseContract, FunctionFragment, Interface, ContractRunner, ContractMethod, Listener } from "ethers"; -import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedListener } from "../../common"; - -export interface ContractWithPayableConstructorInterface extends Interface {} - -export interface ContractWithPayableConstructor extends BaseContract { - connect(runner?: ContractRunner | null): ContractWithPayableConstructor; - waitForDeployment(): Promise; - - interface: ContractWithPayableConstructorInterface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - getFunction(key: string | FunctionFragment): T; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/Library1.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/Library1.ts deleted file mode 100644 index 1e853866..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/Library1.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BytesLike, - FunctionFragment, - Result, - Interface, - ContractRunner, - ContractMethod, - Listener, -} from "ethers"; -import type { - TypedContractEvent, - TypedDeferredTopicFilter, - TypedEventLog, - TypedListener, - TypedContractMethod, -} from "../../common"; - -export interface Library1Interface extends Interface { - getFunction(nameOrSignature: "lib"): FunctionFragment; - - encodeFunctionData(functionFragment: "lib", values?: undefined): string; - - decodeFunctionResult(functionFragment: "lib", data: BytesLike): Result; -} - -export interface Library1 extends BaseContract { - connect(runner?: ContractRunner | null): Library1; - waitForDeployment(): Promise; - - interface: Library1Interface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - lib: TypedContractMethod<[], [bigint], "view">; - - getFunction(key: string | FunctionFragment): T; - - getFunction(nameOrSignature: "lib"): TypedContractMethod<[], [bigint], "view">; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/Library2.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/Library2.ts deleted file mode 100644 index 735341ba..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/Library2.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BytesLike, - FunctionFragment, - Result, - Interface, - ContractRunner, - ContractMethod, - Listener, -} from "ethers"; -import type { - TypedContractEvent, - TypedDeferredTopicFilter, - TypedEventLog, - TypedListener, - TypedContractMethod, -} from "../../common"; - -export interface Library2Interface extends Interface { - getFunction(nameOrSignature: "lib"): FunctionFragment; - - encodeFunctionData(functionFragment: "lib", values?: undefined): string; - - decodeFunctionResult(functionFragment: "lib", data: BytesLike): Result; -} - -export interface Library2 extends BaseContract { - connect(runner?: ContractRunner | null): Library2; - waitForDeployment(): Promise; - - interface: Library2Interface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined, - ): Promise>>; - - on(event: TCEvent, listener: TypedListener): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - once(event: TCEvent, listener: TypedListener): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener, - ): Promise; - - listeners(event: TCEvent): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners(event?: TCEvent): Promise; - - lib: TypedContractMethod<[], [bigint], "view">; - - getFunction(key: string | FunctionFragment): T; - - getFunction(nameOrSignature: "lib"): TypedContractMethod<[], [bigint], "view">; - - filters: {}; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/index.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/index.ts deleted file mode 100644 index 20a920bf..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/Contracts2.sol/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -export type { ContractWithConstructorArguments } from "./ContractWithConstructorArguments"; -export type { ContractWithExternalLibrary } from "./ContractWithExternalLibrary"; -export type { ContractWithPayableConstructor } from "./ContractWithPayableConstructor"; -export type { Library1 } from "./Library1"; -export type { Library2 } from "./Library2"; diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/index.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/index.ts deleted file mode 100644 index c0b41ac6..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/another-contracts/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type * as contractsSol from "./Contracts.sol"; -export type { contractsSol }; -import type * as contracts2Sol from "./Contracts2.sol"; -export type { contracts2Sol }; diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/common.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/common.ts deleted file mode 100644 index e9519244..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/common.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - FunctionFragment, - Typed, - EventFragment, - ContractTransaction, - ContractTransactionResponse, - DeferredTopicFilter, - EventLog, - TransactionRequest, - LogDescription, -} from "ethers"; - -export interface TypedDeferredTopicFilter<_TCEvent extends TypedContractEvent> extends DeferredTopicFilter {} - -export interface TypedContractEvent< - InputTuple extends Array = any, - OutputTuple extends Array = any, - OutputObject = any, -> { - (...args: Partial): TypedDeferredTopicFilter>; - name: string; - fragment: EventFragment; - getFragment(...args: Partial): EventFragment; -} - -type __TypechainAOutputTuple = T extends TypedContractEvent ? W : never; -type __TypechainOutputObject = T extends TypedContractEvent ? V : never; - -export interface TypedEventLog extends Omit { - args: __TypechainAOutputTuple & __TypechainOutputObject; -} - -export interface TypedLogDescription extends Omit { - args: __TypechainAOutputTuple & __TypechainOutputObject; -} - -export type TypedListener = ( - ...listenerArg: [...__TypechainAOutputTuple, TypedEventLog, ...undefined[]] -) => void; - -export type MinEthersFactory = { - deploy(...a: ARGS[]): Promise; -}; - -export type GetContractTypeFromFactory = F extends MinEthersFactory ? C : never; -export type GetARGsTypeFromFactory = F extends MinEthersFactory ? Parameters : never; - -export type StateMutability = "nonpayable" | "payable" | "view"; - -export type BaseOverrides = Omit; -export type NonPayableOverrides = Omit; -export type PayableOverrides = Omit; -export type ViewOverrides = Omit; -export type Overrides = S extends "nonpayable" - ? NonPayableOverrides - : S extends "payable" - ? PayableOverrides - : ViewOverrides; - -export type PostfixOverrides, S extends StateMutability> = A | [...A, Overrides]; -export type ContractMethodArgs, S extends StateMutability> = PostfixOverrides< - { [I in keyof A]-?: A[I] | Typed }, - S ->; - -export type DefaultReturnType = R extends Array ? R[0] : R; - -// export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> { -export interface TypedContractMethod< - A extends Array = Array, - R = any, - S extends StateMutability = "payable", -> { - ( - ...args: ContractMethodArgs - ): S extends "view" ? Promise> : Promise; - - name: string; - - fragment: FunctionFragment; - - getFragment(...args: ContractMethodArgs): FunctionFragment; - - populateTransaction(...args: ContractMethodArgs): Promise; - staticCall(...args: ContractMethodArgs): Promise>; - send(...args: ContractMethodArgs): Promise; - estimateGas(...args: ContractMethodArgs): Promise; - staticCallResult(...args: ContractMethodArgs): Promise; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/ContractWithConstructorArguments__factory.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/ContractWithConstructorArguments__factory.ts deleted file mode 100644 index 3b515605..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/ContractWithConstructorArguments__factory.ts +++ /dev/null @@ -1,84 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { NonPayableOverrides } from "../../common"; -import type { - ContractWithConstructorArguments, - ContractWithConstructorArgumentsInterface, -} from "../../Contracts.sol/ContractWithConstructorArguments"; - -const _abi = [ - { - inputs: [ - { - internalType: "string", - name: "_name", - type: "string", - }, - ], - stateMutability: "nonpayable", - type: "constructor", - }, - { - inputs: [], - name: "name", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], - stateMutability: "view", - type: "function", - }, -] as const; - -const _bytecode = - "0x608060405234801561001057600080fd5b5060405161033e38038061033e8339818101604052602081101561003357600080fd5b810190808051604051939291908464010000000082111561005357600080fd5b8382019150602082018581111561006957600080fd5b825186600182028301116401000000008211171561008657600080fd5b8083526020830192505050908051906020019080838360005b838110156100ba57808201518184015260208101905061009f565b50505050905090810190601f1680156100e75780820380516001836020036101000a031916815260200191505b50604052505050806000908051906020019061010492919061010b565b50506101a8565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061014c57805160ff191683800117855561017a565b8280016001018555821561017a579182015b8281111561017957825182559160200191906001019061015e565b5b509050610187919061018b565b5090565b5b808211156101a457600081600090555060010161018c565b5090565b610187806101b76000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806306fdde0314610030575b600080fd5b6100386100b3565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561007857808201518184015260208101905061005d565b50505050905090810190601f1680156100a55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156101495780601f1061011e57610100808354040283529160200191610149565b820191906000526020600020905b81548152906001019060200180831161012c57829003601f168201915b50505050508156fea2646970667358221220fafcb337be24b0cc0bd237410e96c0372e20d83b64721391a45edbe34a57235764736f6c63430007030033"; - -type ContractWithConstructorArgumentsConstructorParams = - | [signer?: Signer] - | ConstructorParameters; - -const isSuperArgs = ( - xs: ContractWithConstructorArgumentsConstructorParams, -): xs is ConstructorParameters => xs.length > 1; - -export class ContractWithConstructorArguments__factory extends ContractFactory { - constructor(...args: ContractWithConstructorArgumentsConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override getDeployTransaction( - _name: string, - overrides?: NonPayableOverrides & { from?: string }, - ): Promise { - return super.getDeployTransaction(_name, overrides || {}); - } - override deploy(_name: string, overrides?: NonPayableOverrides & { from?: string }) { - return super.deploy(_name, overrides || {}) as Promise< - ContractWithConstructorArguments & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): ContractWithConstructorArguments__factory { - return super.connect(runner) as ContractWithConstructorArguments__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): ContractWithConstructorArgumentsInterface { - return new Interface(_abi) as ContractWithConstructorArgumentsInterface; - } - static connect(address: string, runner?: ContractRunner | null): ContractWithConstructorArguments { - return new Contract(address, _abi, runner) as unknown as ContractWithConstructorArguments; - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/ContractWithExternalLibrary__factory.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/ContractWithExternalLibrary__factory.ts deleted file mode 100644 index 94e7e82a..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/ContractWithExternalLibrary__factory.ts +++ /dev/null @@ -1,139 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { NonPayableOverrides } from "../../common"; -import type { - ContractWithExternalLibrary, - ContractWithExternalLibraryInterface, -} from "../../Contracts.sol/ContractWithExternalLibrary"; - -const _abi = [ - { - inputs: [], - name: "lib", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "lib2", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "lib3", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "lib4", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, -] as const; - -const _bytecode = - "0x608060405234801561001057600080fd5b5061023b806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806336ecdf8f14610051578063928012301461006f578063eaebdc061461008d578063ff1a250f146100ab575b600080fd5b6100596100c9565b6040518082815260200191505060405180910390f35b6100776100d8565b6040518082815260200191505060405180910390f35b61009561015e565b6040518082815260200191505060405180910390f35b6100b361016d565b6040518082815260200191505060405180910390f35b60006100d36101f3565b905090565b600073__$b9c1a48d6c9f5a88b03589aab3a8427642$__63928012306040518163ffffffff1660e01b815260040160206040518083038186803b15801561011e57600080fd5b505af4158015610132573d6000803e3d6000fd5b505050506040513d602081101561014857600080fd5b8101908080519060200190929190505050905090565b60006101686101fc565b905090565b600073__$3f2d97621aa449c79a29870f919f014493$__63928012306040518163ffffffff1660e01b815260040160206040518083038186803b1580156101b357600080fd5b505af41580156101c7573d6000803e3d6000fd5b505050506040513d60208110156101dd57600080fd5b8101908080519060200190929190505050905090565b60006003905090565b6000600390509056fea26469706673582212207f27d96db02fe0d602297d8eae80067e49ac743b710c03df9e035a2cb49cb77864736f6c63430007030033"; - -type ContractWithExternalLibraryConstructorParams = - | [linkLibraryAddresses: ContractWithExternalLibraryLibraryAddresses, signer?: Signer] - | ConstructorParameters; - -const isSuperArgs = ( - xs: ContractWithExternalLibraryConstructorParams, -): xs is ConstructorParameters => { - return ( - typeof xs[0] === "string" || - (Array.isArray as (arg: any) => arg is readonly any[])(xs[0]) || - "_isInterface" in xs[0] - ); -}; - -export class ContractWithExternalLibrary__factory extends ContractFactory { - constructor(...args: ContractWithExternalLibraryConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - const [linkLibraryAddresses, signer] = args; - super(_abi, ContractWithExternalLibrary__factory.linkBytecode(linkLibraryAddresses), signer); - } - } - - static linkBytecode(linkLibraryAddresses: ContractWithExternalLibraryLibraryAddresses): string { - let linkedBytecode = _bytecode; - - linkedBytecode = linkedBytecode.replace( - new RegExp("__\\$b9c1a48d6c9f5a88b03589aab3a8427642\\$__", "g"), - linkLibraryAddresses["contracts/Contracts.sol:Library1"].replace(/^0x/, "").toLowerCase(), - ); - - linkedBytecode = linkedBytecode.replace( - new RegExp("__\\$3f2d97621aa449c79a29870f919f014493\\$__", "g"), - linkLibraryAddresses["contracts/Contracts.sol:Library2"].replace(/^0x/, "").toLowerCase(), - ); - - return linkedBytecode; - } - - override getDeployTransaction( - overrides?: NonPayableOverrides & { from?: string }, - ): Promise { - return super.getDeployTransaction(overrides || {}); - } - override deploy(overrides?: NonPayableOverrides & { from?: string }) { - return super.deploy(overrides || {}) as Promise< - ContractWithExternalLibrary & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): ContractWithExternalLibrary__factory { - return super.connect(runner) as ContractWithExternalLibrary__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): ContractWithExternalLibraryInterface { - return new Interface(_abi) as ContractWithExternalLibraryInterface; - } - static connect(address: string, runner?: ContractRunner | null): ContractWithExternalLibrary { - return new Contract(address, _abi, runner) as unknown as ContractWithExternalLibrary; - } -} - -export interface ContractWithExternalLibraryLibraryAddresses { - ["contracts/Contracts.sol:Library1"]: string; - ["contracts/Contracts.sol:Library2"]: string; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/ContractWithPayableConstructor__factory.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/ContractWithPayableConstructor__factory.ts deleted file mode 100644 index 1efbebc9..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/ContractWithPayableConstructor__factory.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { PayableOverrides } from "../../common"; -import type { - ContractWithPayableConstructor, - ContractWithPayableConstructorInterface, -} from "../../Contracts.sol/ContractWithPayableConstructor"; - -const _abi = [ - { - inputs: [], - stateMutability: "payable", - type: "constructor", - }, -] as const; - -const _bytecode = - "0x6080604052603f8060116000396000f3fe6080604052600080fdfea26469706673582212208f55b5c68e6835992b311d3c2bcfd3dfa3767dc43866ee1c95ec4943468ead0a64736f6c63430007030033"; - -type ContractWithPayableConstructorConstructorParams = - | [signer?: Signer] - | ConstructorParameters; - -const isSuperArgs = ( - xs: ContractWithPayableConstructorConstructorParams, -): xs is ConstructorParameters => xs.length > 1; - -export class ContractWithPayableConstructor__factory extends ContractFactory { - constructor(...args: ContractWithPayableConstructorConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override getDeployTransaction(overrides?: PayableOverrides & { from?: string }): Promise { - return super.getDeployTransaction(overrides || {}); - } - override deploy(overrides?: PayableOverrides & { from?: string }) { - return super.deploy(overrides || {}) as Promise< - ContractWithPayableConstructor & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): ContractWithPayableConstructor__factory { - return super.connect(runner) as ContractWithPayableConstructor__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): ContractWithPayableConstructorInterface { - return new Interface(_abi) as ContractWithPayableConstructorInterface; - } - static connect(address: string, runner?: ContractRunner | null): ContractWithPayableConstructor { - return new Contract(address, _abi, runner) as unknown as ContractWithPayableConstructor; - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/Library1__factory.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/Library1__factory.ts deleted file mode 100644 index 9d06dbe6..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/Library1__factory.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { NonPayableOverrides } from "../../common"; -import type { Library1, Library1Interface } from "../../Contracts.sol/Library1"; - -const _abi = [ - { - inputs: [], - name: "lib", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, -] as const; - -const _bytecode = - "0x6093610024600b82828239805160001a607314601757fe5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361060335760003560e01c806392801230146038575b600080fd5b603e6054565b6040518082815260200191505060405180910390f35b6000600190509056fea26469706673582212203e47a5b791b76105fd08cfba94579f50d47bc0630b28334a3eb62c9fd8dd6dbd64736f6c63430007030033"; - -type Library1ConstructorParams = [signer?: Signer] | ConstructorParameters; - -const isSuperArgs = (xs: Library1ConstructorParams): xs is ConstructorParameters => - xs.length > 1; - -export class Library1__factory extends ContractFactory { - constructor(...args: Library1ConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override getDeployTransaction( - overrides?: NonPayableOverrides & { from?: string }, - ): Promise { - return super.getDeployTransaction(overrides || {}); - } - override deploy(overrides?: NonPayableOverrides & { from?: string }) { - return super.deploy(overrides || {}) as Promise< - Library1 & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): Library1__factory { - return super.connect(runner) as Library1__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): Library1Interface { - return new Interface(_abi) as Library1Interface; - } - static connect(address: string, runner?: ContractRunner | null): Library1 { - return new Contract(address, _abi, runner) as unknown as Library1; - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/Library2__factory.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/Library2__factory.ts deleted file mode 100644 index 25b6b1ab..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/Library2__factory.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { NonPayableOverrides } from "../../common"; -import type { Library2, Library2Interface } from "../../Contracts.sol/Library2"; - -const _abi = [ - { - inputs: [], - name: "lib", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, -] as const; - -const _bytecode = - "0x6093610024600b82828239805160001a607314601757fe5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361060335760003560e01c806392801230146038575b600080fd5b603e6054565b6040518082815260200191505060405180910390f35b6000600290509056fea26469706673582212208113d4aa65b5894b50a8939595f43f1546915b5f9df1d9837defe0d87eee131164736f6c63430007030033"; - -type Library2ConstructorParams = [signer?: Signer] | ConstructorParameters; - -const isSuperArgs = (xs: Library2ConstructorParams): xs is ConstructorParameters => - xs.length > 1; - -export class Library2__factory extends ContractFactory { - constructor(...args: Library2ConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override getDeployTransaction( - overrides?: NonPayableOverrides & { from?: string }, - ): Promise { - return super.getDeployTransaction(overrides || {}); - } - override deploy(overrides?: NonPayableOverrides & { from?: string }) { - return super.deploy(overrides || {}) as Promise< - Library2 & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): Library2__factory { - return super.connect(runner) as Library2__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): Library2Interface { - return new Interface(_abi) as Library2Interface; - } - static connect(address: string, runner?: ContractRunner | null): Library2 { - return new Contract(address, _abi, runner) as unknown as Library2; - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/index.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/index.ts deleted file mode 100644 index 2098d616..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts.sol/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -export { ContractWithConstructorArguments__factory } from "./ContractWithConstructorArguments__factory"; -export { ContractWithExternalLibrary__factory } from "./ContractWithExternalLibrary__factory"; -export { ContractWithPayableConstructor__factory } from "./ContractWithPayableConstructor__factory"; -export { Library1__factory } from "./Library1__factory"; -export { Library2__factory } from "./Library2__factory"; diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/ContractWithConstructorArguments__factory.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/ContractWithConstructorArguments__factory.ts deleted file mode 100644 index 430978e6..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/ContractWithConstructorArguments__factory.ts +++ /dev/null @@ -1,84 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { NonPayableOverrides } from "../../common"; -import type { - ContractWithConstructorArguments, - ContractWithConstructorArgumentsInterface, -} from "../../Contracts2.sol/ContractWithConstructorArguments"; - -const _abi = [ - { - inputs: [ - { - internalType: "string", - name: "_name", - type: "string", - }, - ], - stateMutability: "nonpayable", - type: "constructor", - }, - { - inputs: [], - name: "name", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], - stateMutability: "view", - type: "function", - }, -] as const; - -const _bytecode = - "0x608060405234801561001057600080fd5b5060405161033e38038061033e8339818101604052602081101561003357600080fd5b810190808051604051939291908464010000000082111561005357600080fd5b8382019150602082018581111561006957600080fd5b825186600182028301116401000000008211171561008657600080fd5b8083526020830192505050908051906020019080838360005b838110156100ba57808201518184015260208101905061009f565b50505050905090810190601f1680156100e75780820380516001836020036101000a031916815260200191505b50604052505050806000908051906020019061010492919061010b565b50506101a8565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061014c57805160ff191683800117855561017a565b8280016001018555821561017a579182015b8281111561017957825182559160200191906001019061015e565b5b509050610187919061018b565b5090565b5b808211156101a457600081600090555060010161018c565b5090565b610187806101b76000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806306fdde0314610030575b600080fd5b6100386100b3565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561007857808201518184015260208101905061005d565b50505050905090810190601f1680156100a55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156101495780601f1061011e57610100808354040283529160200191610149565b820191906000526020600020905b81548152906001019060200180831161012c57829003601f168201915b50505050508156fea264697066735822122043650089dae63e88197e6423e1e3f22f3905158aa11174bf779d081ff49b2f0a64736f6c63430007030033"; - -type ContractWithConstructorArgumentsConstructorParams = - | [signer?: Signer] - | ConstructorParameters; - -const isSuperArgs = ( - xs: ContractWithConstructorArgumentsConstructorParams, -): xs is ConstructorParameters => xs.length > 1; - -export class ContractWithConstructorArguments__factory extends ContractFactory { - constructor(...args: ContractWithConstructorArgumentsConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override getDeployTransaction( - _name: string, - overrides?: NonPayableOverrides & { from?: string }, - ): Promise { - return super.getDeployTransaction(_name, overrides || {}); - } - override deploy(_name: string, overrides?: NonPayableOverrides & { from?: string }) { - return super.deploy(_name, overrides || {}) as Promise< - ContractWithConstructorArguments & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): ContractWithConstructorArguments__factory { - return super.connect(runner) as ContractWithConstructorArguments__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): ContractWithConstructorArgumentsInterface { - return new Interface(_abi) as ContractWithConstructorArgumentsInterface; - } - static connect(address: string, runner?: ContractRunner | null): ContractWithConstructorArguments { - return new Contract(address, _abi, runner) as unknown as ContractWithConstructorArguments; - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/ContractWithExternalLibrary__factory.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/ContractWithExternalLibrary__factory.ts deleted file mode 100644 index cb28d2b7..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/ContractWithExternalLibrary__factory.ts +++ /dev/null @@ -1,139 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { NonPayableOverrides } from "../../common"; -import type { - ContractWithExternalLibrary, - ContractWithExternalLibraryInterface, -} from "../../Contracts2.sol/ContractWithExternalLibrary"; - -const _abi = [ - { - inputs: [], - name: "lib", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "lib2", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "lib3", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "lib4", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, -] as const; - -const _bytecode = - "0x608060405234801561001057600080fd5b5061023b806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806336ecdf8f14610051578063928012301461006f578063eaebdc061461008d578063ff1a250f146100ab575b600080fd5b6100596100c9565b6040518082815260200191505060405180910390f35b6100776100d8565b6040518082815260200191505060405180910390f35b61009561015e565b6040518082815260200191505060405180910390f35b6100b361016d565b6040518082815260200191505060405180910390f35b60006100d36101f3565b905090565b600073__$a906529153dfeba76fe202641435e38fb7$__63928012306040518163ffffffff1660e01b815260040160206040518083038186803b15801561011e57600080fd5b505af4158015610132573d6000803e3d6000fd5b505050506040513d602081101561014857600080fd5b8101908080519060200190929190505050905090565b60006101686101fc565b905090565b600073__$0cc4a54cd6bedab4f61064290b8437f403$__63928012306040518163ffffffff1660e01b815260040160206040518083038186803b1580156101b357600080fd5b505af41580156101c7573d6000803e3d6000fd5b505050506040513d60208110156101dd57600080fd5b8101908080519060200190929190505050905090565b60006003905090565b6000600390509056fea2646970667358221220fe29bef684150821b27f7dd80014aa8c039e3ec1eed6c63999a22da6b04b4d6864736f6c63430007030033"; - -type ContractWithExternalLibraryConstructorParams = - | [linkLibraryAddresses: ContractWithExternalLibraryLibraryAddresses, signer?: Signer] - | ConstructorParameters; - -const isSuperArgs = ( - xs: ContractWithExternalLibraryConstructorParams, -): xs is ConstructorParameters => { - return ( - typeof xs[0] === "string" || - (Array.isArray as (arg: any) => arg is readonly any[])(xs[0]) || - "_isInterface" in xs[0] - ); -}; - -export class ContractWithExternalLibrary__factory extends ContractFactory { - constructor(...args: ContractWithExternalLibraryConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - const [linkLibraryAddresses, signer] = args; - super(_abi, ContractWithExternalLibrary__factory.linkBytecode(linkLibraryAddresses), signer); - } - } - - static linkBytecode(linkLibraryAddresses: ContractWithExternalLibraryLibraryAddresses): string { - let linkedBytecode = _bytecode; - - linkedBytecode = linkedBytecode.replace( - new RegExp("__\\$a906529153dfeba76fe202641435e38fb7\\$__", "g"), - linkLibraryAddresses["contracts/Contracts2.sol:Library1"].replace(/^0x/, "").toLowerCase(), - ); - - linkedBytecode = linkedBytecode.replace( - new RegExp("__\\$0cc4a54cd6bedab4f61064290b8437f403\\$__", "g"), - linkLibraryAddresses["contracts/Contracts2.sol:Library2"].replace(/^0x/, "").toLowerCase(), - ); - - return linkedBytecode; - } - - override getDeployTransaction( - overrides?: NonPayableOverrides & { from?: string }, - ): Promise { - return super.getDeployTransaction(overrides || {}); - } - override deploy(overrides?: NonPayableOverrides & { from?: string }) { - return super.deploy(overrides || {}) as Promise< - ContractWithExternalLibrary & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): ContractWithExternalLibrary__factory { - return super.connect(runner) as ContractWithExternalLibrary__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): ContractWithExternalLibraryInterface { - return new Interface(_abi) as ContractWithExternalLibraryInterface; - } - static connect(address: string, runner?: ContractRunner | null): ContractWithExternalLibrary { - return new Contract(address, _abi, runner) as unknown as ContractWithExternalLibrary; - } -} - -export interface ContractWithExternalLibraryLibraryAddresses { - ["contracts/Contracts2.sol:Library1"]: string; - ["contracts/Contracts2.sol:Library2"]: string; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/ContractWithPayableConstructor__factory.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/ContractWithPayableConstructor__factory.ts deleted file mode 100644 index 423b49c3..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/ContractWithPayableConstructor__factory.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { PayableOverrides } from "../../common"; -import type { - ContractWithPayableConstructor, - ContractWithPayableConstructorInterface, -} from "../../Contracts2.sol/ContractWithPayableConstructor"; - -const _abi = [ - { - inputs: [], - stateMutability: "payable", - type: "constructor", - }, -] as const; - -const _bytecode = - "0x6080604052603f8060116000396000f3fe6080604052600080fdfea2646970667358221220ab7f4bd67e3843210b51abfb3f06e946abbf31cc1c6613c7375c2bdfa219fdc764736f6c63430007030033"; - -type ContractWithPayableConstructorConstructorParams = - | [signer?: Signer] - | ConstructorParameters; - -const isSuperArgs = ( - xs: ContractWithPayableConstructorConstructorParams, -): xs is ConstructorParameters => xs.length > 1; - -export class ContractWithPayableConstructor__factory extends ContractFactory { - constructor(...args: ContractWithPayableConstructorConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override getDeployTransaction(overrides?: PayableOverrides & { from?: string }): Promise { - return super.getDeployTransaction(overrides || {}); - } - override deploy(overrides?: PayableOverrides & { from?: string }) { - return super.deploy(overrides || {}) as Promise< - ContractWithPayableConstructor & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): ContractWithPayableConstructor__factory { - return super.connect(runner) as ContractWithPayableConstructor__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): ContractWithPayableConstructorInterface { - return new Interface(_abi) as ContractWithPayableConstructorInterface; - } - static connect(address: string, runner?: ContractRunner | null): ContractWithPayableConstructor { - return new Contract(address, _abi, runner) as unknown as ContractWithPayableConstructor; - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/Library1__factory.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/Library1__factory.ts deleted file mode 100644 index 2e891a09..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/Library1__factory.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { NonPayableOverrides } from "../../common"; -import type { Library1, Library1Interface } from "../../Contracts2.sol/Library1"; - -const _abi = [ - { - inputs: [], - name: "lib", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, -] as const; - -const _bytecode = - "0x6093610024600b82828239805160001a607314601757fe5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361060335760003560e01c806392801230146038575b600080fd5b603e6054565b6040518082815260200191505060405180910390f35b6000600190509056fea264697066735822122003b115e75cf592450f0afcd802789bd090ec00f93ab3d27a3784e04c6d4fcce364736f6c63430007030033"; - -type Library1ConstructorParams = [signer?: Signer] | ConstructorParameters; - -const isSuperArgs = (xs: Library1ConstructorParams): xs is ConstructorParameters => - xs.length > 1; - -export class Library1__factory extends ContractFactory { - constructor(...args: Library1ConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override getDeployTransaction( - overrides?: NonPayableOverrides & { from?: string }, - ): Promise { - return super.getDeployTransaction(overrides || {}); - } - override deploy(overrides?: NonPayableOverrides & { from?: string }) { - return super.deploy(overrides || {}) as Promise< - Library1 & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): Library1__factory { - return super.connect(runner) as Library1__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): Library1Interface { - return new Interface(_abi) as Library1Interface; - } - static connect(address: string, runner?: ContractRunner | null): Library1 { - return new Contract(address, _abi, runner) as unknown as Library1; - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/Library2__factory.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/Library2__factory.ts deleted file mode 100644 index 5ae39e4f..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/Library2__factory.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { NonPayableOverrides } from "../../common"; -import type { Library2, Library2Interface } from "../../Contracts2.sol/Library2"; - -const _abi = [ - { - inputs: [], - name: "lib", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, -] as const; - -const _bytecode = - "0x6093610024600b82828239805160001a607314601757fe5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361060335760003560e01c806392801230146038575b600080fd5b603e6054565b6040518082815260200191505060405180910390f35b6000600290509056fea264697066735822122041f35c65b881c677fd90ed77302c38129391f430df5d27036cc5e93058bf841164736f6c63430007030033"; - -type Library2ConstructorParams = [signer?: Signer] | ConstructorParameters; - -const isSuperArgs = (xs: Library2ConstructorParams): xs is ConstructorParameters => - xs.length > 1; - -export class Library2__factory extends ContractFactory { - constructor(...args: Library2ConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override getDeployTransaction( - overrides?: NonPayableOverrides & { from?: string }, - ): Promise { - return super.getDeployTransaction(overrides || {}); - } - override deploy(overrides?: NonPayableOverrides & { from?: string }) { - return super.deploy(overrides || {}) as Promise< - Library2 & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): Library2__factory { - return super.connect(runner) as Library2__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): Library2Interface { - return new Interface(_abi) as Library2Interface; - } - static connect(address: string, runner?: ContractRunner | null): Library2 { - return new Contract(address, _abi, runner) as unknown as Library2; - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/index.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/index.ts deleted file mode 100644 index 2098d616..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/Contracts2.sol/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -export { ContractWithConstructorArguments__factory } from "./ContractWithConstructorArguments__factory"; -export { ContractWithExternalLibrary__factory } from "./ContractWithExternalLibrary__factory"; -export { ContractWithPayableConstructor__factory } from "./ContractWithPayableConstructor__factory"; -export { Library1__factory } from "./Library1__factory"; -export { Library2__factory } from "./Library2__factory"; diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/ContractWithConstructorArguments__factory.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/ContractWithConstructorArguments__factory.ts deleted file mode 100644 index 4bf85ea5..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/ContractWithConstructorArguments__factory.ts +++ /dev/null @@ -1,84 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { NonPayableOverrides } from "../../../common"; -import type { - ContractWithConstructorArguments, - ContractWithConstructorArgumentsInterface, -} from "../../../another-contracts/Contracts.sol/ContractWithConstructorArguments"; - -const _abi = [ - { - inputs: [ - { - internalType: "string", - name: "_name", - type: "string", - }, - ], - stateMutability: "nonpayable", - type: "constructor", - }, - { - inputs: [], - name: "name", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], - stateMutability: "view", - type: "function", - }, -] as const; - -const _bytecode = - "0x608060405234801561001057600080fd5b5060405161033e38038061033e8339818101604052602081101561003357600080fd5b810190808051604051939291908464010000000082111561005357600080fd5b8382019150602082018581111561006957600080fd5b825186600182028301116401000000008211171561008657600080fd5b8083526020830192505050908051906020019080838360005b838110156100ba57808201518184015260208101905061009f565b50505050905090810190601f1680156100e75780820380516001836020036101000a031916815260200191505b50604052505050806000908051906020019061010492919061010b565b50506101a8565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061014c57805160ff191683800117855561017a565b8280016001018555821561017a579182015b8281111561017957825182559160200191906001019061015e565b5b509050610187919061018b565b5090565b5b808211156101a457600081600090555060010161018c565b5090565b610187806101b76000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806306fdde0314610030575b600080fd5b6100386100b3565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561007857808201518184015260208101905061005d565b50505050905090810190601f1680156100a55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156101495780601f1061011e57610100808354040283529160200191610149565b820191906000526020600020905b81548152906001019060200180831161012c57829003601f168201915b50505050508156fea264697066735822122019180c3d5445c33e3071a17222ba61b982519546527159c8c8aa42c4eac56fa064736f6c63430007030033"; - -type ContractWithConstructorArgumentsConstructorParams = - | [signer?: Signer] - | ConstructorParameters; - -const isSuperArgs = ( - xs: ContractWithConstructorArgumentsConstructorParams, -): xs is ConstructorParameters => xs.length > 1; - -export class ContractWithConstructorArguments__factory extends ContractFactory { - constructor(...args: ContractWithConstructorArgumentsConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override getDeployTransaction( - _name: string, - overrides?: NonPayableOverrides & { from?: string }, - ): Promise { - return super.getDeployTransaction(_name, overrides || {}); - } - override deploy(_name: string, overrides?: NonPayableOverrides & { from?: string }) { - return super.deploy(_name, overrides || {}) as Promise< - ContractWithConstructorArguments & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): ContractWithConstructorArguments__factory { - return super.connect(runner) as ContractWithConstructorArguments__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): ContractWithConstructorArgumentsInterface { - return new Interface(_abi) as ContractWithConstructorArgumentsInterface; - } - static connect(address: string, runner?: ContractRunner | null): ContractWithConstructorArguments { - return new Contract(address, _abi, runner) as unknown as ContractWithConstructorArguments; - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/ContractWithExternalLibrary__factory.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/ContractWithExternalLibrary__factory.ts deleted file mode 100644 index 34b16849..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/ContractWithExternalLibrary__factory.ts +++ /dev/null @@ -1,139 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { NonPayableOverrides } from "../../../common"; -import type { - ContractWithExternalLibrary, - ContractWithExternalLibraryInterface, -} from "../../../another-contracts/Contracts.sol/ContractWithExternalLibrary"; - -const _abi = [ - { - inputs: [], - name: "lib", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "lib2", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "lib3", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "lib4", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, -] as const; - -const _bytecode = - "0x608060405234801561001057600080fd5b5061023b806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806336ecdf8f14610051578063928012301461006f578063eaebdc061461008d578063ff1a250f146100ab575b600080fd5b6100596100c9565b6040518082815260200191505060405180910390f35b6100776100d8565b6040518082815260200191505060405180910390f35b61009561015e565b6040518082815260200191505060405180910390f35b6100b361016d565b6040518082815260200191505060405180910390f35b60006100d36101f3565b905090565b600073__$4f4a1a52d68fd29d084915451a8fd9f94d$__63928012306040518163ffffffff1660e01b815260040160206040518083038186803b15801561011e57600080fd5b505af4158015610132573d6000803e3d6000fd5b505050506040513d602081101561014857600080fd5b8101908080519060200190929190505050905090565b60006101686101fc565b905090565b600073__$123102ab136e0cfda492cd00ec8aa49bf7$__63928012306040518163ffffffff1660e01b815260040160206040518083038186803b1580156101b357600080fd5b505af41580156101c7573d6000803e3d6000fd5b505050506040513d60208110156101dd57600080fd5b8101908080519060200190929190505050905090565b60006003905090565b6000600390509056fea2646970667358221220f456913c9c8a9336de94ba7ece2b84c452caef3818093d551efbca2be3bac70e64736f6c63430007030033"; - -type ContractWithExternalLibraryConstructorParams = - | [linkLibraryAddresses: ContractWithExternalLibraryLibraryAddresses, signer?: Signer] - | ConstructorParameters; - -const isSuperArgs = ( - xs: ContractWithExternalLibraryConstructorParams, -): xs is ConstructorParameters => { - return ( - typeof xs[0] === "string" || - (Array.isArray as (arg: any) => arg is readonly any[])(xs[0]) || - "_isInterface" in xs[0] - ); -}; - -export class ContractWithExternalLibrary__factory extends ContractFactory { - constructor(...args: ContractWithExternalLibraryConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - const [linkLibraryAddresses, signer] = args; - super(_abi, ContractWithExternalLibrary__factory.linkBytecode(linkLibraryAddresses), signer); - } - } - - static linkBytecode(linkLibraryAddresses: ContractWithExternalLibraryLibraryAddresses): string { - let linkedBytecode = _bytecode; - - linkedBytecode = linkedBytecode.replace( - new RegExp("__\\$4f4a1a52d68fd29d084915451a8fd9f94d\\$__", "g"), - linkLibraryAddresses["contracts/another-contracts/Contracts.sol:Library1"].replace(/^0x/, "").toLowerCase(), - ); - - linkedBytecode = linkedBytecode.replace( - new RegExp("__\\$123102ab136e0cfda492cd00ec8aa49bf7\\$__", "g"), - linkLibraryAddresses["contracts/another-contracts/Contracts.sol:Library2"].replace(/^0x/, "").toLowerCase(), - ); - - return linkedBytecode; - } - - override getDeployTransaction( - overrides?: NonPayableOverrides & { from?: string }, - ): Promise { - return super.getDeployTransaction(overrides || {}); - } - override deploy(overrides?: NonPayableOverrides & { from?: string }) { - return super.deploy(overrides || {}) as Promise< - ContractWithExternalLibrary & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): ContractWithExternalLibrary__factory { - return super.connect(runner) as ContractWithExternalLibrary__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): ContractWithExternalLibraryInterface { - return new Interface(_abi) as ContractWithExternalLibraryInterface; - } - static connect(address: string, runner?: ContractRunner | null): ContractWithExternalLibrary { - return new Contract(address, _abi, runner) as unknown as ContractWithExternalLibrary; - } -} - -export interface ContractWithExternalLibraryLibraryAddresses { - ["contracts/another-contracts/Contracts.sol:Library1"]: string; - ["contracts/another-contracts/Contracts.sol:Library2"]: string; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/ContractWithPayableConstructor__factory.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/ContractWithPayableConstructor__factory.ts deleted file mode 100644 index b2ec44df..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/ContractWithPayableConstructor__factory.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { PayableOverrides } from "../../../common"; -import type { - ContractWithPayableConstructor, - ContractWithPayableConstructorInterface, -} from "../../../another-contracts/Contracts.sol/ContractWithPayableConstructor"; - -const _abi = [ - { - inputs: [], - stateMutability: "payable", - type: "constructor", - }, -] as const; - -const _bytecode = - "0x6080604052603f8060116000396000f3fe6080604052600080fdfea2646970667358221220bbbfcab006f8201851fa8e1a57d43ac463d8946c5796681c3fa7698fc87a397f64736f6c63430007030033"; - -type ContractWithPayableConstructorConstructorParams = - | [signer?: Signer] - | ConstructorParameters; - -const isSuperArgs = ( - xs: ContractWithPayableConstructorConstructorParams, -): xs is ConstructorParameters => xs.length > 1; - -export class ContractWithPayableConstructor__factory extends ContractFactory { - constructor(...args: ContractWithPayableConstructorConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override getDeployTransaction(overrides?: PayableOverrides & { from?: string }): Promise { - return super.getDeployTransaction(overrides || {}); - } - override deploy(overrides?: PayableOverrides & { from?: string }) { - return super.deploy(overrides || {}) as Promise< - ContractWithPayableConstructor & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): ContractWithPayableConstructor__factory { - return super.connect(runner) as ContractWithPayableConstructor__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): ContractWithPayableConstructorInterface { - return new Interface(_abi) as ContractWithPayableConstructorInterface; - } - static connect(address: string, runner?: ContractRunner | null): ContractWithPayableConstructor { - return new Contract(address, _abi, runner) as unknown as ContractWithPayableConstructor; - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/Library1__factory.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/Library1__factory.ts deleted file mode 100644 index 62ed1f6a..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/Library1__factory.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { NonPayableOverrides } from "../../../common"; -import type { Library1, Library1Interface } from "../../../another-contracts/Contracts.sol/Library1"; - -const _abi = [ - { - inputs: [], - name: "lib", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, -] as const; - -const _bytecode = - "0x6093610024600b82828239805160001a607314601757fe5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361060335760003560e01c806392801230146038575b600080fd5b603e6054565b6040518082815260200191505060405180910390f35b6000600190509056fea2646970667358221220fed7e9db83644d85dcdb6ca8f25341cb931ee0dbc6c61349038fb492377f14ca64736f6c63430007030033"; - -type Library1ConstructorParams = [signer?: Signer] | ConstructorParameters; - -const isSuperArgs = (xs: Library1ConstructorParams): xs is ConstructorParameters => - xs.length > 1; - -export class Library1__factory extends ContractFactory { - constructor(...args: Library1ConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override getDeployTransaction( - overrides?: NonPayableOverrides & { from?: string }, - ): Promise { - return super.getDeployTransaction(overrides || {}); - } - override deploy(overrides?: NonPayableOverrides & { from?: string }) { - return super.deploy(overrides || {}) as Promise< - Library1 & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): Library1__factory { - return super.connect(runner) as Library1__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): Library1Interface { - return new Interface(_abi) as Library1Interface; - } - static connect(address: string, runner?: ContractRunner | null): Library1 { - return new Contract(address, _abi, runner) as unknown as Library1; - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/Library2__factory.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/Library2__factory.ts deleted file mode 100644 index 3b89d327..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/Library2__factory.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { NonPayableOverrides } from "../../../common"; -import type { Library2, Library2Interface } from "../../../another-contracts/Contracts.sol/Library2"; - -const _abi = [ - { - inputs: [], - name: "lib", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, -] as const; - -const _bytecode = - "0x6093610024600b82828239805160001a607314601757fe5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361060335760003560e01c806392801230146038575b600080fd5b603e6054565b6040518082815260200191505060405180910390f35b6000600290509056fea2646970667358221220558d054a43dcc128cb1068247388d9fb281fdad2cd91180dc9ecd0a97b9fdb3e64736f6c63430007030033"; - -type Library2ConstructorParams = [signer?: Signer] | ConstructorParameters; - -const isSuperArgs = (xs: Library2ConstructorParams): xs is ConstructorParameters => - xs.length > 1; - -export class Library2__factory extends ContractFactory { - constructor(...args: Library2ConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override getDeployTransaction( - overrides?: NonPayableOverrides & { from?: string }, - ): Promise { - return super.getDeployTransaction(overrides || {}); - } - override deploy(overrides?: NonPayableOverrides & { from?: string }) { - return super.deploy(overrides || {}) as Promise< - Library2 & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): Library2__factory { - return super.connect(runner) as Library2__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): Library2Interface { - return new Interface(_abi) as Library2Interface; - } - static connect(address: string, runner?: ContractRunner | null): Library2 { - return new Contract(address, _abi, runner) as unknown as Library2; - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/index.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/index.ts deleted file mode 100644 index 2098d616..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts.sol/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -export { ContractWithConstructorArguments__factory } from "./ContractWithConstructorArguments__factory"; -export { ContractWithExternalLibrary__factory } from "./ContractWithExternalLibrary__factory"; -export { ContractWithPayableConstructor__factory } from "./ContractWithPayableConstructor__factory"; -export { Library1__factory } from "./Library1__factory"; -export { Library2__factory } from "./Library2__factory"; diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/ContractWithConstructorArguments__factory.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/ContractWithConstructorArguments__factory.ts deleted file mode 100644 index 20211919..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/ContractWithConstructorArguments__factory.ts +++ /dev/null @@ -1,84 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { NonPayableOverrides } from "../../../common"; -import type { - ContractWithConstructorArguments, - ContractWithConstructorArgumentsInterface, -} from "../../../another-contracts/Contracts2.sol/ContractWithConstructorArguments"; - -const _abi = [ - { - inputs: [ - { - internalType: "string", - name: "_name", - type: "string", - }, - ], - stateMutability: "nonpayable", - type: "constructor", - }, - { - inputs: [], - name: "name", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], - stateMutability: "view", - type: "function", - }, -] as const; - -const _bytecode = - "0x608060405234801561001057600080fd5b5060405161033e38038061033e8339818101604052602081101561003357600080fd5b810190808051604051939291908464010000000082111561005357600080fd5b8382019150602082018581111561006957600080fd5b825186600182028301116401000000008211171561008657600080fd5b8083526020830192505050908051906020019080838360005b838110156100ba57808201518184015260208101905061009f565b50505050905090810190601f1680156100e75780820380516001836020036101000a031916815260200191505b50604052505050806000908051906020019061010492919061010b565b50506101a8565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061014c57805160ff191683800117855561017a565b8280016001018555821561017a579182015b8281111561017957825182559160200191906001019061015e565b5b509050610187919061018b565b5090565b5b808211156101a457600081600090555060010161018c565b5090565b610187806101b76000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806306fdde0314610030575b600080fd5b6100386100b3565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561007857808201518184015260208101905061005d565b50505050905090810190601f1680156100a55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156101495780601f1061011e57610100808354040283529160200191610149565b820191906000526020600020905b81548152906001019060200180831161012c57829003601f168201915b50505050508156fea264697066735822122001e061d2ae2b6e71857277a754758e8936777088525512e87d0b284bde3998d864736f6c63430007030033"; - -type ContractWithConstructorArgumentsConstructorParams = - | [signer?: Signer] - | ConstructorParameters; - -const isSuperArgs = ( - xs: ContractWithConstructorArgumentsConstructorParams, -): xs is ConstructorParameters => xs.length > 1; - -export class ContractWithConstructorArguments__factory extends ContractFactory { - constructor(...args: ContractWithConstructorArgumentsConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override getDeployTransaction( - _name: string, - overrides?: NonPayableOverrides & { from?: string }, - ): Promise { - return super.getDeployTransaction(_name, overrides || {}); - } - override deploy(_name: string, overrides?: NonPayableOverrides & { from?: string }) { - return super.deploy(_name, overrides || {}) as Promise< - ContractWithConstructorArguments & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): ContractWithConstructorArguments__factory { - return super.connect(runner) as ContractWithConstructorArguments__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): ContractWithConstructorArgumentsInterface { - return new Interface(_abi) as ContractWithConstructorArgumentsInterface; - } - static connect(address: string, runner?: ContractRunner | null): ContractWithConstructorArguments { - return new Contract(address, _abi, runner) as unknown as ContractWithConstructorArguments; - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/ContractWithExternalLibrary__factory.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/ContractWithExternalLibrary__factory.ts deleted file mode 100644 index 82950b0f..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/ContractWithExternalLibrary__factory.ts +++ /dev/null @@ -1,139 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { NonPayableOverrides } from "../../../common"; -import type { - ContractWithExternalLibrary, - ContractWithExternalLibraryInterface, -} from "../../../another-contracts/Contracts2.sol/ContractWithExternalLibrary"; - -const _abi = [ - { - inputs: [], - name: "lib", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "lib2", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "lib3", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "lib4", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, -] as const; - -const _bytecode = - "0x608060405234801561001057600080fd5b5061023b806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806336ecdf8f14610051578063928012301461006f578063eaebdc061461008d578063ff1a250f146100ab575b600080fd5b6100596100c9565b6040518082815260200191505060405180910390f35b6100776100d8565b6040518082815260200191505060405180910390f35b61009561015e565b6040518082815260200191505060405180910390f35b6100b361016d565b6040518082815260200191505060405180910390f35b60006100d36101f3565b905090565b600073__$caaab64972b707f3c433555dfa9c2b28a9$__63928012306040518163ffffffff1660e01b815260040160206040518083038186803b15801561011e57600080fd5b505af4158015610132573d6000803e3d6000fd5b505050506040513d602081101561014857600080fd5b8101908080519060200190929190505050905090565b60006101686101fc565b905090565b600073__$43892e6beba35e250f17c53d3e3a00fafd$__63928012306040518163ffffffff1660e01b815260040160206040518083038186803b1580156101b357600080fd5b505af41580156101c7573d6000803e3d6000fd5b505050506040513d60208110156101dd57600080fd5b8101908080519060200190929190505050905090565b60006003905090565b6000600390509056fea2646970667358221220bbcc9fc782641ed244e15a0ef75d253538968924676e816c679f75bbacaeb66264736f6c63430007030033"; - -type ContractWithExternalLibraryConstructorParams = - | [linkLibraryAddresses: ContractWithExternalLibraryLibraryAddresses, signer?: Signer] - | ConstructorParameters; - -const isSuperArgs = ( - xs: ContractWithExternalLibraryConstructorParams, -): xs is ConstructorParameters => { - return ( - typeof xs[0] === "string" || - (Array.isArray as (arg: any) => arg is readonly any[])(xs[0]) || - "_isInterface" in xs[0] - ); -}; - -export class ContractWithExternalLibrary__factory extends ContractFactory { - constructor(...args: ContractWithExternalLibraryConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - const [linkLibraryAddresses, signer] = args; - super(_abi, ContractWithExternalLibrary__factory.linkBytecode(linkLibraryAddresses), signer); - } - } - - static linkBytecode(linkLibraryAddresses: ContractWithExternalLibraryLibraryAddresses): string { - let linkedBytecode = _bytecode; - - linkedBytecode = linkedBytecode.replace( - new RegExp("__\\$caaab64972b707f3c433555dfa9c2b28a9\\$__", "g"), - linkLibraryAddresses["contracts/another-contracts/Contracts2.sol:Library1"].replace(/^0x/, "").toLowerCase(), - ); - - linkedBytecode = linkedBytecode.replace( - new RegExp("__\\$43892e6beba35e250f17c53d3e3a00fafd\\$__", "g"), - linkLibraryAddresses["contracts/another-contracts/Contracts2.sol:Library2"].replace(/^0x/, "").toLowerCase(), - ); - - return linkedBytecode; - } - - override getDeployTransaction( - overrides?: NonPayableOverrides & { from?: string }, - ): Promise { - return super.getDeployTransaction(overrides || {}); - } - override deploy(overrides?: NonPayableOverrides & { from?: string }) { - return super.deploy(overrides || {}) as Promise< - ContractWithExternalLibrary & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): ContractWithExternalLibrary__factory { - return super.connect(runner) as ContractWithExternalLibrary__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): ContractWithExternalLibraryInterface { - return new Interface(_abi) as ContractWithExternalLibraryInterface; - } - static connect(address: string, runner?: ContractRunner | null): ContractWithExternalLibrary { - return new Contract(address, _abi, runner) as unknown as ContractWithExternalLibrary; - } -} - -export interface ContractWithExternalLibraryLibraryAddresses { - ["contracts/another-contracts/Contracts2.sol:Library1"]: string; - ["contracts/another-contracts/Contracts2.sol:Library2"]: string; -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/ContractWithPayableConstructor__factory.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/ContractWithPayableConstructor__factory.ts deleted file mode 100644 index 9abcc19f..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/ContractWithPayableConstructor__factory.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { PayableOverrides } from "../../../common"; -import type { - ContractWithPayableConstructor, - ContractWithPayableConstructorInterface, -} from "../../../another-contracts/Contracts2.sol/ContractWithPayableConstructor"; - -const _abi = [ - { - inputs: [], - stateMutability: "payable", - type: "constructor", - }, -] as const; - -const _bytecode = - "0x6080604052603f8060116000396000f3fe6080604052600080fdfea264697066735822122040a78f9655359b7032e467a618d8b92ddf7730b94b5a921815cc7cf26c67e52864736f6c63430007030033"; - -type ContractWithPayableConstructorConstructorParams = - | [signer?: Signer] - | ConstructorParameters; - -const isSuperArgs = ( - xs: ContractWithPayableConstructorConstructorParams, -): xs is ConstructorParameters => xs.length > 1; - -export class ContractWithPayableConstructor__factory extends ContractFactory { - constructor(...args: ContractWithPayableConstructorConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override getDeployTransaction(overrides?: PayableOverrides & { from?: string }): Promise { - return super.getDeployTransaction(overrides || {}); - } - override deploy(overrides?: PayableOverrides & { from?: string }) { - return super.deploy(overrides || {}) as Promise< - ContractWithPayableConstructor & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): ContractWithPayableConstructor__factory { - return super.connect(runner) as ContractWithPayableConstructor__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): ContractWithPayableConstructorInterface { - return new Interface(_abi) as ContractWithPayableConstructorInterface; - } - static connect(address: string, runner?: ContractRunner | null): ContractWithPayableConstructor { - return new Contract(address, _abi, runner) as unknown as ContractWithPayableConstructor; - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/Library1__factory.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/Library1__factory.ts deleted file mode 100644 index ef83d3c6..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/Library1__factory.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { NonPayableOverrides } from "../../../common"; -import type { Library1, Library1Interface } from "../../../another-contracts/Contracts2.sol/Library1"; - -const _abi = [ - { - inputs: [], - name: "lib", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, -] as const; - -const _bytecode = - "0x6093610024600b82828239805160001a607314601757fe5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361060335760003560e01c806392801230146038575b600080fd5b603e6054565b6040518082815260200191505060405180910390f35b6000600190509056fea2646970667358221220f47ebb52a111d853f1acde0cdab244db1fdb847a8b9f5581504b965530e4945864736f6c63430007030033"; - -type Library1ConstructorParams = [signer?: Signer] | ConstructorParameters; - -const isSuperArgs = (xs: Library1ConstructorParams): xs is ConstructorParameters => - xs.length > 1; - -export class Library1__factory extends ContractFactory { - constructor(...args: Library1ConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override getDeployTransaction( - overrides?: NonPayableOverrides & { from?: string }, - ): Promise { - return super.getDeployTransaction(overrides || {}); - } - override deploy(overrides?: NonPayableOverrides & { from?: string }) { - return super.deploy(overrides || {}) as Promise< - Library1 & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): Library1__factory { - return super.connect(runner) as Library1__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): Library1Interface { - return new Interface(_abi) as Library1Interface; - } - static connect(address: string, runner?: ContractRunner | null): Library1 { - return new Contract(address, _abi, runner) as unknown as Library1; - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/Library2__factory.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/Library2__factory.ts deleted file mode 100644 index 4a94b861..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/Library2__factory.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Contract, ContractFactory, ContractTransactionResponse, Interface } from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { NonPayableOverrides } from "../../../common"; -import type { Library2, Library2Interface } from "../../../another-contracts/Contracts2.sol/Library2"; - -const _abi = [ - { - inputs: [], - name: "lib", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, -] as const; - -const _bytecode = - "0x6093610024600b82828239805160001a607314601757fe5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361060335760003560e01c806392801230146038575b600080fd5b603e6054565b6040518082815260200191505060405180910390f35b6000600290509056fea2646970667358221220109c31ac2b57a0e9cdf7024c1b6b78a3aa459e2765f48ad7faf6ed3fdd9acb9f64736f6c63430007030033"; - -type Library2ConstructorParams = [signer?: Signer] | ConstructorParameters; - -const isSuperArgs = (xs: Library2ConstructorParams): xs is ConstructorParameters => - xs.length > 1; - -export class Library2__factory extends ContractFactory { - constructor(...args: Library2ConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override getDeployTransaction( - overrides?: NonPayableOverrides & { from?: string }, - ): Promise { - return super.getDeployTransaction(overrides || {}); - } - override deploy(overrides?: NonPayableOverrides & { from?: string }) { - return super.deploy(overrides || {}) as Promise< - Library2 & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): Library2__factory { - return super.connect(runner) as Library2__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): Library2Interface { - return new Interface(_abi) as Library2Interface; - } - static connect(address: string, runner?: ContractRunner | null): Library2 { - return new Contract(address, _abi, runner) as unknown as Library2; - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/index.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/index.ts deleted file mode 100644 index 2098d616..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/Contracts2.sol/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -export { ContractWithConstructorArguments__factory } from "./ContractWithConstructorArguments__factory"; -export { ContractWithExternalLibrary__factory } from "./ContractWithExternalLibrary__factory"; -export { ContractWithPayableConstructor__factory } from "./ContractWithPayableConstructor__factory"; -export { Library1__factory } from "./Library1__factory"; -export { Library2__factory } from "./Library2__factory"; diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/index.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/index.ts deleted file mode 100644 index 1303c4ea..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/another-contracts/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -export * as contractsSol from "./Contracts.sol"; -export * as contracts2Sol from "./Contracts2.sol"; diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/index.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/index.ts deleted file mode 100644 index d4687748..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/factories/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -export * as contractsSol from "./Contracts.sol"; -export * as contracts2Sol from "./Contracts2.sol"; -export * as anotherContracts from "./another-contracts"; diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/hardhat.d.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/hardhat.d.ts deleted file mode 100644 index 21c1e8a0..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/hardhat.d.ts +++ /dev/null @@ -1,395 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ - -import { ethers } from "ethers"; -import { - DeployContractOptions, - FactoryOptions, - HardhatEthersHelpers as HardhatEthersHelpersBase, -} from "@nomicfoundation/hardhat-ethers/types"; - -import * as Contracts from "."; - -declare module "hardhat/types/runtime" { - interface HardhatEthersHelpers extends HardhatEthersHelpersBase { - getContractFactory( - name: "ContractWithConstructorArguments", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - getContractFactory( - name: "ContractWithExternalLibrary", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - getContractFactory( - name: "ContractWithPayableConstructor", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - getContractFactory( - name: "Library1", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - getContractFactory( - name: "Library2", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - getContractFactory( - name: "ContractWithConstructorArguments", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - getContractFactory( - name: "ContractWithExternalLibrary", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - getContractFactory( - name: "ContractWithPayableConstructor", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - getContractFactory( - name: "Library1", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - getContractFactory( - name: "Library2", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - getContractFactory( - name: "ContractWithConstructorArguments", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - getContractFactory( - name: "ContractWithExternalLibrary", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - getContractFactory( - name: "ContractWithPayableConstructor", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - getContractFactory( - name: "Library1", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - getContractFactory( - name: "Library2", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - getContractFactory( - name: "ContractWithConstructorArguments", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - getContractFactory( - name: "ContractWithExternalLibrary", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - getContractFactory( - name: "ContractWithPayableConstructor", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - getContractFactory( - name: "Library1", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - getContractFactory( - name: "Library2", - signerOrOptions?: ethers.Signer | FactoryOptions, - ): Promise; - - getContractAt( - name: "ContractWithConstructorArguments", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - getContractAt( - name: "ContractWithExternalLibrary", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - getContractAt( - name: "ContractWithPayableConstructor", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - getContractAt( - name: "Library1", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - getContractAt( - name: "Library2", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - getContractAt( - name: "ContractWithConstructorArguments", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - getContractAt( - name: "ContractWithExternalLibrary", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - getContractAt( - name: "ContractWithPayableConstructor", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - getContractAt( - name: "Library1", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - getContractAt( - name: "Library2", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - getContractAt( - name: "ContractWithConstructorArguments", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - getContractAt( - name: "ContractWithExternalLibrary", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - getContractAt( - name: "ContractWithPayableConstructor", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - getContractAt( - name: "Library1", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - getContractAt( - name: "Library2", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - getContractAt( - name: "ContractWithConstructorArguments", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - getContractAt( - name: "ContractWithExternalLibrary", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - getContractAt( - name: "ContractWithPayableConstructor", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - getContractAt( - name: "Library1", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - getContractAt( - name: "Library2", - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - - deployContract( - name: "ContractWithConstructorArguments", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithExternalLibrary", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithPayableConstructor", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "Library1", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "Library2", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithConstructorArguments", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithExternalLibrary", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithPayableConstructor", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "Library1", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "Library2", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithConstructorArguments", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithExternalLibrary", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithPayableConstructor", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "Library1", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "Library2", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithConstructorArguments", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithExternalLibrary", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithPayableConstructor", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "Library1", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "Library2", - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - - deployContract( - name: "ContractWithConstructorArguments", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithExternalLibrary", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithPayableConstructor", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "Library1", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "Library2", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithConstructorArguments", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithExternalLibrary", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithPayableConstructor", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "Library1", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "Library2", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithConstructorArguments", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithExternalLibrary", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithPayableConstructor", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "Library1", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "Library2", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithConstructorArguments", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithExternalLibrary", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "ContractWithPayableConstructor", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "Library1", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - deployContract( - name: "Library2", - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - - // default types - getContractFactory(name: string, signerOrOptions?: ethers.Signer | FactoryOptions): Promise; - getContractFactory(abi: any[], bytecode: ethers.BytesLike, signer?: ethers.Signer): Promise; - getContractAt( - nameOrAbi: string | any[], - address: string | ethers.Addressable, - signer?: ethers.Signer, - ): Promise; - deployContract(name: string, signerOrOptions?: ethers.Signer | DeployContractOptions): Promise; - deployContract( - name: string, - args: any[], - signerOrOptions?: ethers.Signer | DeployContractOptions, - ): Promise; - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/index.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/index.ts deleted file mode 100644 index 761e35d3..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type * as contractsSol from "./Contracts.sol"; -export type { contractsSol }; -import type * as contracts2Sol from "./Contracts2.sol"; -export type { contracts2Sol }; -import type * as anotherContracts from "./another-contracts"; -export type { anotherContracts }; -export * as factories from "./factories"; -export type { ContractWithConstructorArguments } from "./another-contracts/Contracts.sol/ContractWithConstructorArguments"; -export { ContractWithConstructorArguments__factory } from "./factories/another-contracts/Contracts.sol/ContractWithConstructorArguments__factory"; -export type { ContractWithExternalLibrary } from "./another-contracts/Contracts.sol/ContractWithExternalLibrary"; -export { ContractWithExternalLibrary__factory } from "./factories/another-contracts/Contracts.sol/ContractWithExternalLibrary__factory"; -export type { ContractWithPayableConstructor } from "./another-contracts/Contracts.sol/ContractWithPayableConstructor"; -export { ContractWithPayableConstructor__factory } from "./factories/another-contracts/Contracts.sol/ContractWithPayableConstructor__factory"; -export type { Library1 } from "./another-contracts/Contracts.sol/Library1"; -export { Library1__factory } from "./factories/another-contracts/Contracts.sol/Library1__factory"; -export type { Library2 } from "./another-contracts/Contracts.sol/Library2"; -export { Library2__factory } from "./factories/another-contracts/Contracts.sol/Library2__factory"; From b00b5848923d870bcc803267b98a57dbae8cb858 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Tue, 19 Dec 2023 12:35:57 +0200 Subject: [PATCH 09/34] Migrated test fixture projects to TypeScript with updated configurations and scripts. --- CHANGELOG.md | 1 + package.json | 2 ++ .../{hardhat.config.js => hardhat.config.ts} | 11 +++++++++-- .../package.json | 8 ++++++++ .../hardhat.config.js | 7 ------- .../hardhat.config.ts | 14 ++++++++++++++ .../package.json | 8 ++++++++ .../hardhat.config.ts | 3 +++ .../package.json | 8 ++++++++ .../deploy/1_deploy.ts | 13 +++++++++++++ .../hardhat.config.ts | 11 +++++++++++ .../package.json | 8 ++++++++ .../deploy/1_deploy.ts | 13 +++++++++++++ .../hardhat.config.js | 5 ----- .../hardhat.config.ts | 17 +++++++++++++++++ .../package.json | 8 ++++++++ .../.gitignore | 1 + .../hardhat.config.js | 10 ---------- .../hardhat.config.ts | 19 +++++++++++++++++++ .../package.json | 8 ++++++++ .../hardhat-project-minimal/hardhat.config.js | 3 --- .../hardhat-project-minimal/hardhat.config.ts | 3 +++ .../hardhat-project-minimal/package.json | 8 ++++++++ .../.gitignore | 1 + .../hardhat.config.js | 5 ----- .../hardhat.config.ts | 15 +++++++++++++++ .../package.json | 8 ++++++++ .../hardhat.config.js | 3 --- .../hardhat.config.ts | 7 +++++++ .../package.json | 8 ++++++++ test/fixture-projects/hardhat.config.ts | 18 ++++++++++++++++++ 31 files changed, 219 insertions(+), 35 deletions(-) rename test/fixture-projects/hardhat-project-defined-config/{hardhat.config.js => hardhat.config.ts} (52%) create mode 100644 test/fixture-projects/hardhat-project-defined-config/package.json delete mode 100644 test/fixture-projects/hardhat-project-invalid-config/hardhat.config.js create mode 100644 test/fixture-projects/hardhat-project-invalid-config/hardhat.config.ts create mode 100644 test/fixture-projects/hardhat-project-invalid-config/package.json create mode 100644 test/fixture-projects/hardhat-project-minimal-ethers/hardhat.config.ts create mode 100644 test/fixture-projects/hardhat-project-minimal-ethers/package.json create mode 100644 test/fixture-projects/hardhat-project-minimal-truffle/deploy/1_deploy.ts create mode 100644 test/fixture-projects/hardhat-project-minimal-truffle/hardhat.config.ts create mode 100644 test/fixture-projects/hardhat-project-minimal-truffle/package.json create mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/deploy/1_deploy.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/hardhat.config.js create mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/hardhat.config.ts create mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/package.json delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-truffle/hardhat.config.js create mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-truffle/hardhat.config.ts create mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-truffle/package.json delete mode 100644 test/fixture-projects/hardhat-project-minimal/hardhat.config.js create mode 100644 test/fixture-projects/hardhat-project-minimal/hardhat.config.ts create mode 100644 test/fixture-projects/hardhat-project-minimal/package.json delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/hardhat.config.js create mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/hardhat.config.ts create mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/package.json delete mode 100644 test/fixture-projects/hardhat-project-undefined-config/hardhat.config.js create mode 100644 test/fixture-projects/hardhat-project-undefined-config/hardhat.config.ts create mode 100644 test/fixture-projects/hardhat-project-undefined-config/package.json create mode 100644 test/fixture-projects/hardhat.config.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 450142b9..75b47463 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Version 2.0.0-beta.1 +* Migrated test fixture projects to TypeScript with updated configurations and scripts. * Added `TransactionFieldsToSave` as a return value to the `sendNative` function * Added handling of the custom chains specified in the Hardhat config * Refactored the architecture and made it consistent diff --git a/package.json b/package.json index bc779849..e785c118 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,9 @@ "prepack": "pinst --disable", "postpack": "pinst --enable", "build": "tsc --build .", + "prepare-tests": "npm run compile --workspaces", "test": "mocha --recursive 'test/**/*.ts' --exit && npm run lint-fix", + "prepare-clean": "npm run clean --workspaces", "lint-fix": "prettier --write \"./**/*.ts\" && eslint \"src/**/*.{js,ts}\" --cache --fix", "publish-to-npm": "npm run build && npm run lint-fix && npm publish ./ --access public" }, diff --git a/test/fixture-projects/hardhat-project-defined-config/hardhat.config.js b/test/fixture-projects/hardhat-project-defined-config/hardhat.config.ts similarity index 52% rename from test/fixture-projects/hardhat-project-defined-config/hardhat.config.js rename to test/fixture-projects/hardhat-project-defined-config/hardhat.config.ts index 5533705d..d3143371 100644 --- a/test/fixture-projects/hardhat-project-defined-config/hardhat.config.js +++ b/test/fixture-projects/hardhat-project-defined-config/hardhat.config.ts @@ -1,6 +1,11 @@ -require("../../../src"); +import { HardhatUserConfig } from "hardhat/config"; -module.exports = { +import config from "../hardhat.config"; + +import "../../../src"; + +const defaultConfig: HardhatUserConfig = { + ...config, migrate: { from: 1, to: 5, @@ -15,3 +20,5 @@ module.exports = { continue: true, }, }; + +export default defaultConfig; diff --git a/test/fixture-projects/hardhat-project-defined-config/package.json b/test/fixture-projects/hardhat-project-defined-config/package.json new file mode 100644 index 00000000..bb948ee4 --- /dev/null +++ b/test/fixture-projects/hardhat-project-defined-config/package.json @@ -0,0 +1,8 @@ +{ + "name": "hardhat-project-defined-config", + "version": "1.0.0", + "scripts": { + "compile": "hardhat compile --force", + "clean": "hardhat clean && rm -rf artifacts && rm -rf cache" + } +} diff --git a/test/fixture-projects/hardhat-project-invalid-config/hardhat.config.js b/test/fixture-projects/hardhat-project-invalid-config/hardhat.config.js deleted file mode 100644 index 963947ec..00000000 --- a/test/fixture-projects/hardhat-project-invalid-config/hardhat.config.js +++ /dev/null @@ -1,7 +0,0 @@ -require("../../../src"); - -module.exports = { - migrate: { - pathToMigrations: "/deploy", - }, -}; diff --git a/test/fixture-projects/hardhat-project-invalid-config/hardhat.config.ts b/test/fixture-projects/hardhat-project-invalid-config/hardhat.config.ts new file mode 100644 index 00000000..e99154ce --- /dev/null +++ b/test/fixture-projects/hardhat-project-invalid-config/hardhat.config.ts @@ -0,0 +1,14 @@ +import { HardhatUserConfig } from "hardhat/config"; + +import config from "../hardhat.config"; + +import "../../../src"; + +const defaultConfig: HardhatUserConfig = { + ...config, + migrate: { + pathToMigrations: "~/deploy", + }, +}; + +export default defaultConfig; diff --git a/test/fixture-projects/hardhat-project-invalid-config/package.json b/test/fixture-projects/hardhat-project-invalid-config/package.json new file mode 100644 index 00000000..62cb4948 --- /dev/null +++ b/test/fixture-projects/hardhat-project-invalid-config/package.json @@ -0,0 +1,8 @@ +{ + "name": "hardhat-project-invalid-config", + "version": "1.0.0", + "scripts": { + "compile": "hardhat compile --force", + "clean": "hardhat clean && rm -rf artifacts && rm -rf cache" + } +} diff --git a/test/fixture-projects/hardhat-project-minimal-ethers/hardhat.config.ts b/test/fixture-projects/hardhat-project-minimal-ethers/hardhat.config.ts new file mode 100644 index 00000000..1996edf0 --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal-ethers/hardhat.config.ts @@ -0,0 +1,3 @@ +import config from "../hardhat.config"; + +export default config; diff --git a/test/fixture-projects/hardhat-project-minimal-ethers/package.json b/test/fixture-projects/hardhat-project-minimal-ethers/package.json new file mode 100644 index 00000000..fc227dc3 --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal-ethers/package.json @@ -0,0 +1,8 @@ +{ + "name": "hardhat-project-minimal-ethers", + "version": "1.0.0", + "scripts": { + "compile": "hardhat compile --force", + "clean": "hardhat clean && rm -rf artifacts && rm -rf cache" + } +} diff --git a/test/fixture-projects/hardhat-project-minimal-truffle/deploy/1_deploy.ts b/test/fixture-projects/hardhat-project-minimal-truffle/deploy/1_deploy.ts new file mode 100644 index 00000000..1ba52478 --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal-truffle/deploy/1_deploy.ts @@ -0,0 +1,13 @@ +import { getContractFactory } from "@nomicfoundation/hardhat-ethers/types"; + +import { Deployer } from "../../../../src/deployer/Deployer"; + +export = async (deployer: Deployer) => { + const ContractWithConstructorArguments = await getContractFactory("ContractWithConstructorArguments"); + + let contract = await deployer.deploy(ContractWithConstructorArguments, ["hello"], { + gasLimit: 1000000, + }); + + await contract.name(); +}; diff --git a/test/fixture-projects/hardhat-project-minimal-truffle/hardhat.config.ts b/test/fixture-projects/hardhat-project-minimal-truffle/hardhat.config.ts new file mode 100644 index 00000000..62f20c06 --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal-truffle/hardhat.config.ts @@ -0,0 +1,11 @@ +import { HardhatUserConfig } from "hardhat/config"; + +import "@nomiclabs/hardhat-truffle5"; + +import config from "../hardhat.config"; + +const defaultConfig: HardhatUserConfig = { + ...config, +}; + +export default defaultConfig; diff --git a/test/fixture-projects/hardhat-project-minimal-truffle/package.json b/test/fixture-projects/hardhat-project-minimal-truffle/package.json new file mode 100644 index 00000000..cd52aa37 --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal-truffle/package.json @@ -0,0 +1,8 @@ +{ + "name": "hardhat-project-minimal-truffle", + "version": "1.0.0", + "scripts": { + "compile": "hardhat compile --force", + "clean": "hardhat clean && rm -rf artifacts && rm -rf cache" + } +} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/deploy/1_deploy.ts b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/deploy/1_deploy.ts new file mode 100644 index 00000000..3dc7785b --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/deploy/1_deploy.ts @@ -0,0 +1,13 @@ +import { Deployer } from "../../../../src/deployer/Deployer"; + +import { ContractWithConstructorArguments__factory } from "../typechain-types"; + +export = async (deployer: Deployer) => { + let contract = await deployer.deploy(ContractWithConstructorArguments__factory, ["hello"], { + gasLimit: 1000000, + }); + + let contract2 = await deployer.deploy({ bytecode: "", abi: "", contractName: "" }, ["hello"], {}); + + await contract.name(); +}; diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/hardhat.config.js b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/hardhat.config.js deleted file mode 100644 index 0a86391e..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/hardhat.config.js +++ /dev/null @@ -1,5 +0,0 @@ -require("../../../src"); - -require("@typechain/hardhat"); - -module.exports = {}; diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/hardhat.config.ts b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/hardhat.config.ts new file mode 100644 index 00000000..363aeb4b --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/hardhat.config.ts @@ -0,0 +1,17 @@ +import { HardhatUserConfig } from "hardhat/config"; + +import "@typechain/hardhat"; + +import config from "../hardhat.config"; + +const defaultConfig: HardhatUserConfig = { + ...config, + typechain: { + outDir: `typechain-types`, + target: "ethers-v6", + alwaysGenerateOverloads: true, + discriminateTypes: true, + }, +}; + +export default defaultConfig; diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/package.json b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/package.json new file mode 100644 index 00000000..9b20798f --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/package.json @@ -0,0 +1,8 @@ +{ + "name": "hardhat-project-minimal-typechain-ethers", + "version": "1.0.0", + "scripts": { + "compile": "hardhat compile --force", + "clean": "hardhat clean && rm -rf artifacts && rm -rf cache" + } +} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/.gitignore b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/.gitignore index f61ce9c7..d5e01af2 100644 --- a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/.gitignore +++ b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/.gitignore @@ -1,2 +1,3 @@ /cache /artifacts +typechain-types diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/hardhat.config.js b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/hardhat.config.js deleted file mode 100644 index ffd266f0..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/hardhat.config.js +++ /dev/null @@ -1,10 +0,0 @@ -require("../../../src"); - -require("@nomiclabs/hardhat-truffle5"); -require("@typechain/hardhat"); - -module.exports = { - typechain: { - target: "truffle-v5", - }, -}; diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/hardhat.config.ts b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/hardhat.config.ts new file mode 100644 index 00000000..17bd6ffd --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/hardhat.config.ts @@ -0,0 +1,19 @@ +import { HardhatUserConfig } from "hardhat/config"; + +import "@nomiclabs/hardhat-truffle5"; + +import "@typechain/hardhat"; + +import config from "../hardhat.config"; + +const defaultConfig: HardhatUserConfig = { + ...config, + typechain: { + outDir: `typechain-types`, + target: "truffle-v5", + alwaysGenerateOverloads: true, + discriminateTypes: true, + }, +}; + +export default defaultConfig; diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/package.json b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/package.json new file mode 100644 index 00000000..7bdf5362 --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/package.json @@ -0,0 +1,8 @@ +{ + "name": "hardhat-project-minimal-typechain-truffle", + "version": "1.0.0", + "scripts": { + "compile": "hardhat compile --force", + "clean": "hardhat clean && rm -rf artifacts && rm -rf cache" + } +} diff --git a/test/fixture-projects/hardhat-project-minimal/hardhat.config.js b/test/fixture-projects/hardhat-project-minimal/hardhat.config.js deleted file mode 100644 index 10cdd35b..00000000 --- a/test/fixture-projects/hardhat-project-minimal/hardhat.config.js +++ /dev/null @@ -1,3 +0,0 @@ -require("../../../src"); - -module.exports = {}; diff --git a/test/fixture-projects/hardhat-project-minimal/hardhat.config.ts b/test/fixture-projects/hardhat-project-minimal/hardhat.config.ts new file mode 100644 index 00000000..1996edf0 --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal/hardhat.config.ts @@ -0,0 +1,3 @@ +import config from "../hardhat.config"; + +export default config; diff --git a/test/fixture-projects/hardhat-project-minimal/package.json b/test/fixture-projects/hardhat-project-minimal/package.json new file mode 100644 index 00000000..618be864 --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal/package.json @@ -0,0 +1,8 @@ +{ + "name": "hardhat-project-minimal", + "version": "1.0.0", + "scripts": { + "compile": "hardhat compile --force", + "clean": "hardhat clean && rm -rf artifacts && rm -rf cache" + } +} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/.gitignore b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/.gitignore index f61ce9c7..d5e01af2 100644 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/.gitignore +++ b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/.gitignore @@ -1,2 +1,3 @@ /cache /artifacts +typechain-types diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/hardhat.config.js b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/hardhat.config.js deleted file mode 100644 index 0a86391e..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/hardhat.config.js +++ /dev/null @@ -1,5 +0,0 @@ -require("../../../src"); - -require("@typechain/hardhat"); - -module.exports = {}; diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/hardhat.config.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/hardhat.config.ts new file mode 100644 index 00000000..6918fbc5 --- /dev/null +++ b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/hardhat.config.ts @@ -0,0 +1,15 @@ +import "@typechain/hardhat"; + +import config from "../hardhat.config"; + +const defaultConfig = { + ...config, + typechain: { + outDir: `typechain-types`, + target: "ethers-v6", + alwaysGenerateOverloads: true, + discriminateTypes: true, + }, +}; + +export default defaultConfig; diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/package.json b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/package.json new file mode 100644 index 00000000..691db1b1 --- /dev/null +++ b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/package.json @@ -0,0 +1,8 @@ +{ + "name": "hardhat-project-repeats-typechain-ethers", + "version": "1.0.0", + "scripts": { + "compile": "hardhat compile --force", + "clean": "hardhat clean && rm -rf artifacts && rm -rf cache" + } +} diff --git a/test/fixture-projects/hardhat-project-undefined-config/hardhat.config.js b/test/fixture-projects/hardhat-project-undefined-config/hardhat.config.js deleted file mode 100644 index 10cdd35b..00000000 --- a/test/fixture-projects/hardhat-project-undefined-config/hardhat.config.js +++ /dev/null @@ -1,3 +0,0 @@ -require("../../../src"); - -module.exports = {}; diff --git a/test/fixture-projects/hardhat-project-undefined-config/hardhat.config.ts b/test/fixture-projects/hardhat-project-undefined-config/hardhat.config.ts new file mode 100644 index 00000000..5ab6880e --- /dev/null +++ b/test/fixture-projects/hardhat-project-undefined-config/hardhat.config.ts @@ -0,0 +1,7 @@ +import config from "../hardhat.config"; + +const defaultConfig = { + ...config, +}; + +export default defaultConfig; diff --git a/test/fixture-projects/hardhat-project-undefined-config/package.json b/test/fixture-projects/hardhat-project-undefined-config/package.json new file mode 100644 index 00000000..512bef72 --- /dev/null +++ b/test/fixture-projects/hardhat-project-undefined-config/package.json @@ -0,0 +1,8 @@ +{ + "name": "hardhat-project-undefined-config", + "version": "1.0.0", + "scripts": { + "compile": "hardhat compile --force", + "clean": "hardhat clean && rm -rf artifacts && rm -rf cache" + } +} diff --git a/test/fixture-projects/hardhat.config.ts b/test/fixture-projects/hardhat.config.ts new file mode 100644 index 00000000..e52b8670 --- /dev/null +++ b/test/fixture-projects/hardhat.config.ts @@ -0,0 +1,18 @@ +import "@nomicfoundation/hardhat-ethers"; + +import { HardhatUserConfig } from "hardhat/config"; + +const config: HardhatUserConfig = { + solidity: { + version: "0.8.20", + settings: { + optimizer: { + enabled: true, + runs: 200, + }, + evmVersion: "paris", + }, + }, +}; + +export default config; From c0ef81d293b602228e2f27fec3e9e2a8e285fe90 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Tue, 19 Dec 2023 23:14:44 +0200 Subject: [PATCH 10/34] Created new fixture contracts for testing --- package-lock.json | 63 +++++++++++++++++++ package.json | 3 +- .../contracts/Contracts.sol | 56 ----------------- .../contracts/GovToken.sol | 63 +++++++++++++++++++ .../contracts/libs/TimestampClockLib.sol | 20 ++++++ .../contracts/libs/VotingPowerLib.sol | 28 +++++++++ .../contracts/Contracts.sol | 56 ----------------- .../contracts/GovToken.sol | 63 +++++++++++++++++++ .../contracts/libs/TimestampClockLib.sol | 20 ++++++ .../contracts/libs/VotingPowerLib.sol | 28 +++++++++ .../contracts/Contracts.sol | 56 ----------------- .../contracts/GovToken.sol | 63 +++++++++++++++++++ .../contracts/libs/TimestampClockLib.sol | 20 ++++++ .../contracts/libs/VotingPowerLib.sol | 28 +++++++++ .../contracts/Contracts.sol | 56 ----------------- .../contracts/GovToken.sol | 63 +++++++++++++++++++ .../contracts/libs/TimestampClockLib.sol | 20 ++++++ .../contracts/libs/VotingPowerLib.sol | 28 +++++++++ .../contracts/Contracts.sol | 20 ------ .../contracts/GovToken.sol | 63 +++++++++++++++++++ .../contracts/libs/TimestampClockLib.sol | 20 ++++++ .../contracts/libs/VotingPowerLib.sol | 28 +++++++++ .../contracts/Contracts.sol | 56 ----------------- .../contracts/Contracts2.sol | 56 ----------------- .../contracts/GovToken.sol | 63 +++++++++++++++++++ .../contracts/another-contracts/Contracts.sol | 56 ----------------- .../another-contracts/Contracts2.sol | 56 ----------------- .../contracts/libs/TimestampClockLib.sol | 20 ++++++ .../contracts/libs/VotingPowerLib.sol | 28 +++++++++ 29 files changed, 731 insertions(+), 469 deletions(-) delete mode 100644 test/fixture-projects/hardhat-project-minimal-ethers/contracts/Contracts.sol create mode 100644 test/fixture-projects/hardhat-project-minimal-ethers/contracts/GovToken.sol create mode 100644 test/fixture-projects/hardhat-project-minimal-ethers/contracts/libs/TimestampClockLib.sol create mode 100644 test/fixture-projects/hardhat-project-minimal-ethers/contracts/libs/VotingPowerLib.sol delete mode 100644 test/fixture-projects/hardhat-project-minimal-truffle/contracts/Contracts.sol create mode 100644 test/fixture-projects/hardhat-project-minimal-truffle/contracts/GovToken.sol create mode 100644 test/fixture-projects/hardhat-project-minimal-truffle/contracts/libs/TimestampClockLib.sol create mode 100644 test/fixture-projects/hardhat-project-minimal-truffle/contracts/libs/VotingPowerLib.sol delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/contracts/Contracts.sol create mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/contracts/GovToken.sol create mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/contracts/libs/TimestampClockLib.sol create mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/contracts/libs/VotingPowerLib.sol delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-truffle/contracts/Contracts.sol create mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-truffle/contracts/GovToken.sol create mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-truffle/contracts/libs/TimestampClockLib.sol create mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-truffle/contracts/libs/VotingPowerLib.sol delete mode 100644 test/fixture-projects/hardhat-project-minimal/contracts/Contracts.sol create mode 100644 test/fixture-projects/hardhat-project-minimal/contracts/GovToken.sol create mode 100644 test/fixture-projects/hardhat-project-minimal/contracts/libs/TimestampClockLib.sol create mode 100644 test/fixture-projects/hardhat-project-minimal/contracts/libs/VotingPowerLib.sol delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/Contracts.sol delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/Contracts2.sol create mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/GovToken.sol delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/another-contracts/Contracts.sol delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/another-contracts/Contracts2.sol create mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/libs/TimestampClockLib.sol create mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/libs/VotingPowerLib.sol diff --git a/package-lock.json b/package-lock.json index ca36dc36..5d165ffd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,6 +23,7 @@ "devDependencies": { "@nomicfoundation/hardhat-ethers": "^3.0.4", "@nomiclabs/hardhat-truffle5": "^2.0.0", + "@openzeppelin/contracts": "^5.0.1", "@typechain/ethers-v6": "^0.5.0", "@typechain/hardhat": "^9.1.0", "@typechain/truffle-v5": "^8.0.6", @@ -2170,6 +2171,12 @@ "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", "dev": true }, + "node_modules/@openzeppelin/contracts": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-5.0.1.tgz", + "integrity": "sha512-yQJaT5HDp9hYOOp4jTYxMsR02gdFZFXhewX5HW9Jo4fsqSVqqyIO/xTHdWDaKX5a3pv1txmf076Lziz+sO7L1w==", + "dev": true + }, "node_modules/@pkgr/utils": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.4.2.tgz", @@ -13854,10 +13861,42 @@ } } }, + "node_modules/hardhat-project-defined-config": { + "resolved": "test/fixture-projects/hardhat-project-defined-config", + "link": true + }, + "node_modules/hardhat-project-invalid-config": { + "resolved": "test/fixture-projects/hardhat-project-invalid-config", + "link": true + }, + "node_modules/hardhat-project-minimal": { + "resolved": "test/fixture-projects/hardhat-project-minimal", + "link": true + }, "node_modules/hardhat-project-minimal-ethers": { "resolved": "test/fixture-projects/hardhat-project-minimal-ethers", "link": true }, + "node_modules/hardhat-project-minimal-truffle": { + "resolved": "test/fixture-projects/hardhat-project-minimal-truffle", + "link": true + }, + "node_modules/hardhat-project-minimal-typechain-ethers": { + "resolved": "test/fixture-projects/hardhat-project-minimal-typechain-ethers", + "link": true + }, + "node_modules/hardhat-project-minimal-typechain-truffle": { + "resolved": "test/fixture-projects/hardhat-project-minimal-typechain-truffle", + "link": true + }, + "node_modules/hardhat-project-repeats-typechain-ethers": { + "resolved": "test/fixture-projects/hardhat-project-repeats-typechain-ethers", + "link": true + }, + "node_modules/hardhat-project-undefined-config": { + "resolved": "test/fixture-projects/hardhat-project-undefined-config", + "link": true + }, "node_modules/hardhat/node_modules/@noble/hashes": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.2.0.tgz", @@ -21287,8 +21326,32 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "test/fixture-projects/hardhat-project-defined-config": { + "version": "1.0.0" + }, + "test/fixture-projects/hardhat-project-invalid-config": { + "version": "1.0.0" + }, + "test/fixture-projects/hardhat-project-minimal": { + "version": "1.0.0" + }, "test/fixture-projects/hardhat-project-minimal-ethers": { "version": "1.0.0" + }, + "test/fixture-projects/hardhat-project-minimal-truffle": { + "version": "1.0.0" + }, + "test/fixture-projects/hardhat-project-minimal-typechain-ethers": { + "version": "1.0.0" + }, + "test/fixture-projects/hardhat-project-minimal-typechain-truffle": { + "version": "1.0.0" + }, + "test/fixture-projects/hardhat-project-repeats-typechain-ethers": { + "version": "1.0.0" + }, + "test/fixture-projects/hardhat-project-undefined-config": { + "version": "1.0.0" } } } diff --git a/package.json b/package.json index e785c118..059723ab 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "build": "tsc --build .", "prepare-tests": "npm run compile --workspaces", "test": "mocha --recursive 'test/**/*.ts' --exit && npm run lint-fix", - "prepare-clean": "npm run clean --workspaces", + "clean-tests": "npm run clean --workspaces", "lint-fix": "prettier --write \"./**/*.ts\" && eslint \"src/**/*.{js,ts}\" --cache --fix", "publish-to-npm": "npm run build && npm run lint-fix && npm publish ./ --access public" }, @@ -59,6 +59,7 @@ "devDependencies": { "@nomicfoundation/hardhat-ethers": "^3.0.4", "@nomiclabs/hardhat-truffle5": "^2.0.0", + "@openzeppelin/contracts": "^5.0.1", "@typechain/ethers-v6": "^0.5.0", "@typechain/hardhat": "^9.1.0", "@typechain/truffle-v5": "^8.0.6", diff --git a/test/fixture-projects/hardhat-project-minimal-ethers/contracts/Contracts.sol b/test/fixture-projects/hardhat-project-minimal-ethers/contracts/Contracts.sol deleted file mode 100644 index d05c1b00..00000000 --- a/test/fixture-projects/hardhat-project-minimal-ethers/contracts/Contracts.sol +++ /dev/null @@ -1,56 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; - -contract Contract {} - -contract ContractWithPayableConstructor { - constructor() payable {} -} - -contract ContractWithConstructorArguments { - string public name; - - constructor(string memory _name) { - name = _name; - } -} - -contract ContractWithExternalLibrary { - function lib() external pure returns (uint256) { - return Library1.lib(); - } - - function lib2() external pure returns (uint256) { - return Library2.lib(); - } - - function lib3() external pure returns (uint256) { - return Library3.libInternal(); - } - - function lib4() external pure returns (uint256) { - return Library2.libInternal(); - } -} - -library Library1 { - function lib() external pure returns (uint256) { - return 1; - } -} - -library Library2 { - function lib() external pure returns (uint256) { - return 2; - } - - function libInternal() internal pure returns (uint256) { - return 3; - } -} - -library Library3 { - function libInternal() internal pure returns (uint256) { - return 3; - } -} diff --git a/test/fixture-projects/hardhat-project-minimal-ethers/contracts/GovToken.sol b/test/fixture-projects/hardhat-project-minimal-ethers/contracts/GovToken.sol new file mode 100644 index 00000000..7f4cc7d7 --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal-ethers/contracts/GovToken.sol @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.7.0 <0.9.0; + +import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; +import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol"; +import {ERC20Votes, ERC20} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol"; + +import {VotingPowerLib} from "./libs/VotingPowerLib.sol"; +import {TimestampClockLib} from "./libs/TimestampClockLib.sol"; + +/** +* @title GovToken +* +* @notice This is an ERC20 token that includes vote delegation. +* It is intentionally designed with added complexity for testing purposes. +*/ +contract GovToken is ERC20Votes, Ownable { + using VotingPowerLib for uint256; + + constructor(string memory name_, string memory symbol_) ERC20(name_, symbol_) EIP712(name_, version()) Ownable(msg.sender) { + _mint(msg.sender, 1000000); + } + + function decimals() public pure override returns (uint8) { + return 3; + } + + function version() public pure returns (string memory) { + return "1"; + } + + function mint(address to_, uint256 amount_) external onlyOwner { + _mint(to_, amount_); + } + + function burn(address from_, uint256 amount_) external onlyOwner { + _burn(from_, amount_); + } + + function getUserVotingPower(address account_) public view returns (uint256) { + return getVotes(account_).calculateUserVotingPower(decimals()); + } + + function getPastUserVotingPower(address account_, uint256 timestamp_) public view returns (uint256) { + return getPastVotes(account_, timestamp_).calculateUserVotingPower(decimals()); + } + + function getVotingPowerThreshold() public view returns (uint256) { + return _getTotalSupply().calculateVotingPowerThreshold(decimals()); + } + + function getPastVotingPowerThreshold(uint256 timestamp_) public view returns (uint256) { + return getPastTotalSupply(timestamp_).calculateVotingPowerThreshold(decimals()); + } + + function clock() public view override returns (uint48) { + return TimestampClockLib.clock(); + } + + function CLOCK_MODE() public view override returns (string memory) { + return TimestampClockLib.CLOCK_MODE(); + } +} diff --git a/test/fixture-projects/hardhat-project-minimal-ethers/contracts/libs/TimestampClockLib.sol b/test/fixture-projects/hardhat-project-minimal-ethers/contracts/libs/TimestampClockLib.sol new file mode 100644 index 00000000..3517a813 --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal-ethers/contracts/libs/TimestampClockLib.sol @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.7.0 <0.9.0; + +import {Time} from "@openzeppelin/contracts/utils/types/Time.sol"; +import {Votes} from "@openzeppelin/contracts/governance/utils/Votes.sol"; + +library TimestampClockLib { + using Time for *; + + function clock() public view returns (uint48) { + return Time.timestamp(); + } + + function CLOCK_MODE() public view returns (string memory) { + if (clock() != Time.timestamp()) { + revert Votes.ERC6372InconsistentClock(); + } + return "mode=timestamp"; + } +} diff --git a/test/fixture-projects/hardhat-project-minimal-ethers/contracts/libs/VotingPowerLib.sol b/test/fixture-projects/hardhat-project-minimal-ethers/contracts/libs/VotingPowerLib.sol new file mode 100644 index 00000000..1480bc7f --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal-ethers/contracts/libs/VotingPowerLib.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.7.0 <0.9.0; + +import "@openzeppelin/contracts/utils/math/Math.sol"; + +library VotingPowerLib { + using Math for *; + + function calculateUserVotingPower(uint256 tokenAmount_, uint8 decimals_) external pure returns (uint256) { + uint256 oneToken_ = 10 ** decimals_; + + if (tokenAmount_ <= oneToken_) { + return 0; + } + + return (tokenAmount_ / oneToken_).log2(); + } + + function calculateVotingPowerThreshold(uint256 totalSupply_, uint8 decimals_) external pure returns (uint256) { + uint256 oneToken_ = 10 ** decimals_; + + if (totalSupply_ <= oneToken_) { + return 0; + } + + return (totalSupply_ / oneToken_).log10(); + } +} diff --git a/test/fixture-projects/hardhat-project-minimal-truffle/contracts/Contracts.sol b/test/fixture-projects/hardhat-project-minimal-truffle/contracts/Contracts.sol deleted file mode 100644 index d05c1b00..00000000 --- a/test/fixture-projects/hardhat-project-minimal-truffle/contracts/Contracts.sol +++ /dev/null @@ -1,56 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; - -contract Contract {} - -contract ContractWithPayableConstructor { - constructor() payable {} -} - -contract ContractWithConstructorArguments { - string public name; - - constructor(string memory _name) { - name = _name; - } -} - -contract ContractWithExternalLibrary { - function lib() external pure returns (uint256) { - return Library1.lib(); - } - - function lib2() external pure returns (uint256) { - return Library2.lib(); - } - - function lib3() external pure returns (uint256) { - return Library3.libInternal(); - } - - function lib4() external pure returns (uint256) { - return Library2.libInternal(); - } -} - -library Library1 { - function lib() external pure returns (uint256) { - return 1; - } -} - -library Library2 { - function lib() external pure returns (uint256) { - return 2; - } - - function libInternal() internal pure returns (uint256) { - return 3; - } -} - -library Library3 { - function libInternal() internal pure returns (uint256) { - return 3; - } -} diff --git a/test/fixture-projects/hardhat-project-minimal-truffle/contracts/GovToken.sol b/test/fixture-projects/hardhat-project-minimal-truffle/contracts/GovToken.sol new file mode 100644 index 00000000..7f4cc7d7 --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal-truffle/contracts/GovToken.sol @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.7.0 <0.9.0; + +import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; +import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol"; +import {ERC20Votes, ERC20} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol"; + +import {VotingPowerLib} from "./libs/VotingPowerLib.sol"; +import {TimestampClockLib} from "./libs/TimestampClockLib.sol"; + +/** +* @title GovToken +* +* @notice This is an ERC20 token that includes vote delegation. +* It is intentionally designed with added complexity for testing purposes. +*/ +contract GovToken is ERC20Votes, Ownable { + using VotingPowerLib for uint256; + + constructor(string memory name_, string memory symbol_) ERC20(name_, symbol_) EIP712(name_, version()) Ownable(msg.sender) { + _mint(msg.sender, 1000000); + } + + function decimals() public pure override returns (uint8) { + return 3; + } + + function version() public pure returns (string memory) { + return "1"; + } + + function mint(address to_, uint256 amount_) external onlyOwner { + _mint(to_, amount_); + } + + function burn(address from_, uint256 amount_) external onlyOwner { + _burn(from_, amount_); + } + + function getUserVotingPower(address account_) public view returns (uint256) { + return getVotes(account_).calculateUserVotingPower(decimals()); + } + + function getPastUserVotingPower(address account_, uint256 timestamp_) public view returns (uint256) { + return getPastVotes(account_, timestamp_).calculateUserVotingPower(decimals()); + } + + function getVotingPowerThreshold() public view returns (uint256) { + return _getTotalSupply().calculateVotingPowerThreshold(decimals()); + } + + function getPastVotingPowerThreshold(uint256 timestamp_) public view returns (uint256) { + return getPastTotalSupply(timestamp_).calculateVotingPowerThreshold(decimals()); + } + + function clock() public view override returns (uint48) { + return TimestampClockLib.clock(); + } + + function CLOCK_MODE() public view override returns (string memory) { + return TimestampClockLib.CLOCK_MODE(); + } +} diff --git a/test/fixture-projects/hardhat-project-minimal-truffle/contracts/libs/TimestampClockLib.sol b/test/fixture-projects/hardhat-project-minimal-truffle/contracts/libs/TimestampClockLib.sol new file mode 100644 index 00000000..3517a813 --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal-truffle/contracts/libs/TimestampClockLib.sol @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.7.0 <0.9.0; + +import {Time} from "@openzeppelin/contracts/utils/types/Time.sol"; +import {Votes} from "@openzeppelin/contracts/governance/utils/Votes.sol"; + +library TimestampClockLib { + using Time for *; + + function clock() public view returns (uint48) { + return Time.timestamp(); + } + + function CLOCK_MODE() public view returns (string memory) { + if (clock() != Time.timestamp()) { + revert Votes.ERC6372InconsistentClock(); + } + return "mode=timestamp"; + } +} diff --git a/test/fixture-projects/hardhat-project-minimal-truffle/contracts/libs/VotingPowerLib.sol b/test/fixture-projects/hardhat-project-minimal-truffle/contracts/libs/VotingPowerLib.sol new file mode 100644 index 00000000..1480bc7f --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal-truffle/contracts/libs/VotingPowerLib.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.7.0 <0.9.0; + +import "@openzeppelin/contracts/utils/math/Math.sol"; + +library VotingPowerLib { + using Math for *; + + function calculateUserVotingPower(uint256 tokenAmount_, uint8 decimals_) external pure returns (uint256) { + uint256 oneToken_ = 10 ** decimals_; + + if (tokenAmount_ <= oneToken_) { + return 0; + } + + return (tokenAmount_ / oneToken_).log2(); + } + + function calculateVotingPowerThreshold(uint256 totalSupply_, uint8 decimals_) external pure returns (uint256) { + uint256 oneToken_ = 10 ** decimals_; + + if (totalSupply_ <= oneToken_) { + return 0; + } + + return (totalSupply_ / oneToken_).log10(); + } +} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/contracts/Contracts.sol b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/contracts/Contracts.sol deleted file mode 100644 index d05c1b00..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/contracts/Contracts.sol +++ /dev/null @@ -1,56 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; - -contract Contract {} - -contract ContractWithPayableConstructor { - constructor() payable {} -} - -contract ContractWithConstructorArguments { - string public name; - - constructor(string memory _name) { - name = _name; - } -} - -contract ContractWithExternalLibrary { - function lib() external pure returns (uint256) { - return Library1.lib(); - } - - function lib2() external pure returns (uint256) { - return Library2.lib(); - } - - function lib3() external pure returns (uint256) { - return Library3.libInternal(); - } - - function lib4() external pure returns (uint256) { - return Library2.libInternal(); - } -} - -library Library1 { - function lib() external pure returns (uint256) { - return 1; - } -} - -library Library2 { - function lib() external pure returns (uint256) { - return 2; - } - - function libInternal() internal pure returns (uint256) { - return 3; - } -} - -library Library3 { - function libInternal() internal pure returns (uint256) { - return 3; - } -} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/contracts/GovToken.sol b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/contracts/GovToken.sol new file mode 100644 index 00000000..7f4cc7d7 --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/contracts/GovToken.sol @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.7.0 <0.9.0; + +import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; +import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol"; +import {ERC20Votes, ERC20} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol"; + +import {VotingPowerLib} from "./libs/VotingPowerLib.sol"; +import {TimestampClockLib} from "./libs/TimestampClockLib.sol"; + +/** +* @title GovToken +* +* @notice This is an ERC20 token that includes vote delegation. +* It is intentionally designed with added complexity for testing purposes. +*/ +contract GovToken is ERC20Votes, Ownable { + using VotingPowerLib for uint256; + + constructor(string memory name_, string memory symbol_) ERC20(name_, symbol_) EIP712(name_, version()) Ownable(msg.sender) { + _mint(msg.sender, 1000000); + } + + function decimals() public pure override returns (uint8) { + return 3; + } + + function version() public pure returns (string memory) { + return "1"; + } + + function mint(address to_, uint256 amount_) external onlyOwner { + _mint(to_, amount_); + } + + function burn(address from_, uint256 amount_) external onlyOwner { + _burn(from_, amount_); + } + + function getUserVotingPower(address account_) public view returns (uint256) { + return getVotes(account_).calculateUserVotingPower(decimals()); + } + + function getPastUserVotingPower(address account_, uint256 timestamp_) public view returns (uint256) { + return getPastVotes(account_, timestamp_).calculateUserVotingPower(decimals()); + } + + function getVotingPowerThreshold() public view returns (uint256) { + return _getTotalSupply().calculateVotingPowerThreshold(decimals()); + } + + function getPastVotingPowerThreshold(uint256 timestamp_) public view returns (uint256) { + return getPastTotalSupply(timestamp_).calculateVotingPowerThreshold(decimals()); + } + + function clock() public view override returns (uint48) { + return TimestampClockLib.clock(); + } + + function CLOCK_MODE() public view override returns (string memory) { + return TimestampClockLib.CLOCK_MODE(); + } +} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/contracts/libs/TimestampClockLib.sol b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/contracts/libs/TimestampClockLib.sol new file mode 100644 index 00000000..3517a813 --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/contracts/libs/TimestampClockLib.sol @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.7.0 <0.9.0; + +import {Time} from "@openzeppelin/contracts/utils/types/Time.sol"; +import {Votes} from "@openzeppelin/contracts/governance/utils/Votes.sol"; + +library TimestampClockLib { + using Time for *; + + function clock() public view returns (uint48) { + return Time.timestamp(); + } + + function CLOCK_MODE() public view returns (string memory) { + if (clock() != Time.timestamp()) { + revert Votes.ERC6372InconsistentClock(); + } + return "mode=timestamp"; + } +} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/contracts/libs/VotingPowerLib.sol b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/contracts/libs/VotingPowerLib.sol new file mode 100644 index 00000000..1480bc7f --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/contracts/libs/VotingPowerLib.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.7.0 <0.9.0; + +import "@openzeppelin/contracts/utils/math/Math.sol"; + +library VotingPowerLib { + using Math for *; + + function calculateUserVotingPower(uint256 tokenAmount_, uint8 decimals_) external pure returns (uint256) { + uint256 oneToken_ = 10 ** decimals_; + + if (tokenAmount_ <= oneToken_) { + return 0; + } + + return (tokenAmount_ / oneToken_).log2(); + } + + function calculateVotingPowerThreshold(uint256 totalSupply_, uint8 decimals_) external pure returns (uint256) { + uint256 oneToken_ = 10 ** decimals_; + + if (totalSupply_ <= oneToken_) { + return 0; + } + + return (totalSupply_ / oneToken_).log10(); + } +} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/contracts/Contracts.sol b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/contracts/Contracts.sol deleted file mode 100644 index d05c1b00..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/contracts/Contracts.sol +++ /dev/null @@ -1,56 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; - -contract Contract {} - -contract ContractWithPayableConstructor { - constructor() payable {} -} - -contract ContractWithConstructorArguments { - string public name; - - constructor(string memory _name) { - name = _name; - } -} - -contract ContractWithExternalLibrary { - function lib() external pure returns (uint256) { - return Library1.lib(); - } - - function lib2() external pure returns (uint256) { - return Library2.lib(); - } - - function lib3() external pure returns (uint256) { - return Library3.libInternal(); - } - - function lib4() external pure returns (uint256) { - return Library2.libInternal(); - } -} - -library Library1 { - function lib() external pure returns (uint256) { - return 1; - } -} - -library Library2 { - function lib() external pure returns (uint256) { - return 2; - } - - function libInternal() internal pure returns (uint256) { - return 3; - } -} - -library Library3 { - function libInternal() internal pure returns (uint256) { - return 3; - } -} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/contracts/GovToken.sol b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/contracts/GovToken.sol new file mode 100644 index 00000000..7f4cc7d7 --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/contracts/GovToken.sol @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.7.0 <0.9.0; + +import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; +import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol"; +import {ERC20Votes, ERC20} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol"; + +import {VotingPowerLib} from "./libs/VotingPowerLib.sol"; +import {TimestampClockLib} from "./libs/TimestampClockLib.sol"; + +/** +* @title GovToken +* +* @notice This is an ERC20 token that includes vote delegation. +* It is intentionally designed with added complexity for testing purposes. +*/ +contract GovToken is ERC20Votes, Ownable { + using VotingPowerLib for uint256; + + constructor(string memory name_, string memory symbol_) ERC20(name_, symbol_) EIP712(name_, version()) Ownable(msg.sender) { + _mint(msg.sender, 1000000); + } + + function decimals() public pure override returns (uint8) { + return 3; + } + + function version() public pure returns (string memory) { + return "1"; + } + + function mint(address to_, uint256 amount_) external onlyOwner { + _mint(to_, amount_); + } + + function burn(address from_, uint256 amount_) external onlyOwner { + _burn(from_, amount_); + } + + function getUserVotingPower(address account_) public view returns (uint256) { + return getVotes(account_).calculateUserVotingPower(decimals()); + } + + function getPastUserVotingPower(address account_, uint256 timestamp_) public view returns (uint256) { + return getPastVotes(account_, timestamp_).calculateUserVotingPower(decimals()); + } + + function getVotingPowerThreshold() public view returns (uint256) { + return _getTotalSupply().calculateVotingPowerThreshold(decimals()); + } + + function getPastVotingPowerThreshold(uint256 timestamp_) public view returns (uint256) { + return getPastTotalSupply(timestamp_).calculateVotingPowerThreshold(decimals()); + } + + function clock() public view override returns (uint48) { + return TimestampClockLib.clock(); + } + + function CLOCK_MODE() public view override returns (string memory) { + return TimestampClockLib.CLOCK_MODE(); + } +} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/contracts/libs/TimestampClockLib.sol b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/contracts/libs/TimestampClockLib.sol new file mode 100644 index 00000000..3517a813 --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/contracts/libs/TimestampClockLib.sol @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.7.0 <0.9.0; + +import {Time} from "@openzeppelin/contracts/utils/types/Time.sol"; +import {Votes} from "@openzeppelin/contracts/governance/utils/Votes.sol"; + +library TimestampClockLib { + using Time for *; + + function clock() public view returns (uint48) { + return Time.timestamp(); + } + + function CLOCK_MODE() public view returns (string memory) { + if (clock() != Time.timestamp()) { + revert Votes.ERC6372InconsistentClock(); + } + return "mode=timestamp"; + } +} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/contracts/libs/VotingPowerLib.sol b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/contracts/libs/VotingPowerLib.sol new file mode 100644 index 00000000..1480bc7f --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/contracts/libs/VotingPowerLib.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.7.0 <0.9.0; + +import "@openzeppelin/contracts/utils/math/Math.sol"; + +library VotingPowerLib { + using Math for *; + + function calculateUserVotingPower(uint256 tokenAmount_, uint8 decimals_) external pure returns (uint256) { + uint256 oneToken_ = 10 ** decimals_; + + if (tokenAmount_ <= oneToken_) { + return 0; + } + + return (tokenAmount_ / oneToken_).log2(); + } + + function calculateVotingPowerThreshold(uint256 totalSupply_, uint8 decimals_) external pure returns (uint256) { + uint256 oneToken_ = 10 ** decimals_; + + if (totalSupply_ <= oneToken_) { + return 0; + } + + return (totalSupply_ / oneToken_).log10(); + } +} diff --git a/test/fixture-projects/hardhat-project-minimal/contracts/Contracts.sol b/test/fixture-projects/hardhat-project-minimal/contracts/Contracts.sol deleted file mode 100644 index 812e3389..00000000 --- a/test/fixture-projects/hardhat-project-minimal/contracts/Contracts.sol +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; - -contract Contract {} - -contract ContractWithPayableConstructor { - constructor() payable {} -} - -contract ContractWithConstructorArguments { - string public name; - - constructor(string memory _name) { - name = _name; - } -} - -library Library { - function lib() external pure {} -} diff --git a/test/fixture-projects/hardhat-project-minimal/contracts/GovToken.sol b/test/fixture-projects/hardhat-project-minimal/contracts/GovToken.sol new file mode 100644 index 00000000..7f4cc7d7 --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal/contracts/GovToken.sol @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.7.0 <0.9.0; + +import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; +import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol"; +import {ERC20Votes, ERC20} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol"; + +import {VotingPowerLib} from "./libs/VotingPowerLib.sol"; +import {TimestampClockLib} from "./libs/TimestampClockLib.sol"; + +/** +* @title GovToken +* +* @notice This is an ERC20 token that includes vote delegation. +* It is intentionally designed with added complexity for testing purposes. +*/ +contract GovToken is ERC20Votes, Ownable { + using VotingPowerLib for uint256; + + constructor(string memory name_, string memory symbol_) ERC20(name_, symbol_) EIP712(name_, version()) Ownable(msg.sender) { + _mint(msg.sender, 1000000); + } + + function decimals() public pure override returns (uint8) { + return 3; + } + + function version() public pure returns (string memory) { + return "1"; + } + + function mint(address to_, uint256 amount_) external onlyOwner { + _mint(to_, amount_); + } + + function burn(address from_, uint256 amount_) external onlyOwner { + _burn(from_, amount_); + } + + function getUserVotingPower(address account_) public view returns (uint256) { + return getVotes(account_).calculateUserVotingPower(decimals()); + } + + function getPastUserVotingPower(address account_, uint256 timestamp_) public view returns (uint256) { + return getPastVotes(account_, timestamp_).calculateUserVotingPower(decimals()); + } + + function getVotingPowerThreshold() public view returns (uint256) { + return _getTotalSupply().calculateVotingPowerThreshold(decimals()); + } + + function getPastVotingPowerThreshold(uint256 timestamp_) public view returns (uint256) { + return getPastTotalSupply(timestamp_).calculateVotingPowerThreshold(decimals()); + } + + function clock() public view override returns (uint48) { + return TimestampClockLib.clock(); + } + + function CLOCK_MODE() public view override returns (string memory) { + return TimestampClockLib.CLOCK_MODE(); + } +} diff --git a/test/fixture-projects/hardhat-project-minimal/contracts/libs/TimestampClockLib.sol b/test/fixture-projects/hardhat-project-minimal/contracts/libs/TimestampClockLib.sol new file mode 100644 index 00000000..3517a813 --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal/contracts/libs/TimestampClockLib.sol @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.7.0 <0.9.0; + +import {Time} from "@openzeppelin/contracts/utils/types/Time.sol"; +import {Votes} from "@openzeppelin/contracts/governance/utils/Votes.sol"; + +library TimestampClockLib { + using Time for *; + + function clock() public view returns (uint48) { + return Time.timestamp(); + } + + function CLOCK_MODE() public view returns (string memory) { + if (clock() != Time.timestamp()) { + revert Votes.ERC6372InconsistentClock(); + } + return "mode=timestamp"; + } +} diff --git a/test/fixture-projects/hardhat-project-minimal/contracts/libs/VotingPowerLib.sol b/test/fixture-projects/hardhat-project-minimal/contracts/libs/VotingPowerLib.sol new file mode 100644 index 00000000..1480bc7f --- /dev/null +++ b/test/fixture-projects/hardhat-project-minimal/contracts/libs/VotingPowerLib.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.7.0 <0.9.0; + +import "@openzeppelin/contracts/utils/math/Math.sol"; + +library VotingPowerLib { + using Math for *; + + function calculateUserVotingPower(uint256 tokenAmount_, uint8 decimals_) external pure returns (uint256) { + uint256 oneToken_ = 10 ** decimals_; + + if (tokenAmount_ <= oneToken_) { + return 0; + } + + return (tokenAmount_ / oneToken_).log2(); + } + + function calculateVotingPowerThreshold(uint256 totalSupply_, uint8 decimals_) external pure returns (uint256) { + uint256 oneToken_ = 10 ** decimals_; + + if (totalSupply_ <= oneToken_) { + return 0; + } + + return (totalSupply_ / oneToken_).log10(); + } +} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/Contracts.sol b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/Contracts.sol deleted file mode 100644 index d05c1b00..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/Contracts.sol +++ /dev/null @@ -1,56 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; - -contract Contract {} - -contract ContractWithPayableConstructor { - constructor() payable {} -} - -contract ContractWithConstructorArguments { - string public name; - - constructor(string memory _name) { - name = _name; - } -} - -contract ContractWithExternalLibrary { - function lib() external pure returns (uint256) { - return Library1.lib(); - } - - function lib2() external pure returns (uint256) { - return Library2.lib(); - } - - function lib3() external pure returns (uint256) { - return Library3.libInternal(); - } - - function lib4() external pure returns (uint256) { - return Library2.libInternal(); - } -} - -library Library1 { - function lib() external pure returns (uint256) { - return 1; - } -} - -library Library2 { - function lib() external pure returns (uint256) { - return 2; - } - - function libInternal() internal pure returns (uint256) { - return 3; - } -} - -library Library3 { - function libInternal() internal pure returns (uint256) { - return 3; - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/Contracts2.sol b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/Contracts2.sol deleted file mode 100644 index d05c1b00..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/Contracts2.sol +++ /dev/null @@ -1,56 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; - -contract Contract {} - -contract ContractWithPayableConstructor { - constructor() payable {} -} - -contract ContractWithConstructorArguments { - string public name; - - constructor(string memory _name) { - name = _name; - } -} - -contract ContractWithExternalLibrary { - function lib() external pure returns (uint256) { - return Library1.lib(); - } - - function lib2() external pure returns (uint256) { - return Library2.lib(); - } - - function lib3() external pure returns (uint256) { - return Library3.libInternal(); - } - - function lib4() external pure returns (uint256) { - return Library2.libInternal(); - } -} - -library Library1 { - function lib() external pure returns (uint256) { - return 1; - } -} - -library Library2 { - function lib() external pure returns (uint256) { - return 2; - } - - function libInternal() internal pure returns (uint256) { - return 3; - } -} - -library Library3 { - function libInternal() internal pure returns (uint256) { - return 3; - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/GovToken.sol b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/GovToken.sol new file mode 100644 index 00000000..7f4cc7d7 --- /dev/null +++ b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/GovToken.sol @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.7.0 <0.9.0; + +import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; +import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol"; +import {ERC20Votes, ERC20} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol"; + +import {VotingPowerLib} from "./libs/VotingPowerLib.sol"; +import {TimestampClockLib} from "./libs/TimestampClockLib.sol"; + +/** +* @title GovToken +* +* @notice This is an ERC20 token that includes vote delegation. +* It is intentionally designed with added complexity for testing purposes. +*/ +contract GovToken is ERC20Votes, Ownable { + using VotingPowerLib for uint256; + + constructor(string memory name_, string memory symbol_) ERC20(name_, symbol_) EIP712(name_, version()) Ownable(msg.sender) { + _mint(msg.sender, 1000000); + } + + function decimals() public pure override returns (uint8) { + return 3; + } + + function version() public pure returns (string memory) { + return "1"; + } + + function mint(address to_, uint256 amount_) external onlyOwner { + _mint(to_, amount_); + } + + function burn(address from_, uint256 amount_) external onlyOwner { + _burn(from_, amount_); + } + + function getUserVotingPower(address account_) public view returns (uint256) { + return getVotes(account_).calculateUserVotingPower(decimals()); + } + + function getPastUserVotingPower(address account_, uint256 timestamp_) public view returns (uint256) { + return getPastVotes(account_, timestamp_).calculateUserVotingPower(decimals()); + } + + function getVotingPowerThreshold() public view returns (uint256) { + return _getTotalSupply().calculateVotingPowerThreshold(decimals()); + } + + function getPastVotingPowerThreshold(uint256 timestamp_) public view returns (uint256) { + return getPastTotalSupply(timestamp_).calculateVotingPowerThreshold(decimals()); + } + + function clock() public view override returns (uint48) { + return TimestampClockLib.clock(); + } + + function CLOCK_MODE() public view override returns (string memory) { + return TimestampClockLib.CLOCK_MODE(); + } +} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/another-contracts/Contracts.sol b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/another-contracts/Contracts.sol deleted file mode 100644 index d05c1b00..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/another-contracts/Contracts.sol +++ /dev/null @@ -1,56 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; - -contract Contract {} - -contract ContractWithPayableConstructor { - constructor() payable {} -} - -contract ContractWithConstructorArguments { - string public name; - - constructor(string memory _name) { - name = _name; - } -} - -contract ContractWithExternalLibrary { - function lib() external pure returns (uint256) { - return Library1.lib(); - } - - function lib2() external pure returns (uint256) { - return Library2.lib(); - } - - function lib3() external pure returns (uint256) { - return Library3.libInternal(); - } - - function lib4() external pure returns (uint256) { - return Library2.libInternal(); - } -} - -library Library1 { - function lib() external pure returns (uint256) { - return 1; - } -} - -library Library2 { - function lib() external pure returns (uint256) { - return 2; - } - - function libInternal() internal pure returns (uint256) { - return 3; - } -} - -library Library3 { - function libInternal() internal pure returns (uint256) { - return 3; - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/another-contracts/Contracts2.sol b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/another-contracts/Contracts2.sol deleted file mode 100644 index d05c1b00..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/another-contracts/Contracts2.sol +++ /dev/null @@ -1,56 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; - -contract Contract {} - -contract ContractWithPayableConstructor { - constructor() payable {} -} - -contract ContractWithConstructorArguments { - string public name; - - constructor(string memory _name) { - name = _name; - } -} - -contract ContractWithExternalLibrary { - function lib() external pure returns (uint256) { - return Library1.lib(); - } - - function lib2() external pure returns (uint256) { - return Library2.lib(); - } - - function lib3() external pure returns (uint256) { - return Library3.libInternal(); - } - - function lib4() external pure returns (uint256) { - return Library2.libInternal(); - } -} - -library Library1 { - function lib() external pure returns (uint256) { - return 1; - } -} - -library Library2 { - function lib() external pure returns (uint256) { - return 2; - } - - function libInternal() internal pure returns (uint256) { - return 3; - } -} - -library Library3 { - function libInternal() internal pure returns (uint256) { - return 3; - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/libs/TimestampClockLib.sol b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/libs/TimestampClockLib.sol new file mode 100644 index 00000000..3517a813 --- /dev/null +++ b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/libs/TimestampClockLib.sol @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.7.0 <0.9.0; + +import {Time} from "@openzeppelin/contracts/utils/types/Time.sol"; +import {Votes} from "@openzeppelin/contracts/governance/utils/Votes.sol"; + +library TimestampClockLib { + using Time for *; + + function clock() public view returns (uint48) { + return Time.timestamp(); + } + + function CLOCK_MODE() public view returns (string memory) { + if (clock() != Time.timestamp()) { + revert Votes.ERC6372InconsistentClock(); + } + return "mode=timestamp"; + } +} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/libs/VotingPowerLib.sol b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/libs/VotingPowerLib.sol new file mode 100644 index 00000000..1480bc7f --- /dev/null +++ b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/libs/VotingPowerLib.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.7.0 <0.9.0; + +import "@openzeppelin/contracts/utils/math/Math.sol"; + +library VotingPowerLib { + using Math for *; + + function calculateUserVotingPower(uint256 tokenAmount_, uint8 decimals_) external pure returns (uint256) { + uint256 oneToken_ = 10 ** decimals_; + + if (tokenAmount_ <= oneToken_) { + return 0; + } + + return (tokenAmount_ / oneToken_).log2(); + } + + function calculateVotingPowerThreshold(uint256 totalSupply_, uint8 decimals_) external pure returns (uint256) { + uint256 oneToken_ = 10 ** decimals_; + + if (totalSupply_ <= oneToken_) { + return 0; + } + + return (totalSupply_ / oneToken_).log10(); + } +} From 5c2b8bed21d8c6caac707d3ca3b72d874dfcb57f Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Tue, 19 Dec 2023 23:18:35 +0200 Subject: [PATCH 11/34] Updated CHANGELOG.md --- CHANGELOG.md | 3 ++- test/integration/transaction-storage.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75b47463..1228953b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ ## Version 2.0.0-beta.1 -* Migrated test fixture projects to TypeScript with updated configurations and scripts. +* Migrated test fixture projects to TypeScript, updating configurations and scripts. + Created new fixture contracts for testing and deleted auto-generated files. * Added `TransactionFieldsToSave` as a return value to the `sendNative` function * Added handling of the custom chains specified in the Hardhat config * Refactored the architecture and made it consistent diff --git a/test/integration/transaction-storage.ts b/test/integration/transaction-storage.ts index cabb535e..2c728072 100644 --- a/test/integration/transaction-storage.ts +++ b/test/integration/transaction-storage.ts @@ -67,7 +67,7 @@ describe("TransactionStorage", async () => { assert.equal( await TransactionProcessor?.tryRestoreContractAddressByName( - "contracts/another-contracts/Contracts.sol:ContractWithConstructorArguments", + "contracts/another-contracts/Helper.sol:ContractWithConstructorArguments", ), await contract.getAddress(), ); From 7cbed089e4cea6dcaf0336f59df9898d4739012a Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Thu, 21 Dec 2023 13:56:26 +0200 Subject: [PATCH 12/34] Fixed a bug related to contract recovery when a custom name is used. --- src/deployer/Linker.ts | 44 +++++++++++++++++++---- src/deployer/MinimalContract.ts | 33 +++++++++++------ src/tools/storage/TransactionProcessor.ts | 8 +++++ src/types/tools.ts | 1 + 4 files changed, 68 insertions(+), 18 deletions(-) diff --git a/src/deployer/Linker.ts b/src/deployer/Linker.ts index 6981346d..10b79028 100644 --- a/src/deployer/Linker.ts +++ b/src/deployer/Linker.ts @@ -24,7 +24,7 @@ class LinkerHelper { } public async tryLinkBytecode(contractName: string, bytecode: string, libraries: Libraries): Promise { - const artifact: ArtifactExtended = this._mustGetContractArtifact(contractName); + const artifact: ArtifactExtended = this._mustGetContractArtifact(contractName, bytecode); const neededLibraries = this._cleanNeededLibraries(bytecode, artifact, artifact.neededLibraries); let linksToApply: Map = new Map(); @@ -202,20 +202,50 @@ class LinkerHelper { } } - private _mustGetContractArtifact(contractName: string): ArtifactExtended { - try { - return ArtifactProcessor.tryGetArtifactByName(contractName); - } catch { + private _mustGetContractArtifact(contractName: string, contractBytecode: string): ArtifactExtended { + const artifact = this._getContractFromStorage(contractName, contractBytecode); + + if (!artifact) { throw new MigrateError(`Contract artifact of ${contractName} not found. Linking cannot be performed.`); } + + return artifact; } private _mustGetLibraryArtifact(libraryName: string): ArtifactExtended { + const artifact = this._getContractFromStorage(libraryName); + + if (!artifact) { + throw new MigrateError(`Library artifact of ${libraryName} not found. Linking cannot be performed.`); + } + + return artifact; + } + + private _getContractFromStorage(contractName: string, contractBytecode?: string): ArtifactExtended | null { try { - return ArtifactProcessor.tryGetArtifactByName(libraryName); + return ArtifactProcessor.tryGetArtifactByName(contractName); } catch { - throw new MigrateError(`Library artifact of ${libraryName} not found. Linking cannot be performed.`); + /* ignore */ } + + try { + const txData = TransactionProcessor?.tryRestoreSavedDeployedTxByContractName(contractName); + + return ArtifactProcessor.tryGetArtifactByName(txData!.metadata.fullyQualifiedContractName!); + } catch { + /* ignore */ + } + + if (contractBytecode) { + try { + return ArtifactProcessor.tryGetArtifactByBytecode(contractBytecode); + } catch { + /* ignore */ + } + } + + return null; } } diff --git a/src/deployer/MinimalContract.ts b/src/deployer/MinimalContract.ts index 1a6fefb9..993680d1 100644 --- a/src/deployer/MinimalContract.ts +++ b/src/deployer/MinimalContract.ts @@ -117,6 +117,7 @@ export class MinimalContract { const saveMetadata: MigrationMetadata = { migrationNumber: Stats.currentMigration, contractName: tx.contractName, + fullyQualifiedContractName: this.getFullyQualifiedName(tx) || undefined, }; TransactionProcessor?.saveDeploymentTransaction(tx, tx.contractName, contractAddress, saveMetadata); @@ -129,21 +130,31 @@ export class MinimalContract { return; } - try { - let contractName = tx.contractName; + const contractName = this.getFullyQualifiedName(tx); + + if (contractName === null) { + Reporter!.reportVerificationFailedToSave(tx.contractName); + + return; + } + + VerificationProcessor.saveVerificationFunction({ + contractAddress, + contractName: contractName, + constructorArguments: args, + chainId: Number(await getChainId()), + }); + } - if (!isFullyQualifiedName(contractName)) { - contractName = ArtifactProcessor.tryGetContractName(this._rawBytecode); + private getFullyQualifiedName(tx: ContractDeployTxWithName): string | null { + try { + if (!isFullyQualifiedName(tx.contractName)) { + return ArtifactProcessor.tryGetContractName(this._rawBytecode); } - VerificationProcessor.saveVerificationFunction({ - contractAddress, - contractName: contractName, - constructorArguments: args, - chainId: Number(await getChainId()), - }); + return tx.contractName; } catch { - Reporter!.reportVerificationFailedToSave(tx.contractName); + return null; } } } diff --git a/src/tools/storage/TransactionProcessor.ts b/src/tools/storage/TransactionProcessor.ts index 6ed0561b..46d33a65 100644 --- a/src/tools/storage/TransactionProcessor.ts +++ b/src/tools/storage/TransactionProcessor.ts @@ -52,6 +52,10 @@ export class BaseTransactionProcessor { this._saveContract(keyByArgs, dataToSave); this._saveContractByName(contractName, dataToSave); + + if (metadata.fullyQualifiedContractName) { + TransactionStorage.set(metadata.fullyQualifiedContractName, dataToSave, true); + } } /** @@ -121,6 +125,10 @@ export class BaseTransactionProcessor { ); } + public tryRestoreSavedDeployedTxByContractName(contractName: string): ContractFieldsToSave { + return this._tryGetDataFromStorage(contractName); + } + private _saveTransaction( args: KeyTransactionFields, transaction: TransactionReceiptParams | TransactionReceipt, diff --git a/src/types/tools.ts b/src/types/tools.ts index 5d65a6d1..cb426957 100644 --- a/src/types/tools.ts +++ b/src/types/tools.ts @@ -30,6 +30,7 @@ export interface ContractFieldsToSave { export interface MigrationMetadata { migrationNumber: number; + fullyQualifiedContractName?: string; contractName?: string; methodName?: string; } From fe4b2408838ae357f3dc5c313882704dd9d775c2 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Thu, 21 Dec 2023 13:58:23 +0200 Subject: [PATCH 13/34] Added .prettierignore --- .prettierignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..cfc1e9c9 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +typechain-types From d4f9759a9d3bf5b26af29c702d593eaec5e671c3 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Thu, 21 Dec 2023 13:58:54 +0200 Subject: [PATCH 14/34] Updated CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1228953b..409cd6aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Version 2.0.0-beta.1 +* Fixed a bug related to contract recovery when a custom name is used. * Migrated test fixture projects to TypeScript, updating configurations and scripts. Created new fixture contracts for testing and deleted auto-generated files. * Added `TransactionFieldsToSave` as a return value to the `sendNative` function From 6e296a47bdc8fbb3e02365e2d9a6988970c7b653 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Thu, 21 Dec 2023 20:52:45 +0200 Subject: [PATCH 15/34] Fixed bugs related to the recovery of contract names. --- src/deployer/Deployer.ts | 6 +++--- src/deployer/Linker.ts | 11 +++++------ src/deployer/MinimalContract.ts | 15 +++++++++------ src/deployer/adapters/AbstractEthersAdapter.ts | 4 ++-- src/deployer/adapters/Adapter.ts | 5 +++-- src/deployer/adapters/EthersFactoryAdapter.ts | 12 +++++++++++- src/deployer/adapters/TruffleAdapter.ts | 10 ++-------- src/migrator/Migrator.ts | 6 +++--- src/tools/reporters/Reporter.ts | 4 ++++ src/tools/runners/TransactionRunner.ts | 4 ++++ src/tools/storage/ArtifactProcessor.ts | 18 ++++++++++++++++++ src/tools/storage/MigrateStorage.ts | 10 +++++++++- src/utils.ts | 5 +++++ 13 files changed, 78 insertions(+), 32 deletions(-) diff --git a/src/deployer/Deployer.ts b/src/deployer/Deployer.ts index e840d612..6a4fa6c7 100644 --- a/src/deployer/Deployer.ts +++ b/src/deployer/Deployer.ts @@ -135,7 +135,7 @@ export class Deployer { public static resolveAdapter(hre: HardhatRuntimeEnvironment, contract: Instance): Adapter { if (isEthersContract(contract)) { - return new EthersContractAdapter(hre.config.migrate); + return new EthersContractAdapter(hre); } if (isTruffleFactory(contract)) { @@ -143,11 +143,11 @@ export class Deployer { } if (isBytecodeFactory(contract)) { - return new BytecodeAdapter(hre.config.migrate); + return new BytecodeAdapter(hre); } if (isContractFactory(contract)) { - return new EthersFactoryAdapter(hre.config.migrate); + return new EthersFactoryAdapter(hre); } throw new MigrateError("Unknown Contract Factory Type"); diff --git a/src/deployer/Linker.ts b/src/deployer/Linker.ts index 10b79028..01c9a4d4 100644 --- a/src/deployer/Linker.ts +++ b/src/deployer/Linker.ts @@ -1,6 +1,6 @@ import { isAddress, resolveAddress } from "ethers"; -import { Artifact, Libraries } from "hardhat/types"; +import { Artifact, HardhatRuntimeEnvironment, Libraries } from "hardhat/types"; import { MinimalContract } from "./MinimalContract"; @@ -8,7 +8,6 @@ import { MigrateError } from "../errors"; import { catchError } from "../utils"; -import { MigrateConfig } from "../types/migrations"; import { ArtifactExtended, Link, NeededLibrary } from "../types/deployer"; import { Reporter } from "../tools/reporters/Reporter"; @@ -17,7 +16,7 @@ import { TransactionProcessor } from "../tools/storage/TransactionProcessor"; @catchError class LinkerHelper { - constructor(private _config: MigrateConfig) {} + constructor(private _hre: HardhatRuntimeEnvironment) {} public isBytecodeNeedsLinking(bytecode: string): boolean { return bytecode.indexOf("__") === -1; @@ -194,7 +193,7 @@ class LinkerHelper { // https://github.com/ethers-io/ethers.js/issues/2431 // https://github.com/ethers-io/ethers.js/issues/1126 - const core = new MinimalContract(this._config, artifact.bytecode, artifact.abi, libraryName); + const core = new MinimalContract(this._hre, artifact.bytecode, artifact.abi, libraryName); Reporter!.notifyDeploymentOfMissingLibrary(libraryName); @@ -251,10 +250,10 @@ class LinkerHelper { export let Linker: LinkerHelper | null = null; -export function createLinker(config: MigrateConfig) { +export function createLinker(hre: HardhatRuntimeEnvironment) { if (Linker) { return; } - Linker = new LinkerHelper(config); + Linker = new LinkerHelper(hre); } diff --git a/src/deployer/MinimalContract.ts b/src/deployer/MinimalContract.ts index 993680d1..4a2bf25a 100644 --- a/src/deployer/MinimalContract.ts +++ b/src/deployer/MinimalContract.ts @@ -1,5 +1,7 @@ import { ethers, InterfaceAbi, Overrides, Signer } from "ethers"; +import { HardhatRuntimeEnvironment } from "hardhat/types"; + import { isFullyQualifiedName } from "hardhat/utils/contract-names"; import { Linker } from "./Linker"; @@ -9,7 +11,6 @@ import { catchError, fillParameters, getChainId, getInterfaceOnlyWithConstructor import { MigrateError } from "../errors"; import { MigrationMetadata } from "../types/tools"; -import { MigrateConfig } from "../types/migrations"; import { ContractDeployTxWithName, OverridesAndLibs } from "../types/deployer"; import { Stats } from "../tools/Stats"; @@ -25,7 +26,7 @@ export class MinimalContract { private readonly _interface; constructor( - private readonly _config: MigrateConfig, + private readonly _hre: HardhatRuntimeEnvironment, private _bytecode: string, private readonly _abi: InterfaceAbi, private readonly _contractName: string = "", @@ -49,7 +50,7 @@ export class MinimalContract { const tx = await this._createDeployTransaction(args, parameters); - if (this._config.continue) { + if (this._hre.config.migrate.continue) { return this._recoverContractAddress(tx, args); } else { return this._processContractDeploymentTransaction(tx, args); @@ -117,7 +118,7 @@ export class MinimalContract { const saveMetadata: MigrationMetadata = { migrationNumber: Stats.currentMigration, contractName: tx.contractName, - fullyQualifiedContractName: this.getFullyQualifiedName(tx) || undefined, + fullyQualifiedContractName: this._getFullyQualifiedName(tx) || undefined, }; TransactionProcessor?.saveDeploymentTransaction(tx, tx.contractName, contractAddress, saveMetadata); @@ -130,7 +131,7 @@ export class MinimalContract { return; } - const contractName = this.getFullyQualifiedName(tx); + const contractName = this._getFullyQualifiedName(tx); if (contractName === null) { Reporter!.reportVerificationFailedToSave(tx.contractName); @@ -144,9 +145,11 @@ export class MinimalContract { constructorArguments: args, chainId: Number(await getChainId()), }); + + await ArtifactProcessor.saveArtifactIfNotExist(this._hre, contractName, this._rawBytecode); } - private getFullyQualifiedName(tx: ContractDeployTxWithName): string | null { + private _getFullyQualifiedName(tx: ContractDeployTxWithName): string | null { try { if (!isFullyQualifiedName(tx.contractName)) { return ArtifactProcessor.tryGetContractName(this._rawBytecode); diff --git a/src/deployer/adapters/AbstractEthersAdapter.ts b/src/deployer/adapters/AbstractEthersAdapter.ts index 3a90fd67..caf3cdef 100644 --- a/src/deployer/adapters/AbstractEthersAdapter.ts +++ b/src/deployer/adapters/AbstractEthersAdapter.ts @@ -39,7 +39,7 @@ export abstract class AbstractEthersAdapter extends Adapter { public async fromInstance(instance: Factory, parameters: OverridesAndName): Promise { return new MinimalContract( - this._config, + this._hre, this.getRawBytecode(instance), this.getRawAbi(instance), this.getContractName(instance, parameters), @@ -133,7 +133,7 @@ export abstract class AbstractEthersAdapter extends Adapter { const keyFields = this._getKeyFieldsFromTransaction(tx); - if (this._config.continue) { + if (this._hre.config.migrate.continue) { return this._recoverTransaction(methodString, keyFields, oldMethod, args); } diff --git a/src/deployer/adapters/Adapter.ts b/src/deployer/adapters/Adapter.ts index 5a0cc5b5..4636b07c 100644 --- a/src/deployer/adapters/Adapter.ts +++ b/src/deployer/adapters/Adapter.ts @@ -1,16 +1,17 @@ import { Interface } from "ethers"; +import { HardhatRuntimeEnvironment } from "hardhat/types"; + import { MinimalContract } from "../MinimalContract"; import { catchError } from "../../utils"; import { Instance } from "../../types/adapter"; -import { MigrateConfig } from "../../types/migrations"; import { OverridesAndLibs, OverridesAndName } from "../../types/deployer"; @catchError export abstract class Adapter { - public constructor(protected _config: MigrateConfig) {} + public constructor(protected _hre: HardhatRuntimeEnvironment) {} public abstract fromInstance(instance: Instance, parameters: OverridesAndName): Promise; diff --git a/src/deployer/adapters/EthersFactoryAdapter.ts b/src/deployer/adapters/EthersFactoryAdapter.ts index 4889fd2d..aac28cea 100644 --- a/src/deployer/adapters/EthersFactoryAdapter.ts +++ b/src/deployer/adapters/EthersFactoryAdapter.ts @@ -2,6 +2,8 @@ import { Addressable, ContractFactory, Interface } from "ethers"; import { AbstractEthersAdapter } from "./AbstractEthersAdapter"; +import { OverridesAndName } from "../../types/deployer"; + import { catchError } from "../../utils"; import { UNKNOWN_CONTRACT_NAME } from "../../constants"; @@ -18,10 +20,18 @@ export class EthersFactoryAdapter extends AbstractEthersAdapter { return JSON.stringify(instance.interface.fragments); } - public getContractName(instance: ContractFactory): string { + public getContractName(instance: ContractFactory, parameters: OverridesAndName): string { + if (parameters.name) { + return parameters.name; + } + try { return ArtifactProcessor.tryGetContractName(this.getRawBytecode(instance)); } catch { + if ((instance as any).contractName) { + return (instance as any).contractName; + } + return UNKNOWN_CONTRACT_NAME; } } diff --git a/src/deployer/adapters/TruffleAdapter.ts b/src/deployer/adapters/TruffleAdapter.ts index 5d1216e0..1b273e35 100644 --- a/src/deployer/adapters/TruffleAdapter.ts +++ b/src/deployer/adapters/TruffleAdapter.ts @@ -8,8 +8,6 @@ import { Interface, } from "ethers"; -import { HardhatRuntimeEnvironment } from "hardhat/types"; - import { TruffleContract } from "@nomiclabs/hardhat-truffle5/dist/src/types"; import { Adapter } from "./Adapter"; @@ -32,16 +30,12 @@ import { TransactionProcessor } from "../../tools/storage/TransactionProcessor"; @catchError export class TruffleAdapter extends Adapter { - constructor(private _hre: HardhatRuntimeEnvironment) { - super(_hre.config.migrate); - } - public async fromInstance( instance: EthersContract, parameters: OverridesAndName, ): Promise { return new MinimalContract( - this._config, + this._hre, this.getRawBytecode(instance), this.getRawAbi(instance), this.getContractName(instance, parameters), @@ -148,7 +142,7 @@ export class TruffleAdapter extends Adapter { const methodString = getMethodString(contractName, methodName, contractMethod.fragment, args); - if (this._config.continue) { + if (this._hre.config.migrate.continue) { return this._recoverTransaction(methodString, keyFields, contractMethod.send, args); } diff --git a/src/migrator/Migrator.ts b/src/migrator/Migrator.ts index 311d1d08..19a25044 100644 --- a/src/migrator/Migrator.ts +++ b/src/migrator/Migrator.ts @@ -24,7 +24,7 @@ import { createAndInitReporter, Reporter } from "../tools/reporters/Reporter"; import { buildNetworkDeps } from "../tools/network/NetworkManager"; -import { DefaultStorage } from "../tools/storage/MigrateStorage"; +import { clearAllStorage } from "../tools/storage/MigrateStorage"; import { ArtifactProcessor } from "../tools/storage/ArtifactProcessor"; import { createTransactionProcessor } from "../tools/storage/TransactionProcessor"; @@ -109,14 +109,14 @@ export class Migrator { } public static async buildMigrateTaskDeps(hre: HardhatRuntimeEnvironment): Promise { - createLinker(hre.config.migrate); + createLinker(hre); createTransactionProcessor(hre.config.migrate); buildNetworkDeps(hre); await createAndInitReporter(hre); if (!hre.config.migrate.continue) { - DefaultStorage.clearAll(); + clearAllStorage(); } await ArtifactProcessor.parseArtifacts(hre); diff --git a/src/tools/reporters/Reporter.ts b/src/tools/reporters/Reporter.ts index 73ebe81e..d4da7d37 100644 --- a/src/tools/reporters/Reporter.ts +++ b/src/tools/reporters/Reporter.ts @@ -453,3 +453,7 @@ export async function createAndInitReporter(hre: HardhatRuntimeEnvironment) { await Reporter.init(hre); } + +export function resetReporter() { + Reporter = null; +} diff --git a/src/tools/runners/TransactionRunner.ts b/src/tools/runners/TransactionRunner.ts index f858c2a4..f2c553e0 100644 --- a/src/tools/runners/TransactionRunner.ts +++ b/src/tools/runners/TransactionRunner.ts @@ -76,3 +76,7 @@ export function createTransactionRunner(hre: HardhatRuntimeEnvironment) { TransactionRunner = new BaseTransactionRunner(hre.config.migrate); } + +export function resetTransactionRunner() { + TransactionRunner = null; +} diff --git a/src/tools/storage/ArtifactProcessor.ts b/src/tools/storage/ArtifactProcessor.ts index 8670b59b..317e9709 100644 --- a/src/tools/storage/ArtifactProcessor.ts +++ b/src/tools/storage/ArtifactProcessor.ts @@ -1,5 +1,7 @@ import { Artifact, HardhatRuntimeEnvironment } from "hardhat/types"; +import { isFullyQualifiedName } from "hardhat/utils/contract-names"; + import { ArtifactStorage } from "./MigrateStorage"; import { MigrateError } from "../../errors"; @@ -32,6 +34,22 @@ class BaseArtifactProcessor { } } + public async saveArtifactIfNotExist( + _hre: HardhatRuntimeEnvironment, + contractName: string, + bytecode?: string, + ): Promise { + if (!isFullyQualifiedName(contractName) || (bytecode ? true : ArtifactStorage.get(bytecodeHash(bytecode!)))) { + return; + } + + const artifact = await _hre.artifacts.readArtifact(contractName); + + const contract: ArtifactExtended = { ...artifact, neededLibraries: this._parseLibrariesOfArtifact(artifact) }; + + ArtifactStorage.set(bytecode ? bytecodeHash(bytecode) : bytecodeHash(artifact.bytecode), contract, true); + } + public tryGetArtifactByName(contractName: string): ArtifactExtended { const artifact = ArtifactStorage.get(contractName); diff --git a/src/tools/storage/MigrateStorage.ts b/src/tools/storage/MigrateStorage.ts index 7e2e0cdb..4ed2f98c 100644 --- a/src/tools/storage/MigrateStorage.ts +++ b/src/tools/storage/MigrateStorage.ts @@ -10,7 +10,7 @@ import { StorageNamespaces } from "../../types/tools"; @catchError class BaseStorage { - private readonly _fileName = ".storage.json"; + private readonly _fileName = ".migrate.storage.json"; protected _state: Record = lazyObject(() => this._readFullStateFromFile()); @@ -110,3 +110,11 @@ export const UserStorage = lazyObject(() => new MigrateStorage(StorageNamespaces export const TransactionStorage = lazyObject(() => new MigrateStorage(StorageNamespaces.Transactions)); export const ArtifactStorage = lazyObject(() => new MigrateStorage(StorageNamespaces.Artifacts)); export const VerificationStorage = lazyObject(() => new MigrateStorage(StorageNamespaces.Verification)); + +export function clearAllStorage(): void { + DefaultStorage.clearAll(); + UserStorage.clearAll(); + TransactionStorage.clearAll(); + ArtifactStorage.clearAll(); + VerificationStorage.clearAll(); +} diff --git a/src/utils.ts b/src/utils.ts index 381a5c79..000d4fc3 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -19,6 +19,7 @@ import { isBytes } from "@ethersproject/bytes"; import { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; import { MigrateError } from "./errors"; +import { UNKNOWN_CONTRACT_NAME } from "./constants"; import { Bytecode } from "./types/deployer"; import { KeyDeploymentFields, KeyTransactionFields } from "./types/tools"; @@ -137,6 +138,10 @@ export function getMethodString( methodFragment: FunctionFragment = {} as FunctionFragment, args: any[] = [], ): string { + if (contractName === UNKNOWN_CONTRACT_NAME) { + contractName = "Unidentified Contract"; + } + if (methodFragment.inputs === undefined) { return `${contractName}.${methodName}()`; } From 245d75ea8eec155b8975b0cae161b83b5a259e8e Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Thu, 21 Dec 2023 20:52:56 +0200 Subject: [PATCH 16/34] Updated packages versions --- package-lock.json | 143 +++++++++++++++++++++++++++++++++++----------- package.json | 15 ++--- 2 files changed, 118 insertions(+), 40 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5d165ffd..24db9f24 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,14 +26,14 @@ "@openzeppelin/contracts": "^5.0.1", "@typechain/ethers-v6": "^0.5.0", "@typechain/hardhat": "^9.1.0", - "@typechain/truffle-v5": "^8.0.6", - "@types/chai": "^4.3.4", - "@types/chai-as-promised": "^7.1.1", - "@types/mocha": "^9.1.0", + "@typechain/truffle-v5": "8.0.6", + "@types/chai": "^4.3.11", + "@types/chai-as-promised": "^7.1.8", + "@types/mocha": "^10.0.6", "@types/ora": "^3.2.0", "@typescript-eslint/eslint-plugin": "^6.6.0", "@typescript-eslint/parser": "^6.6.0", - "chai": "^4.3.7", + "chai": "^4.3.10", "chai-as-promised": "^7.1.1", "eslint": "^8.48.0", "eslint-plugin-import": "^2.28.1", @@ -41,7 +41,8 @@ "eslint-plugin-promise": "^6.1.1", "ethers": "^6.8.0", "hardhat": "^2.17.0", - "mocha": "^10.0.0", + "hardhat-abi-exporter": "^2.10.1", + "mocha": "^10.2.0", "pinst": "^3.0.0", "prettier": "^3.0.3", "ts-node": "^8.1.0", @@ -4878,9 +4879,9 @@ } }, "node_modules/@typechain/truffle-v5": { - "version": "8.0.7", - "resolved": "https://registry.npmjs.org/@typechain/truffle-v5/-/truffle-v5-8.0.7.tgz", - "integrity": "sha512-zdc71/G8Zs3RZCmUCKDAXlUUGbom/GZFCgjXX8e0LEh1/eFWtdMSgiK5bluLEpLoP+rKUcJuQtCO68IQ6dboQg==", + "version": "8.0.6", + "resolved": "https://registry.npmjs.org/@typechain/truffle-v5/-/truffle-v5-8.0.6.tgz", + "integrity": "sha512-0G8rAQVpJcW2rCJUMBfq/D4FxWk3sBwxzywUYQc0vngV514Yv1JtU8L3W0lNjXoDRjABdNzksrZ0He6IcxFDpw==", "dev": true, "dependencies": { "lodash": "^4.17.15" @@ -5067,9 +5068,9 @@ "peer": true }, "node_modules/@types/mocha": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.1.tgz", - "integrity": "sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==", + "version": "10.0.6", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.6.tgz", + "integrity": "sha512-dJvrYWxP/UcXm36Qn36fxhUKu8A/xMRXVT2cliFF1Z7UA9liG5Psj3ezNSZw+5puH2czDXRLcXQxf8JbJt0ejg==", "dev": true }, "node_modules/@types/node": { @@ -7852,6 +7853,36 @@ "node": ">=0.4.0" } }, + "node_modules/delete-empty": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/delete-empty/-/delete-empty-3.0.0.tgz", + "integrity": "sha512-ZUyiwo76W+DYnKsL3Kim6M/UOavPdBJgDYWOmuQhYaZvJH0AXAHbUNyEDtRbBra8wqqr686+63/0azfEk1ebUQ==", + "dev": true, + "dependencies": { + "ansi-colors": "^4.1.0", + "minimist": "^1.2.0", + "path-starts-with": "^2.0.0", + "rimraf": "^2.6.2" + }, + "bin": { + "delete-empty": "bin/cli.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/delete-empty/node_modules/rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -13861,36 +13892,48 @@ } } }, - "node_modules/hardhat-project-defined-config": { - "resolved": "test/fixture-projects/hardhat-project-defined-config", - "link": true + "node_modules/hardhat-abi-exporter": { + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/hardhat-abi-exporter/-/hardhat-abi-exporter-2.10.1.tgz", + "integrity": "sha512-X8GRxUTtebMAd2k4fcPyVnCdPa6dYK4lBsrwzKP5yiSq4i+WadWPIumaLfce53TUf/o2TnLpLOduyO1ylE2NHQ==", + "dev": true, + "dependencies": { + "@ethersproject/abi": "^5.5.0", + "delete-empty": "^3.0.0" + }, + "engines": { + "node": ">=14.14.0" + }, + "peerDependencies": { + "hardhat": "^2.0.0" + } }, - "node_modules/hardhat-project-invalid-config": { - "resolved": "test/fixture-projects/hardhat-project-invalid-config", + "node_modules/hardhat-project": { + "resolved": "test/fixture-projects/hardhat-project", "link": true }, - "node_modules/hardhat-project-minimal": { - "resolved": "test/fixture-projects/hardhat-project-minimal", + "node_modules/hardhat-project-defined-config": { + "resolved": "test/fixture-projects/hardhat-project-defined-config", "link": true }, - "node_modules/hardhat-project-minimal-ethers": { - "resolved": "test/fixture-projects/hardhat-project-minimal-ethers", + "node_modules/hardhat-project-ethers": { + "resolved": "test/fixture-projects/hardhat-project-ethers", "link": true }, - "node_modules/hardhat-project-minimal-truffle": { - "resolved": "test/fixture-projects/hardhat-project-minimal-truffle", + "node_modules/hardhat-project-invalid-config": { + "resolved": "test/fixture-projects/hardhat-project-invalid-config", "link": true }, - "node_modules/hardhat-project-minimal-typechain-ethers": { - "resolved": "test/fixture-projects/hardhat-project-minimal-typechain-ethers", + "node_modules/hardhat-project-pure-bytecode": { + "resolved": "test/fixture-projects/hardhat-project-pure-bytecode", "link": true }, - "node_modules/hardhat-project-minimal-typechain-truffle": { - "resolved": "test/fixture-projects/hardhat-project-minimal-typechain-truffle", + "node_modules/hardhat-project-typechain-ethers": { + "resolved": "test/fixture-projects/hardhat-project-typechain-ethers", "link": true }, - "node_modules/hardhat-project-repeats-typechain-ethers": { - "resolved": "test/fixture-projects/hardhat-project-repeats-typechain-ethers", + "node_modules/hardhat-project-typechain-truffle": { + "resolved": "test/fixture-projects/hardhat-project-typechain-truffle", "link": true }, "node_modules/hardhat-project-undefined-config": { @@ -16959,6 +17002,15 @@ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, + "node_modules/path-starts-with": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-starts-with/-/path-starts-with-2.0.1.tgz", + "integrity": "sha512-wZ3AeiRBRlNwkdUxvBANh0+esnt38DLffHDujZyRHkqkaKHTglnY2EP5UX3b8rdeiSutgO4y9NEJwXezNP5vHg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", @@ -21326,28 +21378,53 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "test/fixture-projects/hardhat-project": { + "version": "1.0.0" + }, "test/fixture-projects/hardhat-project-defined-config": { "version": "1.0.0" }, + "test/fixture-projects/hardhat-project-ethers": { + "version": "1.0.0" + }, "test/fixture-projects/hardhat-project-invalid-config": { "version": "1.0.0" }, "test/fixture-projects/hardhat-project-minimal": { - "version": "1.0.0" + "version": "1.0.0", + "extraneous": true }, "test/fixture-projects/hardhat-project-minimal-ethers": { - "version": "1.0.0" + "version": "1.0.0", + "extraneous": true }, "test/fixture-projects/hardhat-project-minimal-truffle": { - "version": "1.0.0" + "version": "1.0.0", + "extraneous": true }, "test/fixture-projects/hardhat-project-minimal-typechain-ethers": { - "version": "1.0.0" + "version": "1.0.0", + "extraneous": true }, "test/fixture-projects/hardhat-project-minimal-typechain-truffle": { + "version": "1.0.0", + "extraneous": true + }, + "test/fixture-projects/hardhat-project-pure-bytecode": { "version": "1.0.0" }, "test/fixture-projects/hardhat-project-repeats-typechain-ethers": { + "version": "1.0.0", + "extraneous": true + }, + "test/fixture-projects/hardhat-project-truffle": { + "version": "1.0.0", + "extraneous": true + }, + "test/fixture-projects/hardhat-project-typechain-ethers": { + "version": "1.0.0" + }, + "test/fixture-projects/hardhat-project-typechain-truffle": { "version": "1.0.0" }, "test/fixture-projects/hardhat-project-undefined-config": { diff --git a/package.json b/package.json index 059723ab..9e1b9cf9 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "postpack": "pinst --enable", "build": "tsc --build .", "prepare-tests": "npm run compile --workspaces", - "test": "mocha --recursive 'test/**/*.ts' --exit && npm run lint-fix", + "test": "npm run prepare-tests && mocha --recursive 'test/**/*.ts' --exit && npm run lint-fix", "clean-tests": "npm run clean --workspaces", "lint-fix": "prettier --write \"./**/*.ts\" && eslint \"src/**/*.{js,ts}\" --cache --fix", "publish-to-npm": "npm run build && npm run lint-fix && npm publish ./ --access public" @@ -62,14 +62,14 @@ "@openzeppelin/contracts": "^5.0.1", "@typechain/ethers-v6": "^0.5.0", "@typechain/hardhat": "^9.1.0", - "@typechain/truffle-v5": "^8.0.6", - "@types/chai": "^4.3.4", - "@types/chai-as-promised": "^7.1.1", - "@types/mocha": "^9.1.0", + "@typechain/truffle-v5": "^8.0.7", + "@types/chai": "^4.3.11", + "@types/chai-as-promised": "^7.1.8", + "@types/mocha": "^10.0.6", "@types/ora": "^3.2.0", "@typescript-eslint/eslint-plugin": "^6.6.0", "@typescript-eslint/parser": "^6.6.0", - "chai": "^4.3.7", + "chai": "^4.3.10", "chai-as-promised": "^7.1.1", "eslint": "^8.48.0", "eslint-plugin-import": "^2.28.1", @@ -77,7 +77,8 @@ "eslint-plugin-promise": "^6.1.1", "ethers": "^6.8.0", "hardhat": "^2.17.0", - "mocha": "^10.0.0", + "hardhat-abi-exporter": "^2.10.1", + "mocha": "^10.2.0", "pinst": "^3.0.0", "prettier": "^3.0.3", "ts-node": "^8.1.0", From 59f099cb05a692dfadbcf15e7c148ec2a7ff65ec Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Thu, 21 Dec 2023 20:55:02 +0200 Subject: [PATCH 17/34] Revised the test infrastructure and architecture. --- CHANGELOG.md | 2 + .../hardhat.config.ts | 11 +- .../.gitignore | 0 .../contracts/GovToken.sol | 0 .../contracts/libs/TimestampClockLib.sol | 0 .../contracts/libs/VotingPowerLib.sol | 0 .../deploy/1_simple.migration.ts | 37 +++++ .../deploy/2_linking.migration.ts | 51 ++++++ .../deploy/3_plenty.of.stuff.migration.ts | 46 ++++++ .../hardhat.config.ts | 0 .../package.json | 2 +- .../hardhat.config.ts | 14 -- .../deploy/1_deploy.ts | 13 -- .../package.json | 8 - .../deploy/1_deploy.ts | 13 -- .../deploy/1_deploy.ts | 13 -- .../deploy/1_deploy.ts | 11 -- .../hardhat.config.ts | 19 --- .../package.json | 8 - .../hardhat-project-minimal/.gitignore | 2 - .../.gitignore | 1 + .../contracts/GovToken.sol | 0 .../contracts/libs/TimestampClockLib.sol | 0 .../contracts/libs/VotingPowerLib.sol | 0 .../deploy/1_simple.migration.ts | 44 ++++++ .../hardhat.config.ts | 0 .../package.json | 4 +- .../.gitignore | 3 - .../contracts/GovToken.sol | 63 -------- .../contracts/libs/TimestampClockLib.sol | 20 --- .../contracts/libs/VotingPowerLib.sol | 28 ---- .../deploy/1_deploy.ts | 11 -- .../hardhat.config.ts | 15 -- .../package.json | 8 - .../.gitignore | 0 .../contracts/GovToken.sol | 0 .../contracts/TestContracts.sol | 22 +++ .../contracts/libs/TimestampClockLib.sol | 0 .../contracts/libs/VotingPowerLib.sol | 0 .../deploy/1_simple.migration.ts | 22 +++ .../deploy/2_linking.migration.ts | 40 +++++ .../deploy/3_plenty.of.stuff.migration.ts | 42 +++++ .../hardhat.config.ts | 2 - .../package.json | 2 +- .../.gitignore | 1 + .../contracts/GovToken.sol | 0 .../contracts/libs/TimestampClockLib.sol | 0 .../contracts/libs/VotingPowerLib.sol | 0 .../deploy/1_simple.migration.ts | 22 +++ .../deploy/2_linking.migration.ts | 42 +++++ .../deploy/3_plenty.of.stuff.migration.ts | 42 +++++ .../hardhat.config.ts | 0 .../package.json | 9 ++ .../.gitignore | 0 .../contracts/GovToken.sol | 0 .../contracts/libs/TimestampClockLib.sol | 0 .../contracts/libs/VotingPowerLib.sol | 0 .../hardhat-project/hardhat.config.ts | 3 + .../package.json | 2 +- test/fixture-projects/hardhat.config.ts | 14 +- test/helpers.ts | 11 +- test/integration/adapters/ethersAdapter.ts | 96 ------------ test/integration/adapters/truffleAdapter.ts | 104 ------------ test/integration/config.ts | 148 ------------------ .../deployer/base-contract-interaction.ts | 56 +++++++ test/integration/deployer/deployEthers.ts | 59 ------- test/integration/deployer/deployTruffle.ts | 46 ------ .../deployer/deployTypechainEthers.ts | 70 --------- .../deployer/deployTypechainTruffle.ts | 79 ---------- test/integration/migration/ethers.test.ts | 50 ++++++ test/integration/migration/helper.ts | 30 ++++ .../migration/pure-bytecode.test.ts | 30 ++++ .../migration/typechain-ethers.test.ts | 50 ++++++ .../migration/typechain-truffle.test.ts | 48 ++++++ test/integration/setup/config.ts | 70 +++++++++ .../{ => tools}/transaction-storage.ts | 88 +++++------ 76 files changed, 835 insertions(+), 912 deletions(-) rename test/fixture-projects/{hardhat-project-invalid-config => hardhat-project-ethers}/.gitignore (100%) rename test/fixture-projects/{hardhat-project-minimal-ethers => hardhat-project-ethers}/contracts/GovToken.sol (100%) rename test/fixture-projects/{hardhat-project-minimal-ethers => hardhat-project-ethers}/contracts/libs/TimestampClockLib.sol (100%) rename test/fixture-projects/{hardhat-project-minimal-ethers => hardhat-project-ethers}/contracts/libs/VotingPowerLib.sol (100%) create mode 100644 test/fixture-projects/hardhat-project-ethers/deploy/1_simple.migration.ts create mode 100644 test/fixture-projects/hardhat-project-ethers/deploy/2_linking.migration.ts create mode 100644 test/fixture-projects/hardhat-project-ethers/deploy/3_plenty.of.stuff.migration.ts rename test/fixture-projects/{hardhat-project-minimal-ethers => hardhat-project-ethers}/hardhat.config.ts (100%) rename test/fixture-projects/{hardhat-project-minimal => hardhat-project-ethers}/package.json (80%) delete mode 100644 test/fixture-projects/hardhat-project-invalid-config/hardhat.config.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-ethers/deploy/1_deploy.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-ethers/package.json delete mode 100644 test/fixture-projects/hardhat-project-minimal-truffle/deploy/1_deploy.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-ethers/deploy/1_deploy.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-truffle/deploy/1_deploy.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-truffle/hardhat.config.ts delete mode 100644 test/fixture-projects/hardhat-project-minimal-typechain-truffle/package.json delete mode 100644 test/fixture-projects/hardhat-project-minimal/.gitignore rename test/fixture-projects/{hardhat-project-minimal-truffle => hardhat-project-pure-bytecode}/.gitignore (81%) rename test/fixture-projects/{hardhat-project-minimal-truffle => hardhat-project-pure-bytecode}/contracts/GovToken.sol (100%) rename test/fixture-projects/{hardhat-project-minimal-truffle => hardhat-project-pure-bytecode}/contracts/libs/TimestampClockLib.sol (100%) rename test/fixture-projects/{hardhat-project-minimal-truffle => hardhat-project-pure-bytecode}/contracts/libs/VotingPowerLib.sol (100%) create mode 100644 test/fixture-projects/hardhat-project-pure-bytecode/deploy/1_simple.migration.ts rename test/fixture-projects/{hardhat-project-minimal => hardhat-project-pure-bytecode}/hardhat.config.ts (100%) rename test/fixture-projects/{hardhat-project-minimal-typechain-ethers => hardhat-project-pure-bytecode}/package.json (50%) delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/.gitignore delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/GovToken.sol delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/libs/TimestampClockLib.sol delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/libs/VotingPowerLib.sol delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/deploy/1_deploy.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/hardhat.config.ts delete mode 100644 test/fixture-projects/hardhat-project-repeats-typechain-ethers/package.json rename test/fixture-projects/{hardhat-project-minimal-typechain-ethers => hardhat-project-typechain-ethers}/.gitignore (100%) rename test/fixture-projects/{hardhat-project-minimal-typechain-ethers => hardhat-project-typechain-ethers}/contracts/GovToken.sol (100%) create mode 100644 test/fixture-projects/hardhat-project-typechain-ethers/contracts/TestContracts.sol rename test/fixture-projects/{hardhat-project-minimal-typechain-ethers => hardhat-project-typechain-ethers}/contracts/libs/TimestampClockLib.sol (100%) rename test/fixture-projects/{hardhat-project-minimal-typechain-ethers => hardhat-project-typechain-ethers}/contracts/libs/VotingPowerLib.sol (100%) create mode 100644 test/fixture-projects/hardhat-project-typechain-ethers/deploy/1_simple.migration.ts create mode 100644 test/fixture-projects/hardhat-project-typechain-ethers/deploy/2_linking.migration.ts create mode 100644 test/fixture-projects/hardhat-project-typechain-ethers/deploy/3_plenty.of.stuff.migration.ts rename test/fixture-projects/{hardhat-project-minimal-typechain-ethers => hardhat-project-typechain-ethers}/hardhat.config.ts (81%) rename test/fixture-projects/{hardhat-project-minimal-truffle => hardhat-project-typechain-ethers}/package.json (76%) rename test/fixture-projects/{hardhat-project-minimal-typechain-truffle => hardhat-project-typechain-truffle}/.gitignore (89%) rename test/fixture-projects/{hardhat-project-minimal-typechain-truffle => hardhat-project-typechain-truffle}/contracts/GovToken.sol (100%) rename test/fixture-projects/{hardhat-project-minimal-typechain-truffle => hardhat-project-typechain-truffle}/contracts/libs/TimestampClockLib.sol (100%) rename test/fixture-projects/{hardhat-project-minimal-typechain-truffle => hardhat-project-typechain-truffle}/contracts/libs/VotingPowerLib.sol (100%) create mode 100644 test/fixture-projects/hardhat-project-typechain-truffle/deploy/1_simple.migration.ts create mode 100644 test/fixture-projects/hardhat-project-typechain-truffle/deploy/2_linking.migration.ts create mode 100644 test/fixture-projects/hardhat-project-typechain-truffle/deploy/3_plenty.of.stuff.migration.ts rename test/fixture-projects/{hardhat-project-minimal-truffle => hardhat-project-typechain-truffle}/hardhat.config.ts (100%) create mode 100644 test/fixture-projects/hardhat-project-typechain-truffle/package.json rename test/fixture-projects/{hardhat-project-minimal-ethers => hardhat-project}/.gitignore (100%) rename test/fixture-projects/{hardhat-project-minimal => hardhat-project}/contracts/GovToken.sol (100%) rename test/fixture-projects/{hardhat-project-minimal => hardhat-project}/contracts/libs/TimestampClockLib.sol (100%) rename test/fixture-projects/{hardhat-project-minimal => hardhat-project}/contracts/libs/VotingPowerLib.sol (100%) create mode 100644 test/fixture-projects/hardhat-project/hardhat.config.ts rename test/fixture-projects/{hardhat-project-invalid-config => hardhat-project}/package.json (77%) delete mode 100644 test/integration/adapters/ethersAdapter.ts delete mode 100644 test/integration/adapters/truffleAdapter.ts delete mode 100644 test/integration/config.ts create mode 100644 test/integration/deployer/base-contract-interaction.ts delete mode 100644 test/integration/deployer/deployEthers.ts delete mode 100644 test/integration/deployer/deployTruffle.ts delete mode 100644 test/integration/deployer/deployTypechainEthers.ts delete mode 100644 test/integration/deployer/deployTypechainTruffle.ts create mode 100644 test/integration/migration/ethers.test.ts create mode 100644 test/integration/migration/helper.ts create mode 100644 test/integration/migration/pure-bytecode.test.ts create mode 100644 test/integration/migration/typechain-ethers.test.ts create mode 100644 test/integration/migration/typechain-truffle.test.ts create mode 100644 test/integration/setup/config.ts rename test/integration/{ => tools}/transaction-storage.ts (62%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 409cd6aa..282ed7df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Version 2.0.0-beta.1 +* Revised the test infrastructure and architecture. +* Fixed bugs related to the recovery of contract names. * Fixed a bug related to contract recovery when a custom name is used. * Migrated test fixture projects to TypeScript, updating configurations and scripts. Created new fixture contracts for testing and deleted auto-generated files. diff --git a/test/fixture-projects/hardhat-project-defined-config/hardhat.config.ts b/test/fixture-projects/hardhat-project-defined-config/hardhat.config.ts index d3143371..e6595378 100644 --- a/test/fixture-projects/hardhat-project-defined-config/hardhat.config.ts +++ b/test/fixture-projects/hardhat-project-defined-config/hardhat.config.ts @@ -8,16 +8,17 @@ const defaultConfig: HardhatUserConfig = { ...config, migrate: { from: 1, - to: 5, + to: 3, only: 2, - skip: 1, + skip: 4, wait: 2, verify: true, - verifyParallel: 4, - verifyAttempts: 5, - pathToMigrations: "./deploy/", + verifyParallel: 12, + verifyAttempts: 32, + pathToMigrations: "./path-to-deploy", force: true, continue: true, + transactionStatusCheckInterval: 4000, }, }; diff --git a/test/fixture-projects/hardhat-project-invalid-config/.gitignore b/test/fixture-projects/hardhat-project-ethers/.gitignore similarity index 100% rename from test/fixture-projects/hardhat-project-invalid-config/.gitignore rename to test/fixture-projects/hardhat-project-ethers/.gitignore diff --git a/test/fixture-projects/hardhat-project-minimal-ethers/contracts/GovToken.sol b/test/fixture-projects/hardhat-project-ethers/contracts/GovToken.sol similarity index 100% rename from test/fixture-projects/hardhat-project-minimal-ethers/contracts/GovToken.sol rename to test/fixture-projects/hardhat-project-ethers/contracts/GovToken.sol diff --git a/test/fixture-projects/hardhat-project-minimal-ethers/contracts/libs/TimestampClockLib.sol b/test/fixture-projects/hardhat-project-ethers/contracts/libs/TimestampClockLib.sol similarity index 100% rename from test/fixture-projects/hardhat-project-minimal-ethers/contracts/libs/TimestampClockLib.sol rename to test/fixture-projects/hardhat-project-ethers/contracts/libs/TimestampClockLib.sol diff --git a/test/fixture-projects/hardhat-project-minimal-ethers/contracts/libs/VotingPowerLib.sol b/test/fixture-projects/hardhat-project-ethers/contracts/libs/VotingPowerLib.sol similarity index 100% rename from test/fixture-projects/hardhat-project-minimal-ethers/contracts/libs/VotingPowerLib.sol rename to test/fixture-projects/hardhat-project-ethers/contracts/libs/VotingPowerLib.sol diff --git a/test/fixture-projects/hardhat-project-ethers/deploy/1_simple.migration.ts b/test/fixture-projects/hardhat-project-ethers/deploy/1_simple.migration.ts new file mode 100644 index 00000000..c800e5d0 --- /dev/null +++ b/test/fixture-projects/hardhat-project-ethers/deploy/1_simple.migration.ts @@ -0,0 +1,37 @@ +import { ethers } from "hardhat"; + +import { Deployer } from "../../../../src/deployer/Deployer"; +import { PublicReporter as Reporter } from "../../../../src/tools/reporters/PublicReporter"; + +const TOKEN_OWNER = "0x1E3953B6ee74461169A3E346060AE27bD0B5bF2B"; + +export = async (deployer: Deployer) => { + const votingPowerLibFactory = await ethers.getContractFactory("VotingPowerLib"); + const timestampClockLibFactory = await ethers.getContractFactory("TimestampClockLib"); + + const votingPowerLib = await deployer.deploy(votingPowerLibFactory); + const timestampClockLib = await deployer.deploy(timestampClockLibFactory); + + const govTokenFactory = await ethers.getContractFactory("GovToken", { + libraries: { + VotingPowerLib: await votingPowerLib.getAddress(), + TimestampClockLib: await timestampClockLib.getAddress(), + }, + }); + + const govToken = await deployer.deploy(govTokenFactory, ["Token", "TKN"], { + name: "contracts/GovToken.sol:GovToken", + }); + + const transferOwnershipTx = (await (await govToken.transferOwnership(TOKEN_OWNER)).wait())!; + + await Reporter.reportTransactionByHash( + transferOwnershipTx.hash, + "Transfer Ownership of Governance Token to Token Owner", + ); + + Reporter.reportContracts([ + `Governance Token ${await govToken.name()} (${await govToken.symbol()}) Address`, + await govToken.getAddress(), + ]); +}; diff --git a/test/fixture-projects/hardhat-project-ethers/deploy/2_linking.migration.ts b/test/fixture-projects/hardhat-project-ethers/deploy/2_linking.migration.ts new file mode 100644 index 00000000..e4a110d7 --- /dev/null +++ b/test/fixture-projects/hardhat-project-ethers/deploy/2_linking.migration.ts @@ -0,0 +1,51 @@ +import { ethers } from "hardhat"; + +import { TransactionReceiptParams } from "ethers"; + +import { Deployer } from "../../../../src/deployer/Deployer"; +import { PublicReporter as Reporter } from "../../../../src/tools/reporters/PublicReporter"; + +const TOKEN_OWNER = "0x1E3953B6ee74461169A3E346060AE27bD0B5bF2B"; + +export = async (deployer: Deployer) => { + const votingPowerLibFactory = await ethers.getContractFactory("VotingPowerLib"); + const timestampClockLibFactory = await ethers.getContractFactory("TimestampClockLib"); + + const votingPowerLib = await deployer.deploy(votingPowerLibFactory); + const timestampClockLib = await deployer.deploy(timestampClockLibFactory); + + const govTokenFactory = await ethers.getContractFactory("GovToken", { + libraries: { + VotingPowerLib: await votingPowerLib.getAddress(), + TimestampClockLib: await timestampClockLib.getAddress(), + }, + }); + + const govToken = await deployer.deploy(govTokenFactory, ["Token", "TKN"], { + libraries: { + VotingPowerLib: await votingPowerLib.getAddress(), + TimestampClockLib: await timestampClockLib.getAddress(), + }, + name: "contracts/GovToken.sol:GovToken", + }); + + await govToken.transferOwnership(TOKEN_OWNER); + + const fundingTransaction = await deployer.sendNative(TOKEN_OWNER, 100n, "Funding Governance Token Owner #1"); + await Reporter.reportTransactionByHash( + (fundingTransaction.receipt as TransactionReceiptParams).hash, + "Funding Governance Token Owner #1", + ); + + await deployer.sendNative(TOKEN_OWNER, 100n, "Funding Governance Token Owner #2"); + await deployer.sendNative(TOKEN_OWNER, 100n, "Funding Governance Token Owner #3"); + await deployer.sendNative(TOKEN_OWNER, 100n, "Funding Governance Token Owner #4"); + await deployer.sendNative(TOKEN_OWNER, 100n, "Funding Governance Token Owner #5"); + await deployer.sendNative(TOKEN_OWNER, 100n, "Funding Governance Token Owner #6"); + await deployer.sendNative(TOKEN_OWNER, 100n, "Funding Governance Token Owner #7"); + + Reporter.reportContracts([ + `Governance Token ${await govToken.name()} (${await govToken.symbol()}) Address`, + await govToken.getAddress(), + ]); +}; diff --git a/test/fixture-projects/hardhat-project-ethers/deploy/3_plenty.of.stuff.migration.ts b/test/fixture-projects/hardhat-project-ethers/deploy/3_plenty.of.stuff.migration.ts new file mode 100644 index 00000000..a9f7dd06 --- /dev/null +++ b/test/fixture-projects/hardhat-project-ethers/deploy/3_plenty.of.stuff.migration.ts @@ -0,0 +1,46 @@ +import { ethers } from "hardhat"; + +import { Deployer } from "../../../../src/deployer/Deployer"; +import { PublicReporter as Reporter } from "../../../../src/tools/reporters/PublicReporter"; + +const TOKEN_OWNER = "0x1E3953B6ee74461169A3E346060AE27bD0B5bF2B"; + +export = async (deployer: Deployer) => { + const votingPowerLibFactory = await ethers.getContractFactory("VotingPowerLib"); + const timestampClockLibFactory = await ethers.getContractFactory("TimestampClockLib"); + + const votingPowerLib = await deployer.deploy(votingPowerLibFactory); + const timestampClockLib = await deployer.deploy(timestampClockLibFactory); + + const govTokenFactory = await ethers.getContractFactory("GovToken", { + libraries: { + VotingPowerLib: await votingPowerLib.getAddress(), + TimestampClockLib: await timestampClockLib.getAddress(), + }, + }); + + await deployer.deploy(votingPowerLibFactory, { name: "VotingPowerLib #1" }); + await deployer.deploy(votingPowerLibFactory, { name: "VotingPowerLib #5" }); + await deployer.deploy(votingPowerLibFactory, { name: "VotingPowerLib #6" }); + + await deployer.deploy(timestampClockLibFactory, { name: "TimestampClockLib #1" }); + await deployer.deploy(timestampClockLibFactory, { name: "TimestampClockLib #5" }); + await deployer.deploy(timestampClockLibFactory, { name: "TimestampClockLib #6" }); + + await deployer.deploy(govTokenFactory, ["Token", "TKN"], { + name: "contracts/GovToken.sol:GovToken", + libraries: { + VotingPowerLib: await (await deployer.deployed(votingPowerLibFactory, "VotingPowerLib #5")).getAddress(), + TimestampClockLib: await (await deployer.deployed(timestampClockLibFactory, "TimestampClockLib #5")).getAddress(), + }, + }); + + const govToken5 = await deployer.deployed(govTokenFactory, "contracts/GovToken.sol:GovToken"); + + await govToken5.transferOwnership(TOKEN_OWNER); + + Reporter.reportContracts([ + `Governance Token ${await govToken5.name()} (${await govToken5.symbol()}) Address`, + await govToken5.getAddress(), + ]); +}; diff --git a/test/fixture-projects/hardhat-project-minimal-ethers/hardhat.config.ts b/test/fixture-projects/hardhat-project-ethers/hardhat.config.ts similarity index 100% rename from test/fixture-projects/hardhat-project-minimal-ethers/hardhat.config.ts rename to test/fixture-projects/hardhat-project-ethers/hardhat.config.ts diff --git a/test/fixture-projects/hardhat-project-minimal/package.json b/test/fixture-projects/hardhat-project-ethers/package.json similarity index 80% rename from test/fixture-projects/hardhat-project-minimal/package.json rename to test/fixture-projects/hardhat-project-ethers/package.json index 618be864..7bd88476 100644 --- a/test/fixture-projects/hardhat-project-minimal/package.json +++ b/test/fixture-projects/hardhat-project-ethers/package.json @@ -1,5 +1,5 @@ { - "name": "hardhat-project-minimal", + "name": "hardhat-project-ethers", "version": "1.0.0", "scripts": { "compile": "hardhat compile --force", diff --git a/test/fixture-projects/hardhat-project-invalid-config/hardhat.config.ts b/test/fixture-projects/hardhat-project-invalid-config/hardhat.config.ts deleted file mode 100644 index e99154ce..00000000 --- a/test/fixture-projects/hardhat-project-invalid-config/hardhat.config.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { HardhatUserConfig } from "hardhat/config"; - -import config from "../hardhat.config"; - -import "../../../src"; - -const defaultConfig: HardhatUserConfig = { - ...config, - migrate: { - pathToMigrations: "~/deploy", - }, -}; - -export default defaultConfig; diff --git a/test/fixture-projects/hardhat-project-minimal-ethers/deploy/1_deploy.ts b/test/fixture-projects/hardhat-project-minimal-ethers/deploy/1_deploy.ts deleted file mode 100644 index 1ba52478..00000000 --- a/test/fixture-projects/hardhat-project-minimal-ethers/deploy/1_deploy.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { getContractFactory } from "@nomicfoundation/hardhat-ethers/types"; - -import { Deployer } from "../../../../src/deployer/Deployer"; - -export = async (deployer: Deployer) => { - const ContractWithConstructorArguments = await getContractFactory("ContractWithConstructorArguments"); - - let contract = await deployer.deploy(ContractWithConstructorArguments, ["hello"], { - gasLimit: 1000000, - }); - - await contract.name(); -}; diff --git a/test/fixture-projects/hardhat-project-minimal-ethers/package.json b/test/fixture-projects/hardhat-project-minimal-ethers/package.json deleted file mode 100644 index fc227dc3..00000000 --- a/test/fixture-projects/hardhat-project-minimal-ethers/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "hardhat-project-minimal-ethers", - "version": "1.0.0", - "scripts": { - "compile": "hardhat compile --force", - "clean": "hardhat clean && rm -rf artifacts && rm -rf cache" - } -} diff --git a/test/fixture-projects/hardhat-project-minimal-truffle/deploy/1_deploy.ts b/test/fixture-projects/hardhat-project-minimal-truffle/deploy/1_deploy.ts deleted file mode 100644 index 1ba52478..00000000 --- a/test/fixture-projects/hardhat-project-minimal-truffle/deploy/1_deploy.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { getContractFactory } from "@nomicfoundation/hardhat-ethers/types"; - -import { Deployer } from "../../../../src/deployer/Deployer"; - -export = async (deployer: Deployer) => { - const ContractWithConstructorArguments = await getContractFactory("ContractWithConstructorArguments"); - - let contract = await deployer.deploy(ContractWithConstructorArguments, ["hello"], { - gasLimit: 1000000, - }); - - await contract.name(); -}; diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/deploy/1_deploy.ts b/test/fixture-projects/hardhat-project-minimal-typechain-ethers/deploy/1_deploy.ts deleted file mode 100644 index 3dc7785b..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/deploy/1_deploy.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Deployer } from "../../../../src/deployer/Deployer"; - -import { ContractWithConstructorArguments__factory } from "../typechain-types"; - -export = async (deployer: Deployer) => { - let contract = await deployer.deploy(ContractWithConstructorArguments__factory, ["hello"], { - gasLimit: 1000000, - }); - - let contract2 = await deployer.deploy({ bytecode: "", abi: "", contractName: "" }, ["hello"], {}); - - await contract.name(); -}; diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/deploy/1_deploy.ts b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/deploy/1_deploy.ts deleted file mode 100644 index f0aca40c..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/deploy/1_deploy.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Deployer } from "../../../../src/deployer/Deployer"; - -const ContractWithConstructorArguments = artifacts.require("ContractWithConstructorArguments"); - -export = async (deployer: Deployer) => { - let contract = await deployer.deploy(ContractWithConstructorArguments, ["hello"], { - gasLimit: 1000000, - }); - - await contract.name(); -}; diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/hardhat.config.ts b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/hardhat.config.ts deleted file mode 100644 index 17bd6ffd..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/hardhat.config.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { HardhatUserConfig } from "hardhat/config"; - -import "@nomiclabs/hardhat-truffle5"; - -import "@typechain/hardhat"; - -import config from "../hardhat.config"; - -const defaultConfig: HardhatUserConfig = { - ...config, - typechain: { - outDir: `typechain-types`, - target: "truffle-v5", - alwaysGenerateOverloads: true, - discriminateTypes: true, - }, -}; - -export default defaultConfig; diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/package.json b/test/fixture-projects/hardhat-project-minimal-typechain-truffle/package.json deleted file mode 100644 index 7bdf5362..00000000 --- a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "hardhat-project-minimal-typechain-truffle", - "version": "1.0.0", - "scripts": { - "compile": "hardhat compile --force", - "clean": "hardhat clean && rm -rf artifacts && rm -rf cache" - } -} diff --git a/test/fixture-projects/hardhat-project-minimal/.gitignore b/test/fixture-projects/hardhat-project-minimal/.gitignore deleted file mode 100644 index f61ce9c7..00000000 --- a/test/fixture-projects/hardhat-project-minimal/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/cache -/artifacts diff --git a/test/fixture-projects/hardhat-project-minimal-truffle/.gitignore b/test/fixture-projects/hardhat-project-pure-bytecode/.gitignore similarity index 81% rename from test/fixture-projects/hardhat-project-minimal-truffle/.gitignore rename to test/fixture-projects/hardhat-project-pure-bytecode/.gitignore index f61ce9c7..5db70913 100644 --- a/test/fixture-projects/hardhat-project-minimal-truffle/.gitignore +++ b/test/fixture-projects/hardhat-project-pure-bytecode/.gitignore @@ -1,2 +1,3 @@ /cache /artifacts +abi diff --git a/test/fixture-projects/hardhat-project-minimal-truffle/contracts/GovToken.sol b/test/fixture-projects/hardhat-project-pure-bytecode/contracts/GovToken.sol similarity index 100% rename from test/fixture-projects/hardhat-project-minimal-truffle/contracts/GovToken.sol rename to test/fixture-projects/hardhat-project-pure-bytecode/contracts/GovToken.sol diff --git a/test/fixture-projects/hardhat-project-minimal-truffle/contracts/libs/TimestampClockLib.sol b/test/fixture-projects/hardhat-project-pure-bytecode/contracts/libs/TimestampClockLib.sol similarity index 100% rename from test/fixture-projects/hardhat-project-minimal-truffle/contracts/libs/TimestampClockLib.sol rename to test/fixture-projects/hardhat-project-pure-bytecode/contracts/libs/TimestampClockLib.sol diff --git a/test/fixture-projects/hardhat-project-minimal-truffle/contracts/libs/VotingPowerLib.sol b/test/fixture-projects/hardhat-project-pure-bytecode/contracts/libs/VotingPowerLib.sol similarity index 100% rename from test/fixture-projects/hardhat-project-minimal-truffle/contracts/libs/VotingPowerLib.sol rename to test/fixture-projects/hardhat-project-pure-bytecode/contracts/libs/VotingPowerLib.sol diff --git a/test/fixture-projects/hardhat-project-pure-bytecode/deploy/1_simple.migration.ts b/test/fixture-projects/hardhat-project-pure-bytecode/deploy/1_simple.migration.ts new file mode 100644 index 00000000..bd09bbb5 --- /dev/null +++ b/test/fixture-projects/hardhat-project-pure-bytecode/deploy/1_simple.migration.ts @@ -0,0 +1,44 @@ +import { Deployer } from "../../../../src/deployer/Deployer"; +import { PublicReporter as Reporter } from "../../../../src/tools/reporters/PublicReporter"; + +const TOKEN_OWNER = "0x1E3953B6ee74461169A3E346060AE27bD0B5bF2B"; + +export = async (deployer: Deployer) => { + const votingPowerLibData = require("../artifacts/contracts/libs/VotingPowerLib.sol/VotingPowerLib.json"); + const timestampClockLibData = require("../artifacts/contracts/libs/TimestampClockLib.sol/TimestampClockLib.json"); + const govTokenData = require("../artifacts/contracts/GovToken.sol/GovToken.json"); + + const votingPowerLib = await deployer.deploy({ + bytecode: votingPowerLibData.bytecode, + abi: votingPowerLibData.abi, + contractName: "VotingPowerLib", + }); + const timestampClockLib = await deployer.deploy({ + bytecode: timestampClockLibData.bytecode, + abi: timestampClockLibData.abi, + contractName: "TimestampClockLib", + }); + + const govToken = await deployer.deploy( + { bytecode: govTokenData.bytecode, abi: govTokenData.abi, contractName: "GovToken" }, + ["Token", "TKN"], + { + libraries: { + VotingPowerLib: await votingPowerLib.getAddress(), + TimestampClockLib: await timestampClockLib.getAddress(), + }, + }, + ); + + const transferOwnershipTx = (await (await govToken.transferOwnership(TOKEN_OWNER)).wait())!; + + await Reporter.reportTransactionByHash( + transferOwnershipTx.hash, + "Transfer Ownership of Governance Token to Token Owner", + ); + + Reporter.reportContracts([ + `Governance Token ${await govToken.name()} (${await govToken.symbol()}) Address`, + await govToken.getAddress(), + ]); +}; diff --git a/test/fixture-projects/hardhat-project-minimal/hardhat.config.ts b/test/fixture-projects/hardhat-project-pure-bytecode/hardhat.config.ts similarity index 100% rename from test/fixture-projects/hardhat-project-minimal/hardhat.config.ts rename to test/fixture-projects/hardhat-project-pure-bytecode/hardhat.config.ts diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/package.json b/test/fixture-projects/hardhat-project-pure-bytecode/package.json similarity index 50% rename from test/fixture-projects/hardhat-project-minimal-typechain-ethers/package.json rename to test/fixture-projects/hardhat-project-pure-bytecode/package.json index 9b20798f..3b435cec 100644 --- a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/package.json +++ b/test/fixture-projects/hardhat-project-pure-bytecode/package.json @@ -1,8 +1,8 @@ { - "name": "hardhat-project-minimal-typechain-ethers", + "name": "hardhat-project-pure-bytecode", "version": "1.0.0", "scripts": { - "compile": "hardhat compile --force", + "compile": "hardhat compile --force && hardhat export-abi", "clean": "hardhat clean && rm -rf artifacts && rm -rf cache" } } diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/.gitignore b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/.gitignore deleted file mode 100644 index d5e01af2..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/cache -/artifacts -typechain-types diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/GovToken.sol b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/GovToken.sol deleted file mode 100644 index 7f4cc7d7..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/GovToken.sol +++ /dev/null @@ -1,63 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; - -import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; -import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol"; -import {ERC20Votes, ERC20} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol"; - -import {VotingPowerLib} from "./libs/VotingPowerLib.sol"; -import {TimestampClockLib} from "./libs/TimestampClockLib.sol"; - -/** -* @title GovToken -* -* @notice This is an ERC20 token that includes vote delegation. -* It is intentionally designed with added complexity for testing purposes. -*/ -contract GovToken is ERC20Votes, Ownable { - using VotingPowerLib for uint256; - - constructor(string memory name_, string memory symbol_) ERC20(name_, symbol_) EIP712(name_, version()) Ownable(msg.sender) { - _mint(msg.sender, 1000000); - } - - function decimals() public pure override returns (uint8) { - return 3; - } - - function version() public pure returns (string memory) { - return "1"; - } - - function mint(address to_, uint256 amount_) external onlyOwner { - _mint(to_, amount_); - } - - function burn(address from_, uint256 amount_) external onlyOwner { - _burn(from_, amount_); - } - - function getUserVotingPower(address account_) public view returns (uint256) { - return getVotes(account_).calculateUserVotingPower(decimals()); - } - - function getPastUserVotingPower(address account_, uint256 timestamp_) public view returns (uint256) { - return getPastVotes(account_, timestamp_).calculateUserVotingPower(decimals()); - } - - function getVotingPowerThreshold() public view returns (uint256) { - return _getTotalSupply().calculateVotingPowerThreshold(decimals()); - } - - function getPastVotingPowerThreshold(uint256 timestamp_) public view returns (uint256) { - return getPastTotalSupply(timestamp_).calculateVotingPowerThreshold(decimals()); - } - - function clock() public view override returns (uint48) { - return TimestampClockLib.clock(); - } - - function CLOCK_MODE() public view override returns (string memory) { - return TimestampClockLib.CLOCK_MODE(); - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/libs/TimestampClockLib.sol b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/libs/TimestampClockLib.sol deleted file mode 100644 index 3517a813..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/libs/TimestampClockLib.sol +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; - -import {Time} from "@openzeppelin/contracts/utils/types/Time.sol"; -import {Votes} from "@openzeppelin/contracts/governance/utils/Votes.sol"; - -library TimestampClockLib { - using Time for *; - - function clock() public view returns (uint48) { - return Time.timestamp(); - } - - function CLOCK_MODE() public view returns (string memory) { - if (clock() != Time.timestamp()) { - revert Votes.ERC6372InconsistentClock(); - } - return "mode=timestamp"; - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/libs/VotingPowerLib.sol b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/libs/VotingPowerLib.sol deleted file mode 100644 index 1480bc7f..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/contracts/libs/VotingPowerLib.sol +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; - -import "@openzeppelin/contracts/utils/math/Math.sol"; - -library VotingPowerLib { - using Math for *; - - function calculateUserVotingPower(uint256 tokenAmount_, uint8 decimals_) external pure returns (uint256) { - uint256 oneToken_ = 10 ** decimals_; - - if (tokenAmount_ <= oneToken_) { - return 0; - } - - return (tokenAmount_ / oneToken_).log2(); - } - - function calculateVotingPowerThreshold(uint256 totalSupply_, uint8 decimals_) external pure returns (uint256) { - uint256 oneToken_ = 10 ** decimals_; - - if (totalSupply_ <= oneToken_) { - return 0; - } - - return (totalSupply_ / oneToken_).log10(); - } -} diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/deploy/1_deploy.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/deploy/1_deploy.ts deleted file mode 100644 index 0b001a67..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/deploy/1_deploy.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Deployer } from "../../../../src/deployer/Deployer"; - -import { ContractWithConstructorArguments__factory } from "../typechain-types"; - -export = async (deployer: Deployer) => { - let contract = await deployer.deploy(ContractWithConstructorArguments__factory, ["hello"], { - gasLimit: 1000000, - }); - - await contract.name(); -}; diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/hardhat.config.ts b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/hardhat.config.ts deleted file mode 100644 index 6918fbc5..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/hardhat.config.ts +++ /dev/null @@ -1,15 +0,0 @@ -import "@typechain/hardhat"; - -import config from "../hardhat.config"; - -const defaultConfig = { - ...config, - typechain: { - outDir: `typechain-types`, - target: "ethers-v6", - alwaysGenerateOverloads: true, - discriminateTypes: true, - }, -}; - -export default defaultConfig; diff --git a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/package.json b/test/fixture-projects/hardhat-project-repeats-typechain-ethers/package.json deleted file mode 100644 index 691db1b1..00000000 --- a/test/fixture-projects/hardhat-project-repeats-typechain-ethers/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "hardhat-project-repeats-typechain-ethers", - "version": "1.0.0", - "scripts": { - "compile": "hardhat compile --force", - "clean": "hardhat clean && rm -rf artifacts && rm -rf cache" - } -} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/.gitignore b/test/fixture-projects/hardhat-project-typechain-ethers/.gitignore similarity index 100% rename from test/fixture-projects/hardhat-project-minimal-typechain-ethers/.gitignore rename to test/fixture-projects/hardhat-project-typechain-ethers/.gitignore diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/contracts/GovToken.sol b/test/fixture-projects/hardhat-project-typechain-ethers/contracts/GovToken.sol similarity index 100% rename from test/fixture-projects/hardhat-project-minimal-typechain-ethers/contracts/GovToken.sol rename to test/fixture-projects/hardhat-project-typechain-ethers/contracts/GovToken.sol diff --git a/test/fixture-projects/hardhat-project-typechain-ethers/contracts/TestContracts.sol b/test/fixture-projects/hardhat-project-typechain-ethers/contracts/TestContracts.sol new file mode 100644 index 00000000..61829bef --- /dev/null +++ b/test/fixture-projects/hardhat-project-typechain-ethers/contracts/TestContracts.sol @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.7.0 <0.9.0; + +contract PayableConstructor { + constructor() payable {} +} + +contract ConstructorWithArguments { + uint256 public value; + + constructor(uint256 _value) { + value = _value; + } +} + +contract PayableReceive { + event Received(address, uint256); + + receive() external payable { + emit Received(msg.sender, msg.value); + } +} diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/contracts/libs/TimestampClockLib.sol b/test/fixture-projects/hardhat-project-typechain-ethers/contracts/libs/TimestampClockLib.sol similarity index 100% rename from test/fixture-projects/hardhat-project-minimal-typechain-ethers/contracts/libs/TimestampClockLib.sol rename to test/fixture-projects/hardhat-project-typechain-ethers/contracts/libs/TimestampClockLib.sol diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/contracts/libs/VotingPowerLib.sol b/test/fixture-projects/hardhat-project-typechain-ethers/contracts/libs/VotingPowerLib.sol similarity index 100% rename from test/fixture-projects/hardhat-project-minimal-typechain-ethers/contracts/libs/VotingPowerLib.sol rename to test/fixture-projects/hardhat-project-typechain-ethers/contracts/libs/VotingPowerLib.sol diff --git a/test/fixture-projects/hardhat-project-typechain-ethers/deploy/1_simple.migration.ts b/test/fixture-projects/hardhat-project-typechain-ethers/deploy/1_simple.migration.ts new file mode 100644 index 00000000..800b3600 --- /dev/null +++ b/test/fixture-projects/hardhat-project-typechain-ethers/deploy/1_simple.migration.ts @@ -0,0 +1,22 @@ +import { Deployer } from "../../../../src/deployer/Deployer"; +import { PublicReporter as Reporter } from "../../../../src/tools/reporters/PublicReporter"; + +import { GovToken__factory } from "../typechain-types"; + +const TOKEN_OWNER = "0x1E3953B6ee74461169A3E346060AE27bD0B5bF2B"; + +export = async (deployer: Deployer) => { + const govToken = await deployer.deploy(GovToken__factory, ["Token", "TKN"]); + + const transferOwnershipTx = (await (await govToken.transferOwnership(TOKEN_OWNER)).wait())!; + + await Reporter.reportTransactionByHash( + transferOwnershipTx.hash, + "Transfer Ownership of Governance Token to Token Owner", + ); + + Reporter.reportContracts([ + `Governance Token ${await govToken.name()} (${await govToken.symbol()}) Address`, + await govToken.getAddress(), + ]); +}; diff --git a/test/fixture-projects/hardhat-project-typechain-ethers/deploy/2_linking.migration.ts b/test/fixture-projects/hardhat-project-typechain-ethers/deploy/2_linking.migration.ts new file mode 100644 index 00000000..15c94344 --- /dev/null +++ b/test/fixture-projects/hardhat-project-typechain-ethers/deploy/2_linking.migration.ts @@ -0,0 +1,40 @@ +import { TransactionReceiptParams } from "ethers"; + +import { Deployer } from "../../../../src/deployer/Deployer"; +import { PublicReporter as Reporter } from "../../../../src/tools/reporters/PublicReporter"; + +import { GovToken__factory, TimestampClockLib__factory, VotingPowerLib__factory } from "../typechain-types"; + +const TOKEN_OWNER = "0x1E3953B6ee74461169A3E346060AE27bD0B5bF2B"; + +export = async (deployer: Deployer) => { + const votingPowerLib = await deployer.deploy(VotingPowerLib__factory); + const timestampClockLib = await deployer.deploy(TimestampClockLib__factory); + + const govToken = await deployer.deploy(GovToken__factory, ["Token", "TKN"], { + libraries: { + VotingPowerLib: await votingPowerLib.getAddress(), + TimestampClockLib: await timestampClockLib.getAddress(), + }, + }); + + await govToken.transferOwnership(TOKEN_OWNER); + + const fundingTransaction = await deployer.sendNative(TOKEN_OWNER, 100n, "Funding Governance Token Owner #1"); + await Reporter.reportTransactionByHash( + (fundingTransaction.receipt as TransactionReceiptParams).hash, + "Funding Governance Token Owner #1", + ); + + await deployer.sendNative(TOKEN_OWNER, 100n, "Funding Governance Token Owner #2"); + await deployer.sendNative(TOKEN_OWNER, 100n, "Funding Governance Token Owner #3"); + await deployer.sendNative(TOKEN_OWNER, 100n, "Funding Governance Token Owner #4"); + await deployer.sendNative(TOKEN_OWNER, 100n, "Funding Governance Token Owner #5"); + await deployer.sendNative(TOKEN_OWNER, 100n, "Funding Governance Token Owner #6"); + await deployer.sendNative(TOKEN_OWNER, 100n, "Funding Governance Token Owner #7"); + + Reporter.reportContracts([ + `Governance Token ${await govToken.name()} (${await govToken.symbol()}) Address`, + await govToken.getAddress(), + ]); +}; diff --git a/test/fixture-projects/hardhat-project-typechain-ethers/deploy/3_plenty.of.stuff.migration.ts b/test/fixture-projects/hardhat-project-typechain-ethers/deploy/3_plenty.of.stuff.migration.ts new file mode 100644 index 00000000..d13067af --- /dev/null +++ b/test/fixture-projects/hardhat-project-typechain-ethers/deploy/3_plenty.of.stuff.migration.ts @@ -0,0 +1,42 @@ +import { Deployer } from "../../../../src/deployer/Deployer"; +import { PublicReporter as Reporter } from "../../../../src/tools/reporters/PublicReporter"; + +import { GovToken__factory, TimestampClockLib__factory, VotingPowerLib__factory } from "../typechain-types"; + +const TOKEN_OWNER = "0x1E3953B6ee74461169A3E346060AE27bD0B5bF2B"; + +export = async (deployer: Deployer) => { + await deployer.deploy(VotingPowerLib__factory, { name: "VotingPowerLib #1" }); + await deployer.deploy(VotingPowerLib__factory, { name: "VotingPowerLib #5" }); + await deployer.deploy(VotingPowerLib__factory, { name: "VotingPowerLib #6" }); + + await deployer.deploy(TimestampClockLib__factory, { name: "TimestampClockLib #1" }); + await deployer.deploy(TimestampClockLib__factory, { name: "TimestampClockLib #5" }); + await deployer.deploy(TimestampClockLib__factory, { name: "TimestampClockLib #6" }); + + await deployer.deploy(GovToken__factory, ["Token", "TKN"], { name: "Governance Token #1" }); + await deployer.deploy(GovToken__factory, ["Token", "TKN"], { + name: "Governance Token #5", + libraries: { + VotingPowerLib: await (await deployer.deployed(VotingPowerLib__factory, "VotingPowerLib #5")).getAddress(), + TimestampClockLib: await ( + await deployer.deployed(TimestampClockLib__factory, "TimestampClockLib #5") + ).getAddress(), + }, + }); + await deployer.deploy(GovToken__factory, ["Token", "TKN"], { + name: "Governance Token #6", + libraries: { + VotingPowerLib: await (await deployer.deployed(VotingPowerLib__factory, "VotingPowerLib #5")).getAddress(), + }, + }); + + const govToken5 = await deployer.deployed(GovToken__factory, "Governance Token #5"); + + await govToken5.transferOwnership(TOKEN_OWNER); + + Reporter.reportContracts([ + `Governance Token ${await govToken5.name()} (${await govToken5.symbol()}) Address`, + await govToken5.getAddress(), + ]); +}; diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/hardhat.config.ts b/test/fixture-projects/hardhat-project-typechain-ethers/hardhat.config.ts similarity index 81% rename from test/fixture-projects/hardhat-project-minimal-typechain-ethers/hardhat.config.ts rename to test/fixture-projects/hardhat-project-typechain-ethers/hardhat.config.ts index 363aeb4b..970afec3 100644 --- a/test/fixture-projects/hardhat-project-minimal-typechain-ethers/hardhat.config.ts +++ b/test/fixture-projects/hardhat-project-typechain-ethers/hardhat.config.ts @@ -9,8 +9,6 @@ const defaultConfig: HardhatUserConfig = { typechain: { outDir: `typechain-types`, target: "ethers-v6", - alwaysGenerateOverloads: true, - discriminateTypes: true, }, }; diff --git a/test/fixture-projects/hardhat-project-minimal-truffle/package.json b/test/fixture-projects/hardhat-project-typechain-ethers/package.json similarity index 76% rename from test/fixture-projects/hardhat-project-minimal-truffle/package.json rename to test/fixture-projects/hardhat-project-typechain-ethers/package.json index cd52aa37..43d14c7f 100644 --- a/test/fixture-projects/hardhat-project-minimal-truffle/package.json +++ b/test/fixture-projects/hardhat-project-typechain-ethers/package.json @@ -1,5 +1,5 @@ { - "name": "hardhat-project-minimal-truffle", + "name": "hardhat-project-typechain-ethers", "version": "1.0.0", "scripts": { "compile": "hardhat compile --force", diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/.gitignore b/test/fixture-projects/hardhat-project-typechain-truffle/.gitignore similarity index 89% rename from test/fixture-projects/hardhat-project-minimal-typechain-truffle/.gitignore rename to test/fixture-projects/hardhat-project-typechain-truffle/.gitignore index d5e01af2..e6a764e8 100644 --- a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/.gitignore +++ b/test/fixture-projects/hardhat-project-typechain-truffle/.gitignore @@ -1,3 +1,4 @@ /cache /artifacts typechain-types +abi diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/contracts/GovToken.sol b/test/fixture-projects/hardhat-project-typechain-truffle/contracts/GovToken.sol similarity index 100% rename from test/fixture-projects/hardhat-project-minimal-typechain-truffle/contracts/GovToken.sol rename to test/fixture-projects/hardhat-project-typechain-truffle/contracts/GovToken.sol diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/contracts/libs/TimestampClockLib.sol b/test/fixture-projects/hardhat-project-typechain-truffle/contracts/libs/TimestampClockLib.sol similarity index 100% rename from test/fixture-projects/hardhat-project-minimal-typechain-truffle/contracts/libs/TimestampClockLib.sol rename to test/fixture-projects/hardhat-project-typechain-truffle/contracts/libs/TimestampClockLib.sol diff --git a/test/fixture-projects/hardhat-project-minimal-typechain-truffle/contracts/libs/VotingPowerLib.sol b/test/fixture-projects/hardhat-project-typechain-truffle/contracts/libs/VotingPowerLib.sol similarity index 100% rename from test/fixture-projects/hardhat-project-minimal-typechain-truffle/contracts/libs/VotingPowerLib.sol rename to test/fixture-projects/hardhat-project-typechain-truffle/contracts/libs/VotingPowerLib.sol diff --git a/test/fixture-projects/hardhat-project-typechain-truffle/deploy/1_simple.migration.ts b/test/fixture-projects/hardhat-project-typechain-truffle/deploy/1_simple.migration.ts new file mode 100644 index 00000000..15854ebe --- /dev/null +++ b/test/fixture-projects/hardhat-project-typechain-truffle/deploy/1_simple.migration.ts @@ -0,0 +1,22 @@ +import { Deployer } from "../../../../src/deployer/Deployer"; +import { PublicReporter as Reporter } from "../../../../src/tools/reporters/PublicReporter"; + +const TOKEN_OWNER = "0x1E3953B6ee74461169A3E346060AE27bD0B5bF2B"; + +export = async (deployer: Deployer) => { + const GovToken = artifacts.require("GovToken"); + + const govToken = await deployer.deploy(GovToken, ["Token", "TKN"]); + + const transferOwnershipTx = await govToken.transferOwnership(TOKEN_OWNER); + + await Reporter.reportTransactionByHash( + transferOwnershipTx.receipt.transactionHash, + "Transfer Ownership of Governance Token to Token Owner", + ); + + Reporter.reportContracts([ + `Governance Token ${await govToken.name()} (${await govToken.symbol()}) Address`, + govToken.address, + ]); +}; diff --git a/test/fixture-projects/hardhat-project-typechain-truffle/deploy/2_linking.migration.ts b/test/fixture-projects/hardhat-project-typechain-truffle/deploy/2_linking.migration.ts new file mode 100644 index 00000000..6f49d2a6 --- /dev/null +++ b/test/fixture-projects/hardhat-project-typechain-truffle/deploy/2_linking.migration.ts @@ -0,0 +1,42 @@ +import { TransactionReceiptParams } from "ethers"; + +import { Deployer } from "../../../../src/deployer/Deployer"; +import { PublicReporter as Reporter } from "../../../../src/tools/reporters/PublicReporter"; + +const GovToken = artifacts.require("GovToken"); +const VotingPowerLib = artifacts.require("VotingPowerLib"); +const TimestampClockLib = artifacts.require("TimestampClockLib"); + +const TOKEN_OWNER = "0x1E3953B6ee74461169A3E346060AE27bD0B5bF2B"; + +export = async (deployer: Deployer) => { + const votingPowerLib = await deployer.deploy(VotingPowerLib); + const timestampClockLib = await deployer.deploy(TimestampClockLib); + + const govToken = await deployer.deploy(GovToken, ["Token", "TKN"], { + libraries: { + VotingPowerLib: votingPowerLib.address, + TimestampClockLib: timestampClockLib.address, + }, + }); + + await govToken.transferOwnership(TOKEN_OWNER); + + const fundingTransaction = await deployer.sendNative(TOKEN_OWNER, 100n, "Funding Governance Token Owner #1"); + await Reporter.reportTransactionByHash( + (fundingTransaction.receipt as TransactionReceiptParams).hash, + "Funding Governance Token Owner #1", + ); + + await deployer.sendNative(TOKEN_OWNER, 100n, "Funding Governance Token Owner #2"); + await deployer.sendNative(TOKEN_OWNER, 100n, "Funding Governance Token Owner #3"); + await deployer.sendNative(TOKEN_OWNER, 100n, "Funding Governance Token Owner #4"); + await deployer.sendNative(TOKEN_OWNER, 100n, "Funding Governance Token Owner #5"); + await deployer.sendNative(TOKEN_OWNER, 100n, "Funding Governance Token Owner #6"); + await deployer.sendNative(TOKEN_OWNER, 100n, "Funding Governance Token Owner #7"); + + Reporter.reportContracts([ + `Governance Token ${await govToken.name()} (${await govToken.symbol()}) Address`, + govToken.address, + ]); +}; diff --git a/test/fixture-projects/hardhat-project-typechain-truffle/deploy/3_plenty.of.stuff.migration.ts b/test/fixture-projects/hardhat-project-typechain-truffle/deploy/3_plenty.of.stuff.migration.ts new file mode 100644 index 00000000..8fc4a25c --- /dev/null +++ b/test/fixture-projects/hardhat-project-typechain-truffle/deploy/3_plenty.of.stuff.migration.ts @@ -0,0 +1,42 @@ +import { Deployer } from "../../../../src/deployer/Deployer"; +import { PublicReporter as Reporter } from "../../../../src/tools/reporters/PublicReporter"; + +const GovToken = artifacts.require("GovToken"); +const VotingPowerLib = artifacts.require("VotingPowerLib"); +const TimestampClockLib = artifacts.require("TimestampClockLib"); + +const TOKEN_OWNER = "0x1E3953B6ee74461169A3E346060AE27bD0B5bF2B"; + +export = async (deployer: Deployer) => { + await deployer.deploy(VotingPowerLib, { name: "VotingPowerLib #1" }); + await deployer.deploy(VotingPowerLib, { name: "VotingPowerLib #5" }); + await deployer.deploy(VotingPowerLib, { name: "VotingPowerLib #6" }); + + await deployer.deploy(TimestampClockLib, { name: "TimestampClockLib #1" }); + await deployer.deploy(TimestampClockLib, { name: "TimestampClockLib #5" }); + await deployer.deploy(TimestampClockLib, { name: "TimestampClockLib #6" }); + + await deployer.deploy(GovToken, ["Token", "TKN"], { name: "Governance Token #1" }); + await deployer.deploy(GovToken, ["Token", "TKN"], { + name: "Governance Token #5", + libraries: { + VotingPowerLib: (await deployer.deployed(VotingPowerLib, "VotingPowerLib #5")).address, + TimestampClockLib: (await deployer.deployed(TimestampClockLib, "TimestampClockLib #5")).address, + }, + }); + await deployer.deploy(GovToken, ["Token", "TKN"], { + name: "Governance Token #6", + libraries: { + VotingPowerLib: (await deployer.deployed(VotingPowerLib, "VotingPowerLib #5")).address, + }, + }); + + const govToken5 = await deployer.deployed(GovToken, "Governance Token #5"); + + await govToken5.transferOwnership(TOKEN_OWNER); + + Reporter.reportContracts([ + `Governance Token ${await govToken5.name()} (${await govToken5.symbol()}) Address`, + govToken5.address, + ]); +}; diff --git a/test/fixture-projects/hardhat-project-minimal-truffle/hardhat.config.ts b/test/fixture-projects/hardhat-project-typechain-truffle/hardhat.config.ts similarity index 100% rename from test/fixture-projects/hardhat-project-minimal-truffle/hardhat.config.ts rename to test/fixture-projects/hardhat-project-typechain-truffle/hardhat.config.ts diff --git a/test/fixture-projects/hardhat-project-typechain-truffle/package.json b/test/fixture-projects/hardhat-project-typechain-truffle/package.json new file mode 100644 index 00000000..5c4dc562 --- /dev/null +++ b/test/fixture-projects/hardhat-project-typechain-truffle/package.json @@ -0,0 +1,9 @@ +{ + "name": "hardhat-project-typechain-truffle", + "version": "1.0.0", + "scripts": { + "compile": "hardhat compile --force && npm run generate", + "clean": "hardhat clean && rm -rf artifacts && rm -rf cache", + "generate": "hardhat export-abi && typechain ./abi/**.json --target truffle-v5 --out-dir ./typechain-types" + } +} diff --git a/test/fixture-projects/hardhat-project-minimal-ethers/.gitignore b/test/fixture-projects/hardhat-project/.gitignore similarity index 100% rename from test/fixture-projects/hardhat-project-minimal-ethers/.gitignore rename to test/fixture-projects/hardhat-project/.gitignore diff --git a/test/fixture-projects/hardhat-project-minimal/contracts/GovToken.sol b/test/fixture-projects/hardhat-project/contracts/GovToken.sol similarity index 100% rename from test/fixture-projects/hardhat-project-minimal/contracts/GovToken.sol rename to test/fixture-projects/hardhat-project/contracts/GovToken.sol diff --git a/test/fixture-projects/hardhat-project-minimal/contracts/libs/TimestampClockLib.sol b/test/fixture-projects/hardhat-project/contracts/libs/TimestampClockLib.sol similarity index 100% rename from test/fixture-projects/hardhat-project-minimal/contracts/libs/TimestampClockLib.sol rename to test/fixture-projects/hardhat-project/contracts/libs/TimestampClockLib.sol diff --git a/test/fixture-projects/hardhat-project-minimal/contracts/libs/VotingPowerLib.sol b/test/fixture-projects/hardhat-project/contracts/libs/VotingPowerLib.sol similarity index 100% rename from test/fixture-projects/hardhat-project-minimal/contracts/libs/VotingPowerLib.sol rename to test/fixture-projects/hardhat-project/contracts/libs/VotingPowerLib.sol diff --git a/test/fixture-projects/hardhat-project/hardhat.config.ts b/test/fixture-projects/hardhat-project/hardhat.config.ts new file mode 100644 index 00000000..1996edf0 --- /dev/null +++ b/test/fixture-projects/hardhat-project/hardhat.config.ts @@ -0,0 +1,3 @@ +import config from "../hardhat.config"; + +export default config; diff --git a/test/fixture-projects/hardhat-project-invalid-config/package.json b/test/fixture-projects/hardhat-project/package.json similarity index 77% rename from test/fixture-projects/hardhat-project-invalid-config/package.json rename to test/fixture-projects/hardhat-project/package.json index 62cb4948..8fa516b8 100644 --- a/test/fixture-projects/hardhat-project-invalid-config/package.json +++ b/test/fixture-projects/hardhat-project/package.json @@ -1,5 +1,5 @@ { - "name": "hardhat-project-invalid-config", + "name": "hardhat-project", "version": "1.0.0", "scripts": { "compile": "hardhat compile --force", diff --git a/test/fixture-projects/hardhat.config.ts b/test/fixture-projects/hardhat.config.ts index e52b8670..301640da 100644 --- a/test/fixture-projects/hardhat.config.ts +++ b/test/fixture-projects/hardhat.config.ts @@ -1,8 +1,17 @@ +import { HardhatUserConfig } from "hardhat/config"; + +import "hardhat-abi-exporter"; + import "@nomicfoundation/hardhat-ethers"; -import { HardhatUserConfig } from "hardhat/config"; +import "../../src"; const config: HardhatUserConfig = { + networks: { + hardhat: { + initialDate: "1970-01-01T00:00:00Z", + }, + }, solidity: { version: "0.8.20", settings: { @@ -13,6 +22,9 @@ const config: HardhatUserConfig = { evmVersion: "paris", }, }, + abiExporter: { + flat: true, + }, }; export default config; diff --git a/test/helpers.ts b/test/helpers.ts index d5d76463..11ffaba2 100644 --- a/test/helpers.ts +++ b/test/helpers.ts @@ -2,17 +2,22 @@ import { join } from "path"; import { resetHardhatContext } from "hardhat/plugins-testing"; +import { resetNetworkManager } from "../src/tools/network/NetworkManager"; +import { resetEthersProvider } from "../src/tools/network/EthersProvider"; +import { resetTransactionRunner } from "../src/tools/runners/TransactionRunner"; + export function useEnvironment(fixtureProjectName: string, networkName = "hardhat") { beforeEach("Loading hardhat environment", async function () { + resetEthersProvider(); + resetNetworkManager(); + resetTransactionRunner(); + const prefix = "hardhat-project-"; process.chdir(join(__dirname, "fixture-projects", prefix + fixtureProjectName)); process.env.HARDHAT_NETWORK = networkName; this.hre = require("hardhat"); - // TODO: Delete this at the end of the refactor - await this.hre.run("clean"); - await this.hre.run("compile", { quiet: true }); }); diff --git a/test/integration/adapters/ethersAdapter.ts b/test/integration/adapters/ethersAdapter.ts deleted file mode 100644 index 346d2fad..00000000 --- a/test/integration/adapters/ethersAdapter.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { expect } from "chai"; -import { ContractFactory, Interface } from "ethers"; - -import { useEnvironment } from "../../helpers"; - -import { Migrator } from "../../../src/migrator/Migrator"; - -import { EthersFactoryAdapter } from "../../../src/deployer/adapters/EthersFactoryAdapter"; -import { EthersContractAdapter } from "../../../src/deployer/adapters/EthersContractAdapter"; - -import { ContractWithConstructorArguments__factory } from "../../fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types"; - -describe("EthersAdapter", () => { - describe("getContractDeployParams()", () => { - const contractWithConstructorABI = [ - { - inputs: [ - { - internalType: "string", - name: "_name", - type: "string", - }, - ], - stateMutability: "nonpayable", - type: "constructor", - }, - { - inputs: [], - name: "name", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], - stateMutability: "view", - type: "function", - }, - ] as const; - - const contractWithConstructorBytecode = - "0x608060405234801561001057600080fd5b5060405161033e38038061033e8339818101604052602081101561003357600080fd5b810190808051604051939291908464010000000082111561005357600080fd5b8382019150602082018581111561006957600080fd5b825186600182028301116401000000008211171561008657600080fd5b8083526020830192505050908051906020019080838360005b838110156100ba57808201518184015260208101905061009f565b50505050905090810190601f1680156100e75780820380516001836020036101000a031916815260200191505b50604052505050806000908051906020019061010492919061010b565b50506101a8565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061014c57805160ff191683800117855561017a565b8280016001018555821561017a579182015b8281111561017957825182559160200191906001019061015e565b5b509050610187919061018b565b5090565b5b808211156101a457600081600090555060010161018c565b5090565b610187806101b76000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806306fdde0314610030575b600080fd5b6100386100b3565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561007857808201518184015260208101905061005d565b50505050905090810190601f1680156100a55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156101495780601f1061011e57610100808354040283529160200191610149565b820191906000526020600020905b81548152906001019060200180831161012c57829003601f168201915b50505050508156fea2646970667358221220fafcb337be24b0cc0bd237410e96c0372e20d83b64721391a45edbe34a57235764736f6c63430007030033"; - - let ethersAdapter: EthersContractAdapter; - let pureEhtersAdapter: EthersFactoryAdapter; - - describe("pure ethers", () => { - useEnvironment("minimal-ethers"); - - let ContractWithConstructor: ContractFactory; - - beforeEach("setup", async function () { - await Migrator.buildMigrateTaskDeps(this.hre); - - pureEhtersAdapter = new EthersFactoryAdapter(this.hre); - - ContractWithConstructor = (new ContractWithConstructorArguments__factory()); - }); - - it("should get abi", async () => { - const abi = pureEhtersAdapter.getInterface(ContractWithConstructor); - - expect(abi).to.deep.equal(Interface.from(contractWithConstructorABI)); - }); - - it("should get bytecode", async () => { - const bytecode = pureEhtersAdapter.getRawBytecode(ContractWithConstructor); - - expect(bytecode).to.equal(contractWithConstructorBytecode); - }); - }); - - describe("with typechain", () => { - useEnvironment("minimal-typechain-ethers"); - - beforeEach(async function () { - await Migrator.buildMigrateTaskDeps(this.hre); - - ethersAdapter = new EthersContractAdapter(this.hre); - }); - - it("should get abi", async () => { - const abi = ethersAdapter.getInterface(ContractWithConstructorArguments__factory); - - expect(abi).to.deep.equal(Interface.from(contractWithConstructorABI)); - }); - - it("should get bytecode", async () => { - const bytecode = ethersAdapter.getRawBytecode(ContractWithConstructorArguments__factory); - - expect(bytecode).to.equal(contractWithConstructorBytecode); - }); - }); - }); -}); diff --git a/test/integration/adapters/truffleAdapter.ts b/test/integration/adapters/truffleAdapter.ts deleted file mode 100644 index 5f7b037a..00000000 --- a/test/integration/adapters/truffleAdapter.ts +++ /dev/null @@ -1,104 +0,0 @@ -import { TruffleContract } from "@nomiclabs/hardhat-truffle5/dist/src/types"; - -import { expect } from "chai"; -import { Interface } from "ethers"; - -import { useEnvironment } from "../../helpers"; - -import { Migrator } from "../../../src/migrator/Migrator"; - -import { resetEthersProvider } from "../../../src/tools/network/EthersProvider"; -import { resetNetworkManager } from "../../../src/tools/network/NetworkManager"; - -import { TruffleAdapter } from "../../../src/deployer/adapters/TruffleAdapter"; - -describe("TruffleAdapter", () => { - describe("getContractDeployParams()", () => { - const contractWithConstructorABI = [ - { - inputs: [ - { - internalType: "string", - name: "_name", - type: "string", - }, - ], - stateMutability: "nonpayable", - type: "constructor", - }, - { - inputs: [], - name: "name", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], - stateMutability: "view", - type: "function", - }, - ] as const; - - const contractWithConstructorBytecode = - "0x608060405234801561001057600080fd5b5060405161033e38038061033e8339818101604052602081101561003357600080fd5b810190808051604051939291908464010000000082111561005357600080fd5b8382019150602082018581111561006957600080fd5b825186600182028301116401000000008211171561008657600080fd5b8083526020830192505050908051906020019080838360005b838110156100ba57808201518184015260208101905061009f565b50505050905090810190601f1680156100e75780820380516001836020036101000a031916815260200191505b50604052505050806000908051906020019061010492919061010b565b50506101a8565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061014c57805160ff191683800117855561017a565b8280016001018555821561017a579182015b8281111561017957825182559160200191906001019061015e565b5b509050610187919061018b565b5090565b5b808211156101a457600081600090555060010161018c565b5090565b610187806101b76000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806306fdde0314610030575b600080fd5b6100386100b3565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561007857808201518184015260208101905061005d565b50505050905090810190601f1680156100a55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156101495780601f1061011e57610100808354040283529160200191610149565b820191906000526020600020905b81548152906001019060200180831161012c57829003601f168201915b50505050508156fea2646970667358221220fafcb337be24b0cc0bd237410e96c0372e20d83b64721391a45edbe34a57235764736f6c63430007030033"; - - let adapter: TruffleAdapter; - - describe("with pure truffle", () => { - useEnvironment("minimal-truffle"); - - let contractWithConstructorArtifact: TruffleContract; - - beforeEach("setup", async function () { - resetEthersProvider(); - resetNetworkManager(); - - await Migrator.buildMigrateTaskDeps(this.hre); - - adapter = new TruffleAdapter(this.hre); - - contractWithConstructorArtifact = await this.hre.artifacts.require("ContractWithConstructorArguments"); - }); - - it("should get abi", async () => { - const abi = adapter.getInterface(contractWithConstructorArtifact); - - expect(abi).to.deep.equal(Interface.from(contractWithConstructorABI)); - }); - - it("should get bytecode", async () => { - const bytecode = adapter.getRawBytecode(contractWithConstructorArtifact); - - expect(bytecode).to.equal(contractWithConstructorBytecode); - }); - }); - - describe("with typechain", () => { - useEnvironment("minimal-typechain-truffle"); - - let contractWithConstructorArtifact: TruffleContract; - - beforeEach("setup", async function () { - await Migrator.buildMigrateTaskDeps(this.hre); - - adapter = new TruffleAdapter(this.hre); - - contractWithConstructorArtifact = await this.hre.artifacts.require("ContractWithConstructorArguments"); - }); - - it("should get abi", async () => { - const abi = adapter.getInterface(contractWithConstructorArtifact); - - expect(abi).to.deep.equal(Interface.from(contractWithConstructorABI)); - }); - - it("should get bytecode", async () => { - const bytecode = adapter.getRawBytecode(contractWithConstructorArtifact); - - expect(bytecode).to.equal(contractWithConstructorBytecode); - }); - }); - }); -}); diff --git a/test/integration/config.ts b/test/integration/config.ts deleted file mode 100644 index 40ef773a..00000000 --- a/test/integration/config.ts +++ /dev/null @@ -1,148 +0,0 @@ -import { join } from "path"; - -import { assert, expect } from "chai"; - -import { HardhatPluginError } from "hardhat/plugins"; -import { resetHardhatContext } from "hardhat/plugins-testing"; - -import { extendConfig } from "hardhat/config"; - -import { useEnvironment } from "../helpers"; - -import { migrateConfigExtender } from "../../src/config"; - -import { resetNetworkManager } from "../../src/tools/network/NetworkManager"; - -import { MigrateConfig } from "../../src/types/migrations"; - -describe("config", () => { - describe("loading", () => { - useEnvironment("defined-config"); - - let loadedOptions: MigrateConfig; - - beforeEach(function () { - loadedOptions = this.hre.config.migrate; - }); - - it("should apply from", async function () { - assert.equal(loadedOptions.from, 1); - }); - - it("should apply to", async function () { - assert.equal(loadedOptions.to, 5); - }); - - it("should apply only", async function () { - assert.equal(loadedOptions.only, 2); - }); - - it("should apply skip", async function () { - assert.equal(loadedOptions.skip, 1); - }); - - it("should apply wait", async function () { - assert.equal(loadedOptions.wait, 2); - }); - - it("should apply verify", async function () { - assert.isTrue(loadedOptions.verify); - }); - - it("should apply verifyAttempts", async function () { - assert.equal(loadedOptions.verifyAttempts, 5); - }); - - it("should apply verifyParallel", async function () { - assert.equal(loadedOptions.verifyParallel, 4); - }); - - it("should apply pathToMigrations", async function () { - assert.equal(loadedOptions.pathToMigrations, "./deploy/"); - }); - - it("should apply force", async function () { - assert.isTrue(loadedOptions.force); - }); - - it("should apply continue", async function () { - assert.isTrue(loadedOptions.continue); - }); - }); - - describe("validation", () => { - const fixtureProjectName = "invalid-config"; - - it("should throw if pathToMigrations is not a relevant path", async function () { - expect(() => { - const prefix = "hardhat-project-"; - process.chdir(join(__dirname, "../", "fixture-projects", prefix + fixtureProjectName)); - process.env.HARDHAT_NETWORK = "hardhat"; - - require("hardhat"); - }).to.throw(HardhatPluginError, "config.migrate.pathToMigrations must be a relative path"); - - resetHardhatContext(); - resetNetworkManager(); - }); - }); - - describe("extension", () => { - useEnvironment("undefined-config"); - - let loadedOptions: MigrateConfig; - - beforeEach(function () { - extendConfig(migrateConfigExtender); - loadedOptions = this.hre.config.migrate; - }); - - it("the migrate field should be present", function () { - assert.isDefined(loadedOptions); - }); - - it("should set to default from", async function () { - assert.equal(loadedOptions.from, -1); - }); - - it("should set to default to", async function () { - assert.equal(loadedOptions.to, -1); - }); - - it("should set to default only", async function () { - assert.equal(loadedOptions.only, -1); - }); - - it("should set to default skip", async function () { - assert.equal(loadedOptions.skip, -1); - }); - - it("should set to default wait", async function () { - assert.equal(loadedOptions.wait, 1); - }); - - it("should set to default verify", async function () { - assert.equal(loadedOptions.verify, false); - }); - - it("should set to default verifyAttempts", async function () { - assert.equal(loadedOptions.verifyAttempts, 3); - }); - - it("should set to default verifyParallel", async function () { - assert.equal(loadedOptions.verifyParallel, 1); - }); - - it("should set to default pathToMigrations", async function () { - assert.equal(loadedOptions.pathToMigrations, "./deploy"); - }); - - it("should set to default force", async function () { - assert.isFalse(loadedOptions.force); - }); - - it("should set to default continue", async function () { - assert.isFalse(loadedOptions.continue); - }); - }); -}); diff --git a/test/integration/deployer/base-contract-interaction.ts b/test/integration/deployer/base-contract-interaction.ts new file mode 100644 index 00000000..b3a17627 --- /dev/null +++ b/test/integration/deployer/base-contract-interaction.ts @@ -0,0 +1,56 @@ +import chai, { expect } from "chai"; +import chaiAsPromised from "chai-as-promised"; + +chai.use(chaiAsPromised); + +import { useEnvironment } from "../../helpers"; + +import { + ConstructorWithArguments__factory, + PayableConstructor__factory, +} from "../../fixture-projects/hardhat-project-typechain-ethers/typechain-types"; + +import { Deployer } from "../../../src/deployer/Deployer"; +import { Migrator } from "../../../src/migrator/Migrator"; + +import { ethersProvider } from "../../../src/tools/network/EthersProvider"; +import { TransactionStorage } from "../../../src/tools/storage/MigrateStorage"; + +import { resetTransactionRunner } from "../../../src/tools/runners/TransactionRunner"; +import { resetReporter } from "../../../src/tools/reporters/Reporter"; + +describe("deployer", () => { + let deployer: Deployer; + + describe("default interaction with contracts", () => { + useEnvironment("typechain-ethers"); + + beforeEach("setup", async function () { + await Migrator.buildMigrateTaskDeps(this.hre); + + deployer = new Deployer(this.hre); + + TransactionStorage.clear(); + }); + + it("should deploy contract with constructor arguments", async function () { + const contract = await deployer.deploy(ConstructorWithArguments__factory, [1], {}); + + expect(await contract.value()).to.equal(1n); + }); + + it("should deploy contract with ethers", async function () { + const toPay = 100n; + + const contract = await deployer.deploy(PayableConstructor__factory, [], { value: toPay }); + + expect(await ethersProvider!.provider.getBalance(contract.getAddress())).to.equal(toPay); + }); + + it("should revert if artifact is not a contract", async function () { + await expect(deployer.deploy({} as any, [], {})).to.be.rejectedWith( + "Deployer.deploy(): Unknown Contract Factory Type", + ); + }); + }); +}); diff --git a/test/integration/deployer/deployEthers.ts b/test/integration/deployer/deployEthers.ts deleted file mode 100644 index c112f224..00000000 --- a/test/integration/deployer/deployEthers.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { expect } from "chai"; -import { Contract, ContractFactory } from "ethers"; - -import { useEnvironment } from "../../helpers"; - -import { Deployer } from "../../../src/deployer/Deployer"; -import { Migrator } from "../../../src/migrator/Migrator"; - -import { ethersProvider } from "../../../src/tools/network/EthersProvider"; -import { TransactionStorage } from "../../../src/tools/storage/MigrateStorage"; -import { - ContractWithConstructorArguments__factory, - ContractWithPayableConstructor__factory, -} from "../../fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types"; - -describe("deployer", () => { - describe("deploy()", () => { - useEnvironment("minimal-ethers"); - - let deployer: Deployer; - let ContractWithConstructor: ContractFactory; - let ContractWithPayableConstructor: ContractFactory; - - beforeEach("setup", async function () { - await Migrator.buildMigrateTaskDeps(this.hre); - - deployer = new Deployer(this.hre); - - TransactionStorage.clear(); - - ContractWithConstructor = >( - (new ContractWithConstructorArguments__factory()) - ); - ContractWithPayableConstructor = >( - (new ContractWithPayableConstructor__factory()) - ); - }); - - it("should deploy contract with constructor arguments", async function () { - const contract = await deployer.deploy(ContractWithConstructor, ["test"], {}); - - const name = await contract.name(); - - expect(name).to.equal("test"); - }); - - it("should deploy contract with ethers", async function () { - const value = BigInt(1); - - const contract = await deployer.deploy(ContractWithPayableConstructor, [], { value: value }); - - expect(await ethersProvider!.provider.getBalance(contract.getAddress())).to.equal(value); - }); - - it("should revert if artifact is not a contract", async function () { - await expect(deployer.deploy({} as any, [], {})).to.be.rejected; - }); - }); -}); diff --git a/test/integration/deployer/deployTruffle.ts b/test/integration/deployer/deployTruffle.ts deleted file mode 100644 index 396996e2..00000000 --- a/test/integration/deployer/deployTruffle.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { TruffleContract } from "@nomiclabs/hardhat-truffle5/dist/src/types"; - -import { expect } from "chai"; - -import { useEnvironment } from "../../helpers"; - -import { Deployer } from "../../../src/deployer/Deployer"; -import { Migrator } from "../../../src/migrator/Migrator"; - -import { resetEthersProvider } from "../../../src/tools/network/EthersProvider"; -import { resetNetworkManager } from "../../../src/tools/network/NetworkManager"; -import { TransactionStorage } from "../../../src/tools/storage/MigrateStorage"; - -describe("Truffle -- deployer", () => { - describe("deploy()", () => { - useEnvironment("minimal-truffle"); - - let deployer: Deployer; - let contractWithConstructorArtifact: TruffleContract; - - beforeEach("setup", async function () { - resetEthersProvider(); - resetNetworkManager(); - - await Migrator.buildMigrateTaskDeps(this.hre); - - deployer = new Deployer(this.hre); - - TransactionStorage.clear(); - - contractWithConstructorArtifact = await this.hre.artifacts.require("ContractWithConstructorArguments"); - }); - - it("should deploy contract with constructor arguments", async function () { - const contract: TruffleContract = await deployer.deploy(contractWithConstructorArtifact, ["test"], {}); - - const name = await contract.name(); - - expect(name).to.equal("test"); - }); - - it("should revert if artifact is not a contract", async function () { - await expect(deployer.deploy({} as any, [], {})).to.be.rejected; - }); - }); -}); diff --git a/test/integration/deployer/deployTypechainEthers.ts b/test/integration/deployer/deployTypechainEthers.ts deleted file mode 100644 index e24b831b..00000000 --- a/test/integration/deployer/deployTypechainEthers.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { expect } from "chai"; -import { ZeroAddress } from "ethers"; - -import { useEnvironment } from "../../helpers"; - -import { Migrator } from "../../../src/migrator/Migrator"; -import { Deployer } from "../../../src/deployer/Deployer"; - -import { TransactionStorage } from "../../../src/tools/storage/MigrateStorage"; - -import { - ContractWithConstructorArguments__factory, - ContractWithExternalLibrary__factory, - Library1__factory, - Library2__factory, -} from "../../fixture-projects/hardhat-project-minimal-typechain-ethers/typechain-types"; - -describe("Ehters Typechain -- Deployer", () => { - describe("deploy()", () => { - useEnvironment("minimal-typechain-ethers"); - - let deployer: Deployer; - - beforeEach("setup", async function () { - await Migrator.buildMigrateTaskDeps(this.hre); - - deployer = new Deployer(this.hre); - - TransactionStorage.clear(); - }); - - it("should deploy contract with constructor arguments", async function () { - const contract = await deployer.deploy(ContractWithConstructorArguments__factory, ["test"], {}); - - const name = await contract.name(); - - expect(name).to.equal("test"); - }); - - it("should revert if artifact is not a contract", async function () { - await expect(deployer.deploy(null as any, [], {})).to.be.rejected; - }); - - it("should deploy library separately", async function () { - await expect(deployer.deploy(Library1__factory, [])).to.be.not.rejected; - }); - - it("should deploy contract with provided libraries", async function () { - await expect( - deployer.deploy(ContractWithExternalLibrary__factory, [], { - libraries: { - "contracts/Contracts.sol:Library1": ZeroAddress, - "contracts/Contracts.sol:Library2": ZeroAddress, - }, - }), - ).to.be.not.rejected; - }); - - it("should deploy contract with memorized libraries", async function () { - await deployer.deploy(Library1__factory, []); - await deployer.deploy(Library2__factory, []); - - await expect(deployer.deploy(ContractWithExternalLibrary__factory, [], {})).to.be.not.rejected; - }); - - it("should deploy contract with libraries without libraries pre-deploy", async function () { - await expect(deployer.deploy(ContractWithExternalLibrary__factory, [], {})).to.be.not.rejected; - }); - }); -}); diff --git a/test/integration/deployer/deployTypechainTruffle.ts b/test/integration/deployer/deployTypechainTruffle.ts deleted file mode 100644 index d866a765..00000000 --- a/test/integration/deployer/deployTypechainTruffle.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { expect } from "chai"; -import { ZeroAddress } from "ethers"; - -import { TruffleContract } from "@nomiclabs/hardhat-truffle5/dist/src/types"; - -import { useEnvironment } from "../../helpers"; - -import { Deployer } from "../../../src/deployer/Deployer"; -import { Migrator } from "../../../src/migrator/Migrator"; - -import { TransactionStorage } from "../../../src/tools/storage/MigrateStorage"; -import { resetEthersProvider } from "../../../src/tools/network/EthersProvider"; -import { resetNetworkManager } from "../../../src/tools/network/NetworkManager"; - -describe("Truffle Typechain -- Deployer", () => { - describe("deploy()", () => { - useEnvironment("minimal-typechain-truffle"); - - let contractWithConstructorArtifact: TruffleContract; - let ContractWithExternalLibraryArtifact: TruffleContract; - let library1Artifact: TruffleContract; - let library2Artifact: TruffleContract; - let deployer: Deployer; - - beforeEach("setup", async function () { - library1Artifact = this.hre.artifacts.require("Library1"); - library2Artifact = this.hre.artifacts.require("Library2"); - ContractWithExternalLibraryArtifact = this.hre.artifacts.require("ContractWithExternalLibrary"); - contractWithConstructorArtifact = this.hre.artifacts.require("ContractWithConstructorArguments"); - - resetEthersProvider(); - resetNetworkManager(); - - await Migrator.buildMigrateTaskDeps(this.hre); - - deployer = new Deployer(this.hre); - - TransactionStorage.clear(); - }); - - it("should deploy contract with constructor arguments", async function () { - const contract = await deployer.deploy(contractWithConstructorArtifact, ["test"], {}); - - const name = await (contract as any).name(); - - expect(name).to.equal("test"); - }); - - it("should revert if artifact is not a contract", async function () { - await expect(deployer.deploy(null as any, [], {})).to.be.rejected; - }); - - it("should deploy library separately", async function () { - await expect(deployer.deploy(library1Artifact, [])).to.be.not.rejected; - }); - - it("should deploy contract with provided libraries", async function () { - await expect( - deployer.deploy(ContractWithExternalLibraryArtifact, [], { - libraries: { - "contracts/Contracts.sol:Library1": ZeroAddress, - "contracts/Contracts.sol:Library2": ZeroAddress, - }, - }), - ).to.be.not.rejected; - }); - - it("should deploy contract with memorized libraries", async function () { - await deployer.deploy(library1Artifact, []); - await deployer.deploy(library2Artifact, []); - - await expect(deployer.deploy(ContractWithExternalLibraryArtifact, [], {})).to.be.not.rejected; - }); - - it("should deploy contract without memorized libraries", async function () { - await expect(deployer.deploy(ContractWithExternalLibraryArtifact, [], {})).to.be.not.rejected; - }); - }); -}); diff --git a/test/integration/migration/ethers.test.ts b/test/integration/migration/ethers.test.ts new file mode 100644 index 00000000..15cfc3df --- /dev/null +++ b/test/integration/migration/ethers.test.ts @@ -0,0 +1,50 @@ +import { HardhatRuntimeEnvironment } from "hardhat/types"; + +import { runWithContinue, runWithoutContinue } from "./helper"; + +import { useEnvironment } from "../../helpers"; +import { resetReporter } from "../../../src/tools/reporters/Reporter"; +import { resetTransactionRunner } from "../../../src/tools/runners/TransactionRunner"; + +describe("ethers", () => { + useEnvironment("ethers"); + + let hre: HardhatRuntimeEnvironment; + + beforeEach("setup", async function () { + hre = this.hre; + + resetReporter(); + resetTransactionRunner(); + }); + + describe("simple migration flow", () => { + it("should run migration successfully", async function () { + await runWithoutContinue(hre, 1); + }); + + it("should recover migration successfully", async function () { + await runWithContinue(hre, 1); + }); + }); + + describe("migration flow with libraries pre-deployment", () => { + it("should run migration successfully", async function () { + await runWithoutContinue(hre, 2); + }); + + it("should recover migration successfully", async function () { + await runWithContinue(hre, 2); + }); + }); + + describe("migration flow for edge cases", () => { + it("should run migration successfully", async function () { + await runWithoutContinue(hre, 3); + }); + + it("should recover migration successfully", async function () { + await runWithContinue(hre, 3); + }); + }); +}); diff --git a/test/integration/migration/helper.ts b/test/integration/migration/helper.ts new file mode 100644 index 00000000..efbd0e6b --- /dev/null +++ b/test/integration/migration/helper.ts @@ -0,0 +1,30 @@ +import { expect } from "chai"; + +import { HardhatRuntimeEnvironment } from "hardhat/types"; + +import { TASK_MIGRATE } from "../../../src/constants"; +import { MigrateConfig } from "../../../src/types/migrations"; + +export async function runWithoutContinue(hre: HardhatRuntimeEnvironment, only: number) { + await hre.run(TASK_MIGRATE, { + only, + } as MigrateConfig); +} + +export async function runWithContinue(hre: HardhatRuntimeEnvironment, only: number) { + await hre.run(TASK_MIGRATE, { + only, + } as MigrateConfig); + + const deployer = await hre.ethers.provider.getSigner(); + const deployerBalance = await hre.ethers.provider.getBalance(deployer.address); + + await hre.run(TASK_MIGRATE, { + only, + continue: true, + } as MigrateConfig); + + const deployerBalanceAfter = await hre.ethers.provider.getBalance(deployer.address); + + expect(deployerBalanceAfter).to.be.equal(deployerBalance); +} diff --git a/test/integration/migration/pure-bytecode.test.ts b/test/integration/migration/pure-bytecode.test.ts new file mode 100644 index 00000000..14dc9fe1 --- /dev/null +++ b/test/integration/migration/pure-bytecode.test.ts @@ -0,0 +1,30 @@ +import { HardhatRuntimeEnvironment } from "hardhat/types"; + +import { runWithContinue, runWithoutContinue } from "./helper"; + +import { useEnvironment } from "../../helpers"; +import { resetReporter } from "../../../src/tools/reporters/Reporter"; +import { resetTransactionRunner } from "../../../src/tools/runners/TransactionRunner"; + +describe("pure-bytecode", () => { + useEnvironment("pure-bytecode"); + + let hre: HardhatRuntimeEnvironment; + + beforeEach("setup", async function () { + hre = this.hre; + + resetReporter(); + resetTransactionRunner(); + }); + + describe("simple migration flow", () => { + it("should run migration successfully", async function () { + await runWithoutContinue(hre, 1); + }); + + it("should recover migration successfully", async function () { + await runWithContinue(hre, 1); + }); + }); +}); diff --git a/test/integration/migration/typechain-ethers.test.ts b/test/integration/migration/typechain-ethers.test.ts new file mode 100644 index 00000000..4a35fe89 --- /dev/null +++ b/test/integration/migration/typechain-ethers.test.ts @@ -0,0 +1,50 @@ +import { HardhatRuntimeEnvironment } from "hardhat/types"; + +import { runWithContinue, runWithoutContinue } from "./helper"; + +import { useEnvironment } from "../../helpers"; +import { resetReporter } from "../../../src/tools/reporters/Reporter"; +import { resetTransactionRunner } from "../../../src/tools/runners/TransactionRunner"; + +describe("typechain-ethers", () => { + useEnvironment("typechain-ethers"); + + let hre: HardhatRuntimeEnvironment; + + beforeEach("setup", async function () { + hre = this.hre; + + resetReporter(); + resetTransactionRunner(); + }); + + describe("simple migration flow", () => { + it("should run migration successfully", async function () { + await runWithoutContinue(hre, 1); + }); + + it("should recover migration successfully", async function () { + await runWithContinue(hre, 1); + }); + }); + + describe("migration flow with libraries pre-deployment", () => { + it("should run migration successfully", async function () { + await runWithoutContinue(hre, 2); + }); + + it("should recover migration successfully", async function () { + await runWithContinue(hre, 2); + }); + }); + + describe("migration flow for edge cases", () => { + it("should run migration successfully", async function () { + await runWithoutContinue(hre, 3); + }); + + it("should recover migration successfully", async function () { + await runWithContinue(hre, 3); + }); + }); +}); diff --git a/test/integration/migration/typechain-truffle.test.ts b/test/integration/migration/typechain-truffle.test.ts new file mode 100644 index 00000000..f91d8839 --- /dev/null +++ b/test/integration/migration/typechain-truffle.test.ts @@ -0,0 +1,48 @@ +import { HardhatRuntimeEnvironment } from "hardhat/types"; + +import { runWithContinue, runWithoutContinue } from "./helper"; + +import { useEnvironment } from "../../helpers"; +import { resetReporter } from "../../../src/tools/reporters/Reporter"; +import { resetTransactionRunner } from "../../../src/tools/runners/TransactionRunner"; +import { resetNetworkManager } from "../../../src/tools/network/NetworkManager"; + +describe("typechain-truffle", () => { + useEnvironment("typechain-truffle"); + + let hre: HardhatRuntimeEnvironment; + + beforeEach("setup", async function () { + hre = this.hre; + }); + + describe("simple migration flow", () => { + it("should run migration successfully", async function () { + await runWithoutContinue(hre, 1); + }); + + it("should recover migration successfully", async function () { + await runWithContinue(hre, 1); + }); + }); + + describe("migration flow with libraries pre-deployment", () => { + it("should run migration successfully", async function () { + await runWithoutContinue(hre, 2); + }); + + it("should recover migration successfully", async function () { + await runWithContinue(hre, 2); + }); + }); + + describe("migration flow for edge cases", () => { + it("should run migration successfully", async function () { + await runWithoutContinue(hre, 3); + }); + + it("should recover migration successfully", async function () { + await runWithContinue(hre, 3); + }); + }); +}); diff --git a/test/integration/setup/config.ts b/test/integration/setup/config.ts new file mode 100644 index 00000000..8af1ebd0 --- /dev/null +++ b/test/integration/setup/config.ts @@ -0,0 +1,70 @@ +import { expect } from "chai"; + +import { extendConfig } from "hardhat/config"; + +import { useEnvironment } from "../../helpers"; + +import { migrateConfigExtender } from "../../../src/config"; + +import { MigrateConfig } from "../../../src/types/migrations"; + +describe("config", () => { + describe("loading", () => { + useEnvironment("defined-config"); + + let loadedOptions: MigrateConfig; + + beforeEach(function () { + loadedOptions = this.hre.config.migrate; + }); + + it("should apply user defined config", async function () { + const userDefinedConfig: MigrateConfig = { + from: 1, + to: 3, + only: 2, + skip: 4, + wait: 2, + verify: true, + verifyParallel: 12, + verifyAttempts: 32, + pathToMigrations: "./path-to-deploy", + force: true, + continue: true, + transactionStatusCheckInterval: 4000, + }; + + expect(loadedOptions).to.deep.equal(userDefinedConfig); + }); + }); + + describe("extension", () => { + useEnvironment("undefined-config"); + + let loadedOptions: MigrateConfig; + + beforeEach(function () { + extendConfig(migrateConfigExtender); + loadedOptions = this.hre.config.migrate; + }); + + it("the migrate field should be present", function () { + const defaultConfig: MigrateConfig = { + from: -1, + to: -1, + only: -1, + skip: -1, + wait: 1, + verify: false, + verifyParallel: 1, + verifyAttempts: 3, + pathToMigrations: "./deploy", + force: false, + continue: false, + transactionStatusCheckInterval: 2000, + }; + + expect(loadedOptions).to.deep.equal(defaultConfig); + }); + }); +}); diff --git a/test/integration/transaction-storage.ts b/test/integration/tools/transaction-storage.ts similarity index 62% rename from test/integration/transaction-storage.ts rename to test/integration/tools/transaction-storage.ts index 2c728072..613e1f2f 100644 --- a/test/integration/transaction-storage.ts +++ b/test/integration/tools/transaction-storage.ts @@ -1,24 +1,30 @@ -import { assert, expect } from "chai"; +import chai, { assert, expect } from "chai"; +import chaiAsPromised from "chai-as-promised"; + +chai.use(chaiAsPromised); + import { ContractFactory, ZeroAddress } from "ethers"; -import { useEnvironment } from "../helpers"; +import { useEnvironment } from "../../helpers"; -import { Deployer } from "../../src/deployer/Deployer"; -import { Migrator } from "../../src/migrator/Migrator"; +import { + PayableConstructor__factory, + ConstructorWithArguments__factory, +} from "../../fixture-projects/hardhat-project-typechain-ethers/typechain-types"; -import { UNKNOWN_CONTRACT_NAME } from "../../src/constants"; -import { ContractDeployTxWithName } from "../../src/types/deployer"; +import { Deployer } from "../../../src/deployer/Deployer"; +import { Migrator } from "../../../src/migrator/Migrator"; -import { TransactionStorage } from "../../src/tools/storage/MigrateStorage"; -import { TransactionProcessor } from "../../src/tools/storage/TransactionProcessor"; +import { UNKNOWN_CONTRACT_NAME } from "../../../src/constants"; +import { ContractDeployTxWithName } from "../../../src/types/deployer"; -import { - ContractWithConstructorArguments__factory, - ContractWithPayableConstructor__factory, -} from "../fixture-projects/hardhat-project-repeats-typechain-ethers/typechain-types"; +import { TransactionStorage } from "../../../src/tools/storage/MigrateStorage"; +import { TransactionProcessor } from "../../../src/tools/storage/TransactionProcessor"; +import { resetReporter } from "../../../src/tools/reporters/Reporter"; +import { resetTransactionRunner } from "../../../src/tools/runners/TransactionRunner"; describe("TransactionStorage", async () => { - useEnvironment("repeats-typechain-ethers"); + useEnvironment("typechain-ethers"); beforeEach(async function () { await Migrator.buildMigrateTaskDeps(this.hre); @@ -28,7 +34,7 @@ describe("TransactionStorage", async () => { TransactionStorage.clear(); }); - describe("saveDeploymentTransaction() via Deployer", function () { + describe("transaction saving process in the storage", function () { let deployer: Deployer; beforeEach(function () { @@ -36,16 +42,13 @@ describe("TransactionStorage", async () => { }); it("should save deployment transaction", async function () { - const contract = await deployer.deploy(ContractWithConstructorArguments__factory, ["hello"], { + const contract = await deployer.deploy(PayableConstructor__factory, [], { name: UNKNOWN_CONTRACT_NAME, }); - const factory = new ContractFactory( - ContractWithConstructorArguments__factory.abi, - ContractWithConstructorArguments__factory.bytecode, - ); + const factory = new ContractFactory(PayableConstructor__factory.abi, PayableConstructor__factory.bytecode); - const tx = await factory.getDeployTransaction("hello", { + const tx = await factory.getDeployTransaction({ from: await (await deployer.getSigner()).getAddress(), chainId: await deployer.getChainId(), value: 0, @@ -63,12 +66,10 @@ describe("TransactionStorage", async () => { }); it("should save deployment transaction by name", async function () { - const contract = await deployer.deploy(ContractWithConstructorArguments__factory, ["hello"]); + const contract = await deployer.deploy(PayableConstructor__factory, []); assert.equal( - await TransactionProcessor?.tryRestoreContractAddressByName( - "contracts/another-contracts/Helper.sol:ContractWithConstructorArguments", - ), + await TransactionProcessor?.tryRestoreContractAddressByName("contracts/TestContracts.sol:PayableConstructor"), await contract.getAddress(), ); }); @@ -76,14 +77,11 @@ describe("TransactionStorage", async () => { it("should save deployment transaction with transmitted ether", async function () { const value = BigInt(1); - const contract = await deployer.deploy(ContractWithPayableConstructor__factory, [], { + const contract = await deployer.deploy(PayableConstructor__factory, [], { value: value, name: UNKNOWN_CONTRACT_NAME, }); - const factory = new ContractFactory( - ContractWithPayableConstructor__factory.abi, - ContractWithPayableConstructor__factory.bytecode, - ); + const factory = new ContractFactory(PayableConstructor__factory.abi, PayableConstructor__factory.bytecode); const tx = await factory.getDeployTransaction({ value: value, @@ -103,14 +101,14 @@ describe("TransactionStorage", async () => { }); it("should differ contracts with chainId", async function () { - await deployer.deploy(ContractWithConstructorArguments__factory, ["hello"]); + await deployer.deploy(ConstructorWithArguments__factory, [100n]); const factory = new ContractFactory( - ContractWithConstructorArguments__factory.abi, - ContractWithConstructorArguments__factory.bytecode, + ConstructorWithArguments__factory.abi, + ConstructorWithArguments__factory.bytecode, ); - const data = await factory.getDeployTransaction("hello", { + const data = await factory.getDeployTransaction(100n, { chainId: 1, from: await (await deployer.getSigner()).getAddress(), value: 0, @@ -127,14 +125,14 @@ describe("TransactionStorage", async () => { }); it("should differ contracts with from", async function () { - await deployer.deploy(ContractWithConstructorArguments__factory, ["hello"]); + await deployer.deploy(ConstructorWithArguments__factory, [100n]); const factory = new ContractFactory( - ContractWithConstructorArguments__factory.abi, - ContractWithConstructorArguments__factory.bytecode, + ConstructorWithArguments__factory.abi, + ConstructorWithArguments__factory.bytecode, ); - const tx = await factory.getDeployTransaction("hello", { + const tx = await factory.getDeployTransaction(100n, { from: ZeroAddress, chainId: await deployer.getChainId(), value: 0, @@ -151,16 +149,16 @@ describe("TransactionStorage", async () => { }); it("should not differ contracts with nonce", async function () { - const contract = await deployer.deploy(ContractWithConstructorArguments__factory, ["hello"], { + const contract = await deployer.deploy(ConstructorWithArguments__factory, [100n], { name: UNKNOWN_CONTRACT_NAME, }); const factory = new ContractFactory( - ContractWithConstructorArguments__factory.abi, - ContractWithConstructorArguments__factory.bytecode, + ConstructorWithArguments__factory.abi, + ConstructorWithArguments__factory.bytecode, ); - const data = await factory.getDeployTransaction("hello", { + const data = await factory.getDeployTransaction(100n, { nonce: 0, from: await (await deployer.getSigner()).getAddress(), chainId: await deployer.getChainId(), @@ -179,14 +177,14 @@ describe("TransactionStorage", async () => { }); it("should differ contracts with args", async function () { - await deployer.deploy(ContractWithConstructorArguments__factory, ["hello"]); + await deployer.deploy(ConstructorWithArguments__factory, [100n]); const factory = new ContractFactory( - ContractWithConstructorArguments__factory.abi, - ContractWithConstructorArguments__factory.bytecode, + ConstructorWithArguments__factory.abi, + ConstructorWithArguments__factory.bytecode, ); - const data = await factory.getDeployTransaction("hello2", { + const data = await factory.getDeployTransaction(200n, { from: await (await deployer.getSigner()).getAddress(), chainId: await deployer.getChainId(), value: 0, From 7649e4270dfb2e898eb8236ee618b5e9f185ac61 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Thu, 21 Dec 2023 21:44:18 +0200 Subject: [PATCH 18/34] Removed Verifier from Migrator class --- src/migrator/Migrator.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/migrator/Migrator.ts b/src/migrator/Migrator.ts index 19a25044..59366fc1 100644 --- a/src/migrator/Migrator.ts +++ b/src/migrator/Migrator.ts @@ -13,7 +13,6 @@ import { MigrateError } from "../errors"; import { MigrateConfig } from "../types/migrations"; import { Deployer } from "../deployer/Deployer"; -import { Verifier } from "../verifier/Verifier"; import { createLinker } from "../deployer/Linker"; @@ -30,7 +29,6 @@ import { createTransactionProcessor } from "../tools/storage/TransactionProcesso export class Migrator { private readonly _deployer: Deployer; - private readonly _verifier: Verifier; private readonly _migrationFiles: string[]; @@ -39,10 +37,6 @@ export class Migrator { private _config: MigrateConfig = _hre.config.migrate, ) { this._deployer = new Deployer(_hre); - this._verifier = new Verifier(_hre, { - parallel: this._config.verifyParallel, - attempts: this._config.verifyAttempts, - }); this._migrationFiles = this._getMigrationFiles(); } @@ -59,7 +53,7 @@ export class Migrator { // eslint-disable-next-line @typescript-eslint/no-var-requires const migration = require(resolvePathToFile(this._config.pathToMigrations, element)); - await migration(this._deployer, this._verifier); + await migration(this._deployer); } catch (e: unknown) { if (e instanceof MigrateError) { throw new HardhatPluginError(pluginName, e.message, e); From 9c72bc567d3fd5e6cc2e17f9ae842c12c906d02b Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Thu, 21 Dec 2023 21:45:19 +0200 Subject: [PATCH 19/34] Removed redundant Hardhat Runtime Extensions --- CHANGELOG.md | 2 ++ src/index.ts | 13 ++----------- src/type-extensions.ts | 11 ----------- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 282ed7df..748dcfeb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Version 2.0.0-beta.1 +* Removed redundant Hardhat Runtime Extensions. +* Removed Verifier from Migrator class. * Revised the test infrastructure and architecture. * Fixed bugs related to the recovery of contract names. * Fixed a bug related to contract recovery when a custom name is used. diff --git a/src/index.ts b/src/index.ts index 7b075c24..8c19dd09 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,9 +1,8 @@ import "@nomicfoundation/hardhat-verify"; import { ActionType } from "hardhat/types"; -import { lazyObject } from "hardhat/plugins"; import { TASK_CLEAN, TASK_COMPILE } from "hardhat/builtin-tasks/task-names"; -import { extendConfig, extendEnvironment, task, types } from "hardhat/config"; +import { extendConfig, task, types } from "hardhat/config"; import "./type-extensions"; @@ -12,7 +11,7 @@ import { TASK_MIGRATE, TASK_MIGRATE_VERIFY } from "./constants"; import { MigrateConfig, MigrateVerifyConfig } from "./types/migrations"; -import { UserStorage, DefaultStorage } from "./tools/storage/MigrateStorage"; +import { DefaultStorage } from "./tools/storage/MigrateStorage"; import { VerificationProcessor } from "./tools/storage/VerificationProcessor"; import { Migrator } from "./migrator/Migrator"; @@ -52,14 +51,6 @@ const migrateVerify: ActionType = async (taskArgs, env) => ); }; -extendEnvironment((hre) => { - hre.migrator = lazyObject(() => { - return new Migrator(hre); - }); - - hre.storage = lazyObject(() => UserStorage); -}); - task(TASK_CLEAN, "Clears the cache and deletes all artifacts").setAction(async (conf, hre, runSuper) => { DefaultStorage.clean(); diff --git a/src/type-extensions.ts b/src/type-extensions.ts index f42f43f8..eba48435 100644 --- a/src/type-extensions.ts +++ b/src/type-extensions.ts @@ -2,12 +2,8 @@ import "ethers"; import "hardhat/types/config"; import "hardhat/types/runtime"; -import { Migrator } from "./migrator/Migrator"; - import { MigrateConfig } from "./types/migrations"; -import { MigrateStorage } from "./tools/storage/MigrateStorage"; - declare module "hardhat/types/config" { interface HardhatConfig { migrate: MigrateConfig; @@ -18,13 +14,6 @@ declare module "hardhat/types/config" { } } -declare module "hardhat/types/runtime" { - export interface HardhatRuntimeEnvironment { - migrator: Migrator; - storage: MigrateStorage; - } -} - declare module "ethers" { interface ContractTransaction { customData: any & { txName?: string }; From 2f5f452c5a34927c4c02e710a8cc5a1ee0a4e15b Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Thu, 21 Dec 2023 21:56:13 +0200 Subject: [PATCH 20/34] Updated README.md --- README.md | 105 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 91 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 31fb9989..af0c2179 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ This is a fairly simple and rather straightforward Hardhat plugin: npm install --save-dev @solarity/hardhat-migrate ``` -And add the following statement to your `hardhat.config.ts`: +And add the following statement to your `hardhat.config.js`: ```js require("@solarity/hardhat-migrate"); @@ -62,10 +62,7 @@ npx hardhat help migrate ## Environment extensions -This plugin extends the Hardhat Runtime Environment by adding the following fields: - -- `deployer` - The deployer object that is used to deploy contracts. -- `verifier` - The verifier object that is used to verify contracts. +This plugin does not extend the Hardhat Runtime Environment. ## Usage @@ -136,25 +133,104 @@ The plugin includes the following packages to perform the deployment and verific The core of this plugin is migration files, you can specify the migration route that suits you best. -[//]: # (You can find an example of migration files in the sample project.) -### Migration Lifecycle +### Migration Sample + +Below is a sample migration file: + +```ts +import { Deployer, Reporter } from "@solarity/hardhat-migrate"; + +import { GovToken__factory } from "../typechain-types"; + +const TOKEN_OWNER = "0x1E3953B6ee74461169A3E346060AE27bD0B5bF2B"; + +export = async (deployer: Deployer) => { + const govToken = await deployer.deploy(GovToken__factory, ["Token", "TKN"]); + + const transferOwnershipTx = (await (await govToken.transferOwnership(TOKEN_OWNER)).wait())!; + + await Reporter.reportTransactionByHash( + transferOwnershipTx.hash, + "Transfer Ownership of Governance Token to Token Owner", + ); + + Reporter.reportContracts([ + `Governance Token ${await govToken.name()} (${await govToken.symbol()}) Address`, + await govToken.getAddress(), + ]); +}; +``` + +This example illustrates the basic principles of how migrations operate: +1. The core component is the `Deployer` object, which acts as a wrapper for the [@ethers](https://www.npmjs.com/package/ethers) +library, facilitating the deployment and processing of contracts. +2. The `Reporter` class, a static entity, logs intermediary information into the console. +3. It is required to import contract factories, or, in the case of Truffle, the necessary Truffle Contract Instance that need to be deployed. +4. Define all relevant constants as necessary. +5. The migration file's main body grants access to the deployer object, allowing for contract deployment and supporting +recovery from failures in previous migration runs. +6. Standard transaction-sending processes are used without special wrappers. +7. The migration concludes with the `Reporter` class summarizing the migration details. -The migration files are sorted by the first digit in the file name and run one after the other in ascending order. +### Migration Lifecycle -Parameters: `from`, `to`, `only` and `skip` affect the selection of the migration files. +Migration files are executed in ascending order, sorted by the first digit in the file name. +Parameters such as `from`, `to`, `only`, and `skip` influence the selection of migration files. ### Deployer -Deployer contains the following functionality: +The Deployer offers several functionalities: + +--- + +- **deploy(contractInstance, argsOrParameters, parameters)**: + +Utilizes `ContractFactory` from [@ethers](https://www.npmjs.com/package/ethers) to deploy contracts, inferring types and providing enhanced functionalities like transaction recovery and reporting. It also stores deployment transaction data for later contract verification. + +--- + +- **deployed(contractInstance, contractIdentifier)**: + +Returns the deployed contract instance, inferring types and enhancing functionalities for comfortable interaction. + +--- + +- **sendNative(to, value, name <- optional)**: + +Facilitates sending native assets to a specified address, primarily for the recovery process. + +--- + +- **getSigner(from <- optional)**: + +Retrieves an ethers signer for use in migrations. + +--- + +- **getChainId()**: + +Identifies the current chain ID for the deployment. + +### Reporter + +The Reporter, a static class, provides functionalities like: + +--- + +- **reportTransactionByHash(hash, name <- optional)**: + +Retrieves and displays transaction receipts with standard formatting. + +--- -- **deploy()** +- **reportContracts(...contracts: [string, string][])**: -Under the hood, it uses `ContractFactory` from [@ethers](https://www.npmjs.com/package/ethers) to deploy the contracts. +Displays a list of contract names and addresses in a table format. -- **deployed()** +--- -Returns the deployed contract instance. +The usage of these functionalities is demonstrated in the sample migration file above. ### Transactions @@ -197,3 +273,4 @@ If verification fails, the `attempts` parameter indicates how many additional re - This plugin, as well as the [Hardhat Toolbox](https://hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-toolbox) plugin, use the [@nomicfoundation/hardhat-verify](https://www.npmjs.com/package/@nomicfoundation/hardhat-verify) plugin internally, so both of these plugins cannot be imported at the same time. A quick fix is to manually import the needed plugins that ToolBox imports. - Adding, removing, moving or renaming new contracts to the hardhat project or reorganizing the directory structure of contracts after deployment may alter the resulting bytecode in some solc versions. See this [Solidity issue](https://github.com/ethereum/solidity/issues/9573) for further information. +- This plugin does not function properly with native Truffle methods, such as in `contract.deployed()`, unless otherwise specified above at the instance level. Instead, it is necessary to use the `deployer.deploy()` method. From 0d168a4d2f415fb189d8318d63c8f060810851cc Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Thu, 21 Dec 2023 22:23:14 +0200 Subject: [PATCH 21/34] Tested usage of the link function of the Truffle contract. --- README.md | 9 ++++++++ package.json | 2 +- src/tools/storage/TransactionProcessor.ts | 4 ---- .../deploy/3_plenty.of.stuff.migration.ts | 23 +++++++++++++------ 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index af0c2179..27bc9341 100644 --- a/README.md +++ b/README.md @@ -232,6 +232,15 @@ Displays a list of contract names and addresses in a table format. The usage of these functionalities is demonstrated in the sample migration file above. +#### Truffle native functions + +Most of the functions exposed by the Truffle contract, which directly impact or create the Truffle Contract Instance, are not supported. + +The following function is supported: +- link + +For a usage example, see the deployment scripts in the fixture project created to test how plugins work with Truffle. + ### Transactions We have introduced the capability to assign a specific name to each transaction, enhancing its entropy. diff --git a/package.json b/package.json index 9e1b9cf9..1d83d45b 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "postpack": "pinst --enable", "build": "tsc --build .", "prepare-tests": "npm run compile --workspaces", - "test": "npm run prepare-tests && mocha --recursive 'test/**/*.ts' --exit && npm run lint-fix", + "test": "npm run prepare-tests && mocha --recursive 'test/**/*.ts' --exit", "clean-tests": "npm run clean --workspaces", "lint-fix": "prettier --write \"./**/*.ts\" && eslint \"src/**/*.{js,ts}\" --cache --fix", "publish-to-npm": "npm run build && npm run lint-fix && npm publish ./ --access public" diff --git a/src/tools/storage/TransactionProcessor.ts b/src/tools/storage/TransactionProcessor.ts index 46d33a65..6e1916b5 100644 --- a/src/tools/storage/TransactionProcessor.ts +++ b/src/tools/storage/TransactionProcessor.ts @@ -52,10 +52,6 @@ export class BaseTransactionProcessor { this._saveContract(keyByArgs, dataToSave); this._saveContractByName(contractName, dataToSave); - - if (metadata.fullyQualifiedContractName) { - TransactionStorage.set(metadata.fullyQualifiedContractName, dataToSave, true); - } } /** diff --git a/test/fixture-projects/hardhat-project-typechain-truffle/deploy/3_plenty.of.stuff.migration.ts b/test/fixture-projects/hardhat-project-typechain-truffle/deploy/3_plenty.of.stuff.migration.ts index 8fc4a25c..f7bdeb47 100644 --- a/test/fixture-projects/hardhat-project-typechain-truffle/deploy/3_plenty.of.stuff.migration.ts +++ b/test/fixture-projects/hardhat-project-typechain-truffle/deploy/3_plenty.of.stuff.migration.ts @@ -1,13 +1,16 @@ import { Deployer } from "../../../../src/deployer/Deployer"; import { PublicReporter as Reporter } from "../../../../src/tools/reporters/PublicReporter"; -const GovToken = artifacts.require("GovToken"); const VotingPowerLib = artifacts.require("VotingPowerLib"); const TimestampClockLib = artifacts.require("TimestampClockLib"); const TOKEN_OWNER = "0x1E3953B6ee74461169A3E346060AE27bD0B5bF2B"; export = async (deployer: Deployer) => { + // Moved here for testing reasons, before it was initialized globally once and failed on the second test on the .link function. + // Because Truffle throws an error if attempting to link the same object twice to the same library. + const GovToken = artifacts.require("GovToken"); + await deployer.deploy(VotingPowerLib, { name: "VotingPowerLib #1" }); await deployer.deploy(VotingPowerLib, { name: "VotingPowerLib #5" }); await deployer.deploy(VotingPowerLib, { name: "VotingPowerLib #6" }); @@ -24,12 +27,18 @@ export = async (deployer: Deployer) => { TimestampClockLib: (await deployer.deployed(TimestampClockLib, "TimestampClockLib #5")).address, }, }); - await deployer.deploy(GovToken, ["Token", "TKN"], { - name: "Governance Token #6", - libraries: { - VotingPowerLib: (await deployer.deployed(VotingPowerLib, "VotingPowerLib #5")).address, - }, - }); + + const votingPowerLib = await VotingPowerLib.at( + (await deployer.deployed(VotingPowerLib, "VotingPowerLib #5")).address, + ); + const timestampClockLib = await TimestampClockLib.at( + (await deployer.deployed(TimestampClockLib, "TimestampClockLib #5")).address, + ); + + GovToken.link(votingPowerLib as any); + GovToken.link(timestampClockLib as any); + + await deployer.deploy(GovToken, ["Token", "TKN"]); const govToken5 = await deployer.deployed(GovToken, "Governance Token #5"); From 03b71ec5414fcd5b7aec472b862d7ab7823f14bf Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Thu, 21 Dec 2023 22:31:55 +0200 Subject: [PATCH 22/34] Updated package-lock.json --- package-lock.json | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 24db9f24..aca22c69 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,7 @@ "@openzeppelin/contracts": "^5.0.1", "@typechain/ethers-v6": "^0.5.0", "@typechain/hardhat": "^9.1.0", - "@typechain/truffle-v5": "8.0.6", + "@typechain/truffle-v5": "^8.0.7", "@types/chai": "^4.3.11", "@types/chai-as-promised": "^7.1.8", "@types/mocha": "^10.0.6", @@ -4879,9 +4879,9 @@ } }, "node_modules/@typechain/truffle-v5": { - "version": "8.0.6", - "resolved": "https://registry.npmjs.org/@typechain/truffle-v5/-/truffle-v5-8.0.6.tgz", - "integrity": "sha512-0G8rAQVpJcW2rCJUMBfq/D4FxWk3sBwxzywUYQc0vngV514Yv1JtU8L3W0lNjXoDRjABdNzksrZ0He6IcxFDpw==", + "version": "8.0.7", + "resolved": "https://registry.npmjs.org/@typechain/truffle-v5/-/truffle-v5-8.0.7.tgz", + "integrity": "sha512-zdc71/G8Zs3RZCmUCKDAXlUUGbom/GZFCgjXX8e0LEh1/eFWtdMSgiK5bluLEpLoP+rKUcJuQtCO68IQ6dboQg==", "dev": true, "dependencies": { "lodash": "^4.17.15" @@ -13920,10 +13920,6 @@ "resolved": "test/fixture-projects/hardhat-project-ethers", "link": true }, - "node_modules/hardhat-project-invalid-config": { - "resolved": "test/fixture-projects/hardhat-project-invalid-config", - "link": true - }, "node_modules/hardhat-project-pure-bytecode": { "resolved": "test/fixture-projects/hardhat-project-pure-bytecode", "link": true @@ -21388,7 +21384,8 @@ "version": "1.0.0" }, "test/fixture-projects/hardhat-project-invalid-config": { - "version": "1.0.0" + "version": "1.0.0", + "extraneous": true }, "test/fixture-projects/hardhat-project-minimal": { "version": "1.0.0", From 8a46ff03d9cabe164f50b1de8cc6e5b9ea421f37 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Fri, 22 Dec 2023 14:03:19 +0200 Subject: [PATCH 23/34] Updated License and the Solidity compiler version --- src/tools/network/EthersProvider.ts | 3 +++ .../hardhat-project-ethers/contracts/GovToken.sol | 4 ++-- .../contracts/libs/TimestampClockLib.sol | 4 ++-- .../hardhat-project-ethers/contracts/libs/VotingPowerLib.sol | 4 ++-- .../hardhat-project-pure-bytecode/contracts/GovToken.sol | 4 ++-- .../contracts/libs/TimestampClockLib.sol | 4 ++-- .../contracts/libs/VotingPowerLib.sol | 4 ++-- .../hardhat-project-typechain-ethers/contracts/GovToken.sol | 4 ++-- .../contracts/TestContracts.sol | 4 ++-- .../contracts/libs/TimestampClockLib.sol | 4 ++-- .../contracts/libs/VotingPowerLib.sol | 4 ++-- .../hardhat-project-typechain-truffle/contracts/GovToken.sol | 4 ++-- .../contracts/libs/TimestampClockLib.sol | 4 ++-- .../contracts/libs/VotingPowerLib.sol | 4 ++-- test/fixture-projects/hardhat-project/contracts/GovToken.sol | 4 ++-- .../hardhat-project/contracts/libs/TimestampClockLib.sol | 4 ++-- .../hardhat-project/contracts/libs/VotingPowerLib.sol | 4 ++-- 17 files changed, 35 insertions(+), 32 deletions(-) diff --git a/src/tools/network/EthersProvider.ts b/src/tools/network/EthersProvider.ts index 3bf91cf9..aa77bad0 100644 --- a/src/tools/network/EthersProvider.ts +++ b/src/tools/network/EthersProvider.ts @@ -17,6 +17,9 @@ export function createEthersProvider(hre: HardhatRuntimeEnvironment): void { ethersProvider = new HardhatEthersProvider(hre.network.provider, hre.network.name); } +/** + * Used only in test environments to ensure test atomicity + */ export function resetEthersProvider(): void { ethersProvider = null; } diff --git a/test/fixture-projects/hardhat-project-ethers/contracts/GovToken.sol b/test/fixture-projects/hardhat-project-ethers/contracts/GovToken.sol index 7f4cc7d7..e10f61d3 100644 --- a/test/fixture-projects/hardhat-project-ethers/contracts/GovToken.sol +++ b/test/fixture-projects/hardhat-project-ethers/contracts/GovToken.sol @@ -1,5 +1,5 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol"; diff --git a/test/fixture-projects/hardhat-project-ethers/contracts/libs/TimestampClockLib.sol b/test/fixture-projects/hardhat-project-ethers/contracts/libs/TimestampClockLib.sol index 3517a813..05317385 100644 --- a/test/fixture-projects/hardhat-project-ethers/contracts/libs/TimestampClockLib.sol +++ b/test/fixture-projects/hardhat-project-ethers/contracts/libs/TimestampClockLib.sol @@ -1,5 +1,5 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; import {Time} from "@openzeppelin/contracts/utils/types/Time.sol"; import {Votes} from "@openzeppelin/contracts/governance/utils/Votes.sol"; diff --git a/test/fixture-projects/hardhat-project-ethers/contracts/libs/VotingPowerLib.sol b/test/fixture-projects/hardhat-project-ethers/contracts/libs/VotingPowerLib.sol index 1480bc7f..6f666af4 100644 --- a/test/fixture-projects/hardhat-project-ethers/contracts/libs/VotingPowerLib.sol +++ b/test/fixture-projects/hardhat-project-ethers/contracts/libs/VotingPowerLib.sol @@ -1,5 +1,5 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; import "@openzeppelin/contracts/utils/math/Math.sol"; diff --git a/test/fixture-projects/hardhat-project-pure-bytecode/contracts/GovToken.sol b/test/fixture-projects/hardhat-project-pure-bytecode/contracts/GovToken.sol index 7f4cc7d7..e10f61d3 100644 --- a/test/fixture-projects/hardhat-project-pure-bytecode/contracts/GovToken.sol +++ b/test/fixture-projects/hardhat-project-pure-bytecode/contracts/GovToken.sol @@ -1,5 +1,5 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol"; diff --git a/test/fixture-projects/hardhat-project-pure-bytecode/contracts/libs/TimestampClockLib.sol b/test/fixture-projects/hardhat-project-pure-bytecode/contracts/libs/TimestampClockLib.sol index 3517a813..05317385 100644 --- a/test/fixture-projects/hardhat-project-pure-bytecode/contracts/libs/TimestampClockLib.sol +++ b/test/fixture-projects/hardhat-project-pure-bytecode/contracts/libs/TimestampClockLib.sol @@ -1,5 +1,5 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; import {Time} from "@openzeppelin/contracts/utils/types/Time.sol"; import {Votes} from "@openzeppelin/contracts/governance/utils/Votes.sol"; diff --git a/test/fixture-projects/hardhat-project-pure-bytecode/contracts/libs/VotingPowerLib.sol b/test/fixture-projects/hardhat-project-pure-bytecode/contracts/libs/VotingPowerLib.sol index 1480bc7f..6f666af4 100644 --- a/test/fixture-projects/hardhat-project-pure-bytecode/contracts/libs/VotingPowerLib.sol +++ b/test/fixture-projects/hardhat-project-pure-bytecode/contracts/libs/VotingPowerLib.sol @@ -1,5 +1,5 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; import "@openzeppelin/contracts/utils/math/Math.sol"; diff --git a/test/fixture-projects/hardhat-project-typechain-ethers/contracts/GovToken.sol b/test/fixture-projects/hardhat-project-typechain-ethers/contracts/GovToken.sol index 7f4cc7d7..e10f61d3 100644 --- a/test/fixture-projects/hardhat-project-typechain-ethers/contracts/GovToken.sol +++ b/test/fixture-projects/hardhat-project-typechain-ethers/contracts/GovToken.sol @@ -1,5 +1,5 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol"; diff --git a/test/fixture-projects/hardhat-project-typechain-ethers/contracts/TestContracts.sol b/test/fixture-projects/hardhat-project-typechain-ethers/contracts/TestContracts.sol index 61829bef..2ac1fa2f 100644 --- a/test/fixture-projects/hardhat-project-typechain-ethers/contracts/TestContracts.sol +++ b/test/fixture-projects/hardhat-project-typechain-ethers/contracts/TestContracts.sol @@ -1,5 +1,5 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; contract PayableConstructor { constructor() payable {} diff --git a/test/fixture-projects/hardhat-project-typechain-ethers/contracts/libs/TimestampClockLib.sol b/test/fixture-projects/hardhat-project-typechain-ethers/contracts/libs/TimestampClockLib.sol index 3517a813..05317385 100644 --- a/test/fixture-projects/hardhat-project-typechain-ethers/contracts/libs/TimestampClockLib.sol +++ b/test/fixture-projects/hardhat-project-typechain-ethers/contracts/libs/TimestampClockLib.sol @@ -1,5 +1,5 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; import {Time} from "@openzeppelin/contracts/utils/types/Time.sol"; import {Votes} from "@openzeppelin/contracts/governance/utils/Votes.sol"; diff --git a/test/fixture-projects/hardhat-project-typechain-ethers/contracts/libs/VotingPowerLib.sol b/test/fixture-projects/hardhat-project-typechain-ethers/contracts/libs/VotingPowerLib.sol index 1480bc7f..6f666af4 100644 --- a/test/fixture-projects/hardhat-project-typechain-ethers/contracts/libs/VotingPowerLib.sol +++ b/test/fixture-projects/hardhat-project-typechain-ethers/contracts/libs/VotingPowerLib.sol @@ -1,5 +1,5 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; import "@openzeppelin/contracts/utils/math/Math.sol"; diff --git a/test/fixture-projects/hardhat-project-typechain-truffle/contracts/GovToken.sol b/test/fixture-projects/hardhat-project-typechain-truffle/contracts/GovToken.sol index 7f4cc7d7..e10f61d3 100644 --- a/test/fixture-projects/hardhat-project-typechain-truffle/contracts/GovToken.sol +++ b/test/fixture-projects/hardhat-project-typechain-truffle/contracts/GovToken.sol @@ -1,5 +1,5 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol"; diff --git a/test/fixture-projects/hardhat-project-typechain-truffle/contracts/libs/TimestampClockLib.sol b/test/fixture-projects/hardhat-project-typechain-truffle/contracts/libs/TimestampClockLib.sol index 3517a813..05317385 100644 --- a/test/fixture-projects/hardhat-project-typechain-truffle/contracts/libs/TimestampClockLib.sol +++ b/test/fixture-projects/hardhat-project-typechain-truffle/contracts/libs/TimestampClockLib.sol @@ -1,5 +1,5 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; import {Time} from "@openzeppelin/contracts/utils/types/Time.sol"; import {Votes} from "@openzeppelin/contracts/governance/utils/Votes.sol"; diff --git a/test/fixture-projects/hardhat-project-typechain-truffle/contracts/libs/VotingPowerLib.sol b/test/fixture-projects/hardhat-project-typechain-truffle/contracts/libs/VotingPowerLib.sol index 1480bc7f..6f666af4 100644 --- a/test/fixture-projects/hardhat-project-typechain-truffle/contracts/libs/VotingPowerLib.sol +++ b/test/fixture-projects/hardhat-project-typechain-truffle/contracts/libs/VotingPowerLib.sol @@ -1,5 +1,5 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; import "@openzeppelin/contracts/utils/math/Math.sol"; diff --git a/test/fixture-projects/hardhat-project/contracts/GovToken.sol b/test/fixture-projects/hardhat-project/contracts/GovToken.sol index 7f4cc7d7..e10f61d3 100644 --- a/test/fixture-projects/hardhat-project/contracts/GovToken.sol +++ b/test/fixture-projects/hardhat-project/contracts/GovToken.sol @@ -1,5 +1,5 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol"; diff --git a/test/fixture-projects/hardhat-project/contracts/libs/TimestampClockLib.sol b/test/fixture-projects/hardhat-project/contracts/libs/TimestampClockLib.sol index 3517a813..05317385 100644 --- a/test/fixture-projects/hardhat-project/contracts/libs/TimestampClockLib.sol +++ b/test/fixture-projects/hardhat-project/contracts/libs/TimestampClockLib.sol @@ -1,5 +1,5 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; import {Time} from "@openzeppelin/contracts/utils/types/Time.sol"; import {Votes} from "@openzeppelin/contracts/governance/utils/Votes.sol"; diff --git a/test/fixture-projects/hardhat-project/contracts/libs/VotingPowerLib.sol b/test/fixture-projects/hardhat-project/contracts/libs/VotingPowerLib.sol index 1480bc7f..6f666af4 100644 --- a/test/fixture-projects/hardhat-project/contracts/libs/VotingPowerLib.sol +++ b/test/fixture-projects/hardhat-project/contracts/libs/VotingPowerLib.sol @@ -1,5 +1,5 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.7.0 <0.9.0; +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; import "@openzeppelin/contracts/utils/math/Math.sol"; From b73fa22027fe5abe0f27fcffbb0cd5da99a4ed47 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Fri, 22 Dec 2023 14:05:20 +0200 Subject: [PATCH 24/34] Added comments for reset functions --- src/tools/network/NetworkManager.ts | 3 +++ src/tools/reporters/Reporter.ts | 3 +++ src/tools/runners/TransactionRunner.ts | 3 +++ 3 files changed, 9 insertions(+) diff --git a/src/tools/network/NetworkManager.ts b/src/tools/network/NetworkManager.ts index d57e9ce3..4644aca8 100644 --- a/src/tools/network/NetworkManager.ts +++ b/src/tools/network/NetworkManager.ts @@ -96,6 +96,9 @@ export function buildNetworkDeps(hre: HardhatRuntimeEnvironment) { networkManager = new NetworkManager(); } +/** + * Used only in test environments to ensure test atomicity + */ export function resetNetworkManager() { networkManager = null; } diff --git a/src/tools/reporters/Reporter.ts b/src/tools/reporters/Reporter.ts index d4da7d37..07c9acc4 100644 --- a/src/tools/reporters/Reporter.ts +++ b/src/tools/reporters/Reporter.ts @@ -454,6 +454,9 @@ export async function createAndInitReporter(hre: HardhatRuntimeEnvironment) { await Reporter.init(hre); } +/** + * Used only in test environments to ensure test atomicity + */ export function resetReporter() { Reporter = null; } diff --git a/src/tools/runners/TransactionRunner.ts b/src/tools/runners/TransactionRunner.ts index f2c553e0..f37ff095 100644 --- a/src/tools/runners/TransactionRunner.ts +++ b/src/tools/runners/TransactionRunner.ts @@ -77,6 +77,9 @@ export function createTransactionRunner(hre: HardhatRuntimeEnvironment) { TransactionRunner = new BaseTransactionRunner(hre.config.migrate); } +/** + * Used only in test environments to ensure test atomicity + */ export function resetTransactionRunner() { TransactionRunner = null; } From cb355985793792e87cc05b45ae53acb7edec335b Mon Sep 17 00:00:00 2001 From: Kyrylo Riabov Date: Fri, 22 Dec 2023 14:07:26 +0200 Subject: [PATCH 25/34] Update README.md Co-authored-by: Artem Chystiakov <47551140+Arvolear@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 27bc9341..b2a07992 100644 --- a/README.md +++ b/README.md @@ -175,7 +175,7 @@ recovery from failures in previous migration runs. ### Migration Lifecycle -Migration files are executed in ascending order, sorted by the first digit in the file name. +Migration files are executed in ascending order, sorted by the ordinal file number (the number in the file name). Parameters such as `from`, `to`, `only`, and `skip` influence the selection of migration files. ### Deployer From d873bb6a4d269fd8052a51d74744f6684d9f2c28 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Fri, 22 Dec 2023 14:43:36 +0200 Subject: [PATCH 26/34] Updated README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b2a07992..f3d0e27a 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ The core of this plugin is migration files, you can specify the migration route ### Migration Sample -Below is a sample migration file: +Below is a sample migration file (1_simple.migration.ts): ```ts import { Deployer, Reporter } from "@solarity/hardhat-migrate"; @@ -167,7 +167,7 @@ This example illustrates the basic principles of how migrations operate: library, facilitating the deployment and processing of contracts. 2. The `Reporter` class, a static entity, logs intermediary information into the console. 3. It is required to import contract factories, or, in the case of Truffle, the necessary Truffle Contract Instance that need to be deployed. -4. Define all relevant constants as necessary. +4. All relevant constants can be defined if necessary. 5. The migration file's main body grants access to the deployer object, allowing for contract deployment and supporting recovery from failures in previous migration runs. 6. Standard transaction-sending processes are used without special wrappers. From 0d915f7c7e797c3299506f7fcd4d7bbda1a95ad4 Mon Sep 17 00:00:00 2001 From: Artem Chystiakov <47551140+Arvolear@users.noreply.github.com> Date: Fri, 22 Dec 2023 14:55:26 +0200 Subject: [PATCH 27/34] Update README.md --- README.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f3d0e27a..d8363447 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,16 @@ ## What -This plugin helps you deploy and automatically verify the source code for your Solidity contracts on [Etherscan](https://etherscan.io)-based explorers and explorers compatible with its API like [Blockscout](https://www.blockscout.com/). +This plugin helps you deploy and verify the source code for your Solidity contracts through the specification of migrations. With sleek UX, the plugin enables users to: -This is a fairly simple and rather straightforward Hardhat plugin: - -- For deployment, it uses [@ethers](https://www.npmjs.com/package/ethers). - -- For verification, it uses [@nomicfoundation/hardhat-verify](https://www.npmjs.com/package/@nomicfoundation/hardhat-verify). +- Specify custom smart contracts deployment rules and configuration via [@ethers](https://www.npmjs.com/package/ethers). +- Relax from the source code verification hassle due to seamless integration with [@nomicfoundation/hardhat-verify](https://www.npmjs.com/package/@nomicfoundation/hardhat-verify). +- Enjoy full Typechain support for `Ethers-v6`, `Ethers-v5`, and `Truffle`. +- Leverage the "migration recovery mode" that automatically syncs up the deployment to the last failed transaction. +- Observe the real-time status of transactions being executed. +- Benefit from "reconnection spinner" if the network goes down during the deployment. +- Simplify the `libraries` usage via auto-linking mechanics. +- And much more. ## Installation @@ -136,7 +139,7 @@ The core of this plugin is migration files, you can specify the migration route ### Migration Sample -Below is a sample migration file (1_simple.migration.ts): +Below is a sample migration file: ```ts import { Deployer, Reporter } from "@solarity/hardhat-migrate"; @@ -163,11 +166,12 @@ export = async (deployer: Deployer) => { ``` This example illustrates the basic principles of how migrations operate: + 1. The core component is the `Deployer` object, which acts as a wrapper for the [@ethers](https://www.npmjs.com/package/ethers) library, facilitating the deployment and processing of contracts. 2. The `Reporter` class, a static entity, logs intermediary information into the console. 3. It is required to import contract factories, or, in the case of Truffle, the necessary Truffle Contract Instance that need to be deployed. -4. All relevant constants can be defined if necessary. +4. Define all relevant constants as necessary. 5. The migration file's main body grants access to the deployer object, allowing for contract deployment and supporting recovery from failures in previous migration runs. 6. Standard transaction-sending processes are used without special wrappers. From 35b8dcfd0b522114174ad3e4692fa8c41bf1a095 Mon Sep 17 00:00:00 2001 From: Artem Chystiakov <47551140+Arvolear@users.noreply.github.com> Date: Fri, 22 Dec 2023 14:57:28 +0200 Subject: [PATCH 28/34] Update README.md --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d8363447..506ab7dd 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,8 @@ Or, if you are using TypeScript, add this to your `hardhat.config.ts`: import "@solarity/hardhat-migrate"; ``` -> **Important**. - -See [How it works](https://github.com/dl-solarity/hardhat-migrate#how-it-works) for further information. +> [!NOTE] +> See [How it works](https://github.com/dl-solarity/hardhat-migrate#how-it-works) for further information. ## Naming convention From 39ac9c0fb76491b7bec41a6f4dae83dfbd3473e0 Mon Sep 17 00:00:00 2001 From: Artem Chystiakov <47551140+Arvolear@users.noreply.github.com> Date: Fri, 22 Dec 2023 14:59:05 +0200 Subject: [PATCH 29/34] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 506ab7dd..c8cec09e 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,8 @@ It is also **mandatory** to specify the naming convention for migrations such as - `migrate` task, which allows you to deploy and automatically verify contracts. - `migrate:verify` task, which helps you verify already deployed contracts. -> :warning: **Hardhat Config**: Make sure they are follow the docs from `@nomicfoundation/hardhat-verify`. +> [!WARNING] +> **Hardhat Config**: Make sure they are follow the docs from `@nomicfoundation/hardhat-verify`. Do not import `@solarity/hardhat-migrate` and `@nomicfoundation/hardhat-verify`, `@nomicfoundation/hardhat-ethers` together, the etherscan plugin is already included in the migrate plugin. From 9120786744974c5f1aa389fd305b48429e0c9c2b Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Fri, 22 Dec 2023 15:01:39 +0200 Subject: [PATCH 30/34] Updated versions --- CHANGELOG.md | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 748dcfeb..e9b26b1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Version 2.0.0-beta.1 +## Version 2.0.0 * Removed redundant Hardhat Runtime Extensions. * Removed Verifier from Migrator class. diff --git a/package-lock.json b/package-lock.json index aca22c69..a6798b51 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@solarity/hardhat-migrate", - "version": "2.0.0-beta.1", + "version": "2.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@solarity/hardhat-migrate", - "version": "2.0.0-beta.1", + "version": "2.0.0", "hasInstallScript": true, "license": "MIT", "workspaces": [ diff --git a/package.json b/package.json index 1d83d45b..9efb1786 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@solarity/hardhat-migrate", - "version": "2.0.0-beta.1", + "version": "2.0.0", "description": "Automatic deployment and verification of smart contracts", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", From 4e784f2e207e9e5ae4e640268aa5f4c126e01e28 Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Fri, 22 Dec 2023 15:06:22 +0200 Subject: [PATCH 31/34] Updated README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c8cec09e..6dde9663 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,7 @@ The core of this plugin is migration files, you can specify the migration route ### Migration Sample -Below is a sample migration file: +Below is a sample migration file (1_simple.migration.ts): ```ts import { Deployer, Reporter } from "@solarity/hardhat-migrate"; @@ -171,7 +171,7 @@ This example illustrates the basic principles of how migrations operate: library, facilitating the deployment and processing of contracts. 2. The `Reporter` class, a static entity, logs intermediary information into the console. 3. It is required to import contract factories, or, in the case of Truffle, the necessary Truffle Contract Instance that need to be deployed. -4. Define all relevant constants as necessary. +4. All relevant constants can be defined if necessary. 5. The migration file's main body grants access to the deployer object, allowing for contract deployment and supporting recovery from failures in previous migration runs. 6. Standard transaction-sending processes are used without special wrappers. From 558137d6d42857e52599c1c76412468195fbbdff Mon Sep 17 00:00:00 2001 From: Kyryl R Date: Fri, 22 Dec 2023 15:13:30 +0200 Subject: [PATCH 32/34] Updated README.md --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6dde9663..a9cd9681 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ module.exports = { - `only` : The number of the migration that will be applied. **Overrides from and to parameters.** - `skip`: The number of migration to skip. **Overrides only parameter.** - `wait` : The number of confirmations to wait for after the transaction is mined. -- `verify` : The flag indicating whether the contracts should be verified. +- `verify` : The flag indicating whether the contracts should be verified immediately after all migrations. - `verifyParallel` : The size of the batch for verification. - `verifyAttempts` : The number of attempts to verify the contract. - `pathToMigrations` : The path to the folder with the specified migrations. @@ -115,7 +115,9 @@ You can set your own migrations and deploy the contracts to the network you want npx hardhat migrate --network sepolia --verify --only 2 ``` -In this case, only the migration that begins with digit 2 will be applied. The plugin will also try to automatically verify the deployed contracts. +In this case, only the migration that begins with digit 2 will be applied. +The plugin will also attempt to automatically verify the deployed contracts after all contracts are deployed +and the migration process is complete. #### Or with from/to parameters @@ -286,4 +288,4 @@ If verification fails, the `attempts` parameter indicates how many additional re - This plugin, as well as the [Hardhat Toolbox](https://hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-toolbox) plugin, use the [@nomicfoundation/hardhat-verify](https://www.npmjs.com/package/@nomicfoundation/hardhat-verify) plugin internally, so both of these plugins cannot be imported at the same time. A quick fix is to manually import the needed plugins that ToolBox imports. - Adding, removing, moving or renaming new contracts to the hardhat project or reorganizing the directory structure of contracts after deployment may alter the resulting bytecode in some solc versions. See this [Solidity issue](https://github.com/ethereum/solidity/issues/9573) for further information. -- This plugin does not function properly with native Truffle methods, such as in `contract.deployed()`, unless otherwise specified above at the instance level. Instead, it is necessary to use the `deployer.deploy()` method. +- This plugin does not function properly with native Truffle methods, such as in `contract.deployed()`, unless otherwise specified above at the instance level. For instance, instead of using `contract.deployed()`, it is necessary to use the `deployer.deploy()` method. From 3787a1b8ded1fed77ed5a689ecad9344fc92feb4 Mon Sep 17 00:00:00 2001 From: Artem Chystiakov <47551140+Arvolear@users.noreply.github.com> Date: Fri, 22 Dec 2023 16:04:59 +0200 Subject: [PATCH 33/34] Update README.md --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a9cd9681..72102a7a 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ module.exports = { - `only` : The number of the migration that will be applied. **Overrides from and to parameters.** - `skip`: The number of migration to skip. **Overrides only parameter.** - `wait` : The number of confirmations to wait for after the transaction is mined. -- `verify` : The flag indicating whether the contracts should be verified immediately after all migrations. +- `verify` : The flag indicating whether the contracts have to be verified after all migrations. - `verifyParallel` : The size of the batch for verification. - `verifyAttempts` : The number of attempts to verify the contract. - `pathToMigrations` : The path to the folder with the specified migrations. @@ -116,8 +116,8 @@ npx hardhat migrate --network sepolia --verify --only 2 ``` In this case, only the migration that begins with digit 2 will be applied. -The plugin will also attempt to automatically verify the deployed contracts after all contracts are deployed -and the migration process is complete. + +The plugin will also attempt to automatically verify the deployed contracts after all migrations are complete. #### Or with from/to parameters @@ -138,7 +138,6 @@ The plugin includes the following packages to perform the deployment and verific The core of this plugin is migration files, you can specify the migration route that suits you best. - ### Migration Sample Below is a sample migration file (1_simple.migration.ts): @@ -288,4 +287,4 @@ If verification fails, the `attempts` parameter indicates how many additional re - This plugin, as well as the [Hardhat Toolbox](https://hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-toolbox) plugin, use the [@nomicfoundation/hardhat-verify](https://www.npmjs.com/package/@nomicfoundation/hardhat-verify) plugin internally, so both of these plugins cannot be imported at the same time. A quick fix is to manually import the needed plugins that ToolBox imports. - Adding, removing, moving or renaming new contracts to the hardhat project or reorganizing the directory structure of contracts after deployment may alter the resulting bytecode in some solc versions. See this [Solidity issue](https://github.com/ethereum/solidity/issues/9573) for further information. -- This plugin does not function properly with native Truffle methods, such as in `contract.deployed()`, unless otherwise specified above at the instance level. For instance, instead of using `contract.deployed()`, it is necessary to use the `deployer.deploy()` method. +- This plugin does not function properly with native Truffle methods, such as in `contract.deployed()`, unless otherwise specified above at the instance level. For example, instead of using `contract.deployed()`, it is necessary to use the `deployer.deploy()` method. From 2cbbb6016edf7276c15d335fffa101f77e5cd110 Mon Sep 17 00:00:00 2001 From: Artem Chystiakov <47551140+Arvolear@users.noreply.github.com> Date: Fri, 22 Dec 2023 16:08:53 +0200 Subject: [PATCH 34/34] Update README.md --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 72102a7a..801c88c0 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ You can set your own migrations and deploy the contracts to the network you want #### With only parameter -```console +```bash npx hardhat migrate --network sepolia --verify --only 2 ``` @@ -121,7 +121,7 @@ The plugin will also attempt to automatically verify the deployed contracts afte #### Or with from/to parameters -```console +```bash npx hardhat migrate --network sepolia --from 1 --to 2 ``` @@ -254,7 +254,8 @@ This feature varies depending on the framework used. #### Ethers.js Usage: In Ethers.js, you can specify the transaction name using the `customData` field within the overrides. -A special field, `txName`, is dedicated for this purpose. +A special field, `txName`, is dedicated for this purpose. + Here’s an example of how to set a transaction name using Ethers.js: ```javascript