1

I noticed you can actually put 3 arg into the deploy functions

.deploy(0,0,0)

min 3 , what is the purpose of the 3 variables. I. can't seem to find it on the documentation

Documentation Reference : https://docs.ethers.io/v5/api/contract/contract-factory/

let factory = new ethers.ContractFactory(abi, bytecode, signer);
let contract = await factory.deploy(0,0,0);
await contract.deployed() 

I tried this and it's returning 0 fees on metamask tx

    const deployedContract = await factory.deploy(tokenURI, maxQuantity, cost, {
  gasLimit: 2,
  gasPrice: ethers.utils.parseUnits(price, price_unit),
})
1
  • Please share your constrat's constructor. Sep 2, 2022 at 8:47

1 Answer 1

-1

These argument seem to be the contract constructor's arguments. Indeed, from the documentation:

contractFactory.deploy( ...args [ , overrides ] )

And, from their example:

const abi = [
  "constructor(address owner, uint256 initialValue)",
  "function value() view returns (uint)"
];
// other stuff
contract = await factory.deploy("ricmoo.eth", 42);

Notice that the ABI specifies two arguments, the owner (address) and the initialValue (uint), and the deploy function provides two arguments, a string* and an integer.

So, back to your question about deploy(0,0,0), it seems to correspond to three integers that should be declared in your contract's constructor.

Or I am completely wrong and it refers to this:

If the optional overrides is specified, they can be used to override the endowment value, transaction nonce, gasLimit or gasPrice.

*I am not sure about that one, but it seems that this string refers to an address.

2
  • I tried ("ricmoo.eth", 42), it wont work, it needs 3 ("ricmoo.eth", 42, another random number)
    – CodeGuru
    Sep 2, 2022 at 8:42
  • ALso, the ABI you posted, is actually for factory = new ContractFactory(abi, bytecode, signer) which i already have a value for
    – CodeGuru
    Sep 2, 2022 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.