cgewecke / eth-gas-reporter

Gas usage per unit test. Average gas usage per method. A mocha reporter.
MIT License
603 stars 94 forks source link

Fix: doesn't check contract name, check only method. #287

Closed ray-themedium closed 1 year ago

ray-themedium commented 2 years ago

If exist contracts what have same methods, it returns incorrect gas-reporter table.

$ ls contracts
// same contract without contract name.
MeToken.sol          MyToken.sol
describe("gas reporter test.", async() => {
    it("---->", async () => {
        const signer = (await ethers.getSigners())[0];
        const MyToken = await ethers.getContractFactory('MyToken', signer);

        const myToken = await upgrades.deployProxy(
            MyToken,
            [ethers.utils.parseEther('1000000'), signer.address],
            { initializer: "init", unsafeAllow: ["delegatecall"]}
        )
        console.log(myToken.address);
        await myToken.print();
    });
});

As-is) 스크린샷 2022-04-20 오후 6 56 11 It's return MeToken report.

Fixed) 스크린샷 2022-04-20 오후 6 59 40