I’ve recently “upgraded” my deployment setup to use Hardhat and the latest @openzeppelin/contracts-upgradeable
package.
Unsurprisingly, this means some changes to my smart contract. Unfortunately, while compilation works, I cannot get my contract to successfully deploy, as this error is returned:
{ Error: multiple matching functions (argument="name", value="initialize", code=INVALID_ARGUMENT, version=abi/5.0.10)
at Logger.makeError (/contract/node_modules/@ethersproject/logger/src.ts/index.ts:205:28)
at Logger.throwError (/contract/node_modules/@ethersproject/logger/src.ts/index.ts:217:20)
at Logger.throwArgumentError (/contract/node_modules/@ethersproject/logger/src.ts/index.ts:221:21)
at Interface.getFunction (/contract/node_modules/@ethersproject/abi/src.ts/interface.ts:196:24)
at getInitializerData (/contract/node_modules/@openzeppelin/hardhat-upgrades/src/deploy-proxy.ts:74:46)
at Proxy.deployProxy (/contract/node_modules/@openzeppelin/hardhat-upgrades/src/deploy-proxy.ts:54:18)
at processTicksAndRejections (internal/process/task_queues.js:86:5)
reason: 'multiple matching functions',
code: 'INVALID_ARGUMENT',
argument: 'name',
value: 'initialize' }
Contract code looks like this, and I’m not sure where I’ve gone wrong:
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/presets/ERC721PresetMinterPauserAutoIdUpgradeable.sol";
contract TEST is Initializable, ERC721PresetMinterPauserAutoIdUpgradeable {
function initialize() public initializer {
__ERC721PresetMinterPauserAutoId_init(
"name",
"symbol",
"baseURI"
);
}
...
}