Skip to content

Commit

Permalink
Fixed a bug with the shallow copy and mutation of args (#70)
Browse files Browse the repository at this point in the history
* Fixed a bug with the shallow copy and mutation of args

* Updated versions

* Added ability to retrieve the class name from the contract instance.
  • Loading branch information
KyrylR authored Feb 7, 2024
1 parent 6dd5522 commit c8a5403
Show file tree
Hide file tree
Showing 13 changed files with 311 additions and 270 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# Changelog

## Version 2.1.1

* Fixed a bug related to the shallow copying and mutation of arguments within the `getMethodString` function.
* Added ability to retrieve the class name from the contract instance.

## Version 2.1.0

* Updated packages to their latest versions (updated `@nomicfoundation/hardhat-verify` to version `2.0.4`)
* Added a `save` function to the Deployer class to enable saving the contract to storage without deploying it
* Updated packages to their latest versions (updated `@nomicfoundation/hardhat-verify` to version `2.0.4`).
* Added a `save` function to the Deployer class to enable saving the contract to storage without deploying it.

## Version 2.0.1

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solarity/hardhat-migrate",
"version": "2.1.0",
"version": "2.1.1",
"description": "Automatic deployment and verification of smart contracts",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
Expand Down
6 changes: 2 additions & 4 deletions src/deployer/adapters/EthersContractAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import { BaseContract, ContractRunner, Interface } from "ethers";

import { AbstractEthersAdapter } from "./AbstractEthersAdapter";

import { catchError, getSignerHelper } from "../../utils";

import { UNKNOWN_CONTRACT_NAME } from "../../constants";
import { catchError, getInstanceNameFromClass, getSignerHelper } from "../../utils";

import { EthersContract } from "../../types/adapter";
import { OverridesAndName } from "../../types/deployer";
Expand Down Expand Up @@ -33,7 +31,7 @@ export class EthersContractAdapter extends AbstractEthersAdapter {
return (instance as any).contractName;
}

return UNKNOWN_CONTRACT_NAME;
return getInstanceNameFromClass(instance);
}
}

Expand Down
6 changes: 2 additions & 4 deletions src/deployer/adapters/EthersFactoryAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import { AbstractEthersAdapter } from "./AbstractEthersAdapter";

import { OverridesAndName } from "../../types/deployer";

import { catchError } from "../../utils";

import { UNKNOWN_CONTRACT_NAME } from "../../constants";
import { catchError, getInstanceNameFromClass } from "../../utils";

import { ArtifactProcessor } from "../../tools/storage/ArtifactProcessor";

Expand All @@ -32,7 +30,7 @@ export class EthersFactoryAdapter extends AbstractEthersAdapter {
return (instance as any).contractName;
}

return UNKNOWN_CONTRACT_NAME;
return getInstanceNameFromClass(instance);
}
}

Expand Down
13 changes: 10 additions & 3 deletions src/deployer/adapters/TruffleAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@ import { Adapter } from "./Adapter";

import { MinimalContract } from "../MinimalContract";

import { bytecodeToString, catchError, fillParameters, getMethodString, getSignerHelper } from "../../utils";
import {
bytecodeToString,
catchError,
fillParameters,
getInstanceNameFromClass,
getMethodString,
getSignerHelper,
} from "../../utils";

import { UNKNOWN_CONTRACT_NAME, UNKNOWN_TRANSACTION_NAME } from "../../constants";
import { UNKNOWN_TRANSACTION_NAME } from "../../constants";

import { KeyTransactionFields, MigrationMetadata } from "../../types/tools";
import { EthersContract, Instance, TruffleFactory } from "../../types/adapter";
Expand Down Expand Up @@ -82,7 +89,7 @@ export class TruffleAdapter extends Adapter {
return this._getFullyQualifiedName(instance as any) || (instance as any).contractName;
}

return UNKNOWN_CONTRACT_NAME;
return getInstanceNameFromClass(instance);
}
}

Expand Down
254 changes: 0 additions & 254 deletions src/utils.ts

This file was deleted.

Loading

0 comments on commit c8a5403

Please sign in to comment.