My contract is as follows:
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract ERC20Mock is ERC20 {
uint8 private immutable decimal;
constructor(string memory _name, string memory _symbol, uint8 _decimal) ERC20(_name, _symbol) {
decimal = _decimal;
}
function mint(address _to, uint256 _amount) external {
_mint(_to, _amount);
}
function decimals() public view override returns (uint8) {
return decimal;
}
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;
import {ERC20Mock} from "./ERC20Mock.sol";
contract TokenFactory {
function CreateToken(
string memory _name,
string memory _symbol,
uint8 _decimal
) external returns (address) {
ERC20Mock newToken = new ERC20Mock(_name,_symbol, _decimal);
return address(newToken);
}
}
Current situation: I have verified the TokenFactory.sol contract in etherscan. But the contract deployed by calling the CreateToken function is not automatically verified, I need to verify it manually.
My question: In the factory mode, the code of the deployed contract is already public, why doesn't etherscan automatically verify it?
In addition: What is the appropriate way to achieve automatic verification?
Thank you for any reply. ![]()