How to pass proper argument when deploying

103 Views Asked by At

I am trying to deploy a contract with the arguments:

 constructor(
        string memory name,
        string memory symbol,
        uint256 initialSupply,
        address _marketingWallet
    )

And this is my deploy.je

const token = await Token.deploy("MYTOKEN", "TOK", 1000000000, "0x047B2f4Da90dA60916CbB007158f3900BcF3084f"); // I changed the value of the marketing address publicly

However, i got the error when deploying:

npx hardhat run --network testnet scripts/deploy.js
Deploying contracts with the account: 
TypeError: no matching function (argument="key", value="address", code=INVALID_ARGUMENT, version=6.5.1)
    at makeError (C:\Users\son\Documents\Crypto Tuto\Hardhat_testbsc\node_modules\ethers\src.ts\utils\errors.ts:670:21)
    at assert (C:\Users\son\Documents\Crypto Tuto\Hardhat_testbsc\node_modules\ethers\src.ts\utils\errors.ts:694:25)
    at assertArgument (C:\Users\son\Documents\Crypto Tuto\Hardhat_testbsc\node_modules\ethers\src.ts\utils\errors.ts:706:5)
    at Interface.getFunctionName (C:\Users\son\Documents\Crypto Tuto\Hardhat_testbsc\node_modules\ethers\src.ts\abi\interface.ts:542:23)
    at buildWrappedMethod (C:\Users\son\Documents\Crypto Tuto\Hardhat_testbsc\node_modules\ethers\src.ts\contract\contract.ts:334:34)
    at BaseContract.getFunction (C:\Users\son\Documents\Crypto Tuto\Hardhat_testbsc\node_modules\ethers\src.ts\contract\contract.ts:841:22)
    at Object.get (C:\Users\son\Documents\Crypto Tuto\Hardhat_testbsc\node_modules\ethers\src.ts\contract\contract.ts:747:39)
    at main (C:\Users\son\Documents\Crypto Tuto\Hardhat_testbsc\scripts\deploy.js:21:39)
    at processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'INVALID_ARGUMENT',
  argument: 'key',
  value: 'address'

Any idea where the error may come from ?

1

There are 1 best solutions below

0
galiullinis On

It looks like you're using an incorrect type of address.

You can easily check the validity of any address using any web3 library, or by using online platforms like https://www.rfctools.com/ethereum-address-validator/.