1

Here is my A contract:

// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;

contract A {
    B public b;

    constructor() public {
        b = new B();
    }
}

contract B {}

As you can see, it is deploying an instance of B in its constructor. For me, both A & B are important, so I want to verify them both on etherscan.

But while using truffle-plugin-verify, I am getting this error:

pam@g3:~/verify$ truffle run verify A B --network kovan --license MIT
Verifying A
Pass - Verified: https://kovan.etherscan.io/address/0xaf589F7A115b14C3825937bBd8A59203c84BE9c5#contracts
Verifying B
No instance of contract B found for network id 42
Failed to verify 1 contract(s): B

How can I verify the contract B here?

1 Answer 1

1

It is possible to specify the address of B separately. So in this case you have to manually figure out what address B was deployed to and run:

truffle run verify B@<address> --network kovan

If B was deployed from a contract and it has constructor arguments, you'd also need to manually retrieve those arguments (e.g. through Tenderly) and provide the ABI-encoded args with --forceConstructorArgs string:<constructorArgs>.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.