I have the following upgradeable contract using @import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

contract StargateSwap is Initializable, AccessControlUpgradeable, PausableUpgradeable {
using SafeERC20 for IERC20;
bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");
uint16 public constant ETH_POOL_ID = 13;

address public stargateRouter;
address public stargateEthVault;
uint16 public dstPoolId;

mapping (address => bool) public validOutputTokens;

function initialize(
    address _stargateRouter, 
    address _stargateEthVault, 
    uint16 _destPoolId, 
    address[] memory _validOutputTokens
) public initializer {
    _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
    _setupRole(OPERATOR_ROLE, _msgSender());
    stargateRouter = _stargateRouter;
    stargateEthVault = _stargateEthVault;
    dstPoolId = _destPoolId;
    for(uint i; i < _validOutputTokens.length; i++) {
        validOutputTokens[_validOutputTokens[i]] = true;

And I am using the following deployment script using hardhat-deploy (https://www.npmjs.com/package/hardhat-deploy)

const STARGATE = require("../constants/stargate.json")

module.exports = async function ({ deployments, getNamedAccounts }) {
    const { deploy } = deployments
    const { deployer } = await getNamedAccounts()

    const stargateRouter = STARGATE.router[hre.network.name];
    const stargateEthVault = STARGATE.ethVault[hre.network.name];
    console.log(`[${hre.network.name}] Stargate Router address: ${stargateRouter}`);
    console.log(`[${hre.network.name}] Stargate ETH vault address: ${stargateEthVault}`);
    console.log(`[${hre.network.name}] Deployer: ${deployer}`);
    await deploy("Fiat24StargateSwap", {
        from: deployer,
        log: true,
        proxy: {
            owner: deployer,
            proxyContract: 'OpenZeppelinTransparentProxy',
            methodName: 'init',
        args: [ stargateRouter, 
        waitConfirmations: 1,

And I get the following error message:

Error: The number of arguments passed to not match the number of argument in the implementation constructor. Please specify the correct number of arguments as part of the deploy options: "args"

2 Answers 2


Looks like your function names don't match. Your script claims it's init but your contract has function initialize. Fix that.

Read more info about hardhat-deploy proxy deployment here.

  • Thank you very much @Lauri Peltonen. I've changed to initialize, but still get the same error.
    – user66732
    Jan 16, 2023 at 18:08

The args option expects the constructor to have the specified arguments. When you need to pass arguments only to a proxy init function then you can do it like this instead:

const deployed = await deploy("YourContract", {
  from: deployer,
  proxy: {
    execute: {
      init: {
        methodName: "initialize",
        args: ["arg1", "arg2"],
    proxyContract: "OpenZeppelinTransparentProxy",
  log: true,
  autoMine: true,

Note that the we use execute instead and don’t specify any args for the constructor itself

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.