I'm trying to deploy two contracts with a factory that have the same method name.
However, I found the gas report putting two methods with the same name from two different contracts into one entry.
By adding ./test/projects/options/test/differentContractWithSameMethodName.ts (code below)
// eslint-disable-next-line import/no-extraneous-dependencies
import { Contract } from "ethers";
import { ethers } from "hardhat";
describe("setValue", function () {
let Factory;
let VersionA;
let VersionB;
let factory: Contract;
let versionA: Contract;
let versionB: Contract;
before(async function () {
Factory = await ethers.getContractFactory("Factory");
VersionA = await ethers.getContractFactory("VersionA");
VersionB = await ethers.getContractFactory("VersionB");
factory = await Factory.deploy();
await factory.deployVersionA();
versionA = VersionA.attach(await factory.versionA());
await factory.deployVersionB();
versionB = VersionB.attach(await factory.versionB());
});
it("Calling both versionA.setValue and versionB.setValue", async function () {
await versionA.setValue();
await versionB.setValue();
});
});
running npx mocha test/integration/options.a.ts, and by commenting out the setValue(), I found
scenario
output
expected
not calling versionA.setValue() and versionB.setValue()
(1, 1)
(1, 1)
call versionA.setValue() only
(2, 1)
(2, 1)
call versionB.setValue() only
(2, 1)
(1, 2)
call both versionA.setValue() and versionB.setValue()
(3, 1)
(2, 2)
Note: The pair in output and expected field above means the # calls field from the output table of VersionA setValue() and VersionB setValue()
I'm trying to deploy two contracts with a factory that have the same method name. However, I found the gas report putting two methods with the same name from two different contracts into one entry.
By adding
./test/projects/options/test/differentContractWithSameMethodName.ts
(code below)npx mocha test/integration/options.a.ts
, and by commenting out thesetValue()
, I foundversionA.setValue()
andversionB.setValue()
versionA.setValue()
onlyversionB.setValue()
onlyversionA.setValue()
andversionB.setValue()
Note: The pair in output and expected field above means the
# calls
field from the output table ofVersionA setValue()
andVersionB setValue()