I am trying to verify my contracts via etherscan and hardhat. Everything seems fine with contracts without constructor arguments. I do it with
npx hardhat verify ${address} --network goerli
The problem is with one of my contracts that has bytes
argument in the constructor. I can't pass bytes in the command line. Hex strings like "\x01\x02\x03\x04" dont work either. Converted to chars doesn't work also.
Is there a way to write script that passes the arrayified variable as constructor argument?
Following this docs
When the constructor has a complex argument list, you'll need to write a javascript module that exports the argument list. The expected format is the same as a constructor list
you should have a file like arguments.js
module.exports = [
50,
"a string argument",
{
x: 10,
y: 5,
},
// bytes have to be 0x-prefixed
"0xabcdef",
];
this is arguments for a contract. and in commandline:
npx hardhat verify --constructor-args arguments.js DEPLOYED_CONTRACT_ADDRESS