Mainnet deploying array of addresses as constructor parameter in Remix Solidity smart contract does not work

Viewed 3071

I'm trying to deploy a smart contract to the mainnet via Remix/Metamask. I have an array of addresses for the constructor parameter and can't get the transaction accepted. I have tried both double quotes "" and single '' around each address. Anyone have an idea of how to write the array parameter so that it's interpreted as an array and not string (see picture)?

The error message in remix

Thanks!

1 Answers

You just need to pass in the array of addresses in double quotes. For example,

pragma solidity ^0.4.25;

contract Test {
  address[] mAddrs;
  event Deployed(address indexed theaddr);

  constructor(address[] addrs) public {
    mAddrs = addrs;

    for (uint8 i = 0; i < mAddrs.length; i++)
      emit Deployed(mAddrs[i]);
  }
}

Deploy with argument set to ["0xca35b7d915458ef540ade6068dfe2f44e8fa733c", "0x14723a09acff6d2a60dcdf7aa4aff308fddc160c", "0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"]

Result (notice first address shows up in the log output): enter image description here

Related