-
When using ethers.js, we use ContractFactory before we deploy the contract and we must pass it the abi, binary & signer.
When using hardhat (ethers is automatically imported as well), we use getContractFactory and pass it no arguments except the contract name.
Is it correct to assume that getContractFactory is able to automatically pull the abi, binary and signer from the current folder where it finds the SimpleStorage contract? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It is because these are some pre-defined functions by Hardhat: (if you are not technical, promises followed by colons here are returns simply put, whereas the left one is the method signature with parameters, and parameters with a ? are not compulsory - ie optional)
Whereas in Ethers (there is no getter function), we have to do it manually (ie, first creating a ContractFactory instance of our contract, then deploying it) But it is very similar to Ethers because it inherits essentially the same framework, so in Hardhat too, we get the ContractFactory, then deploy it - it is just that Hardhat has a getter function to instantiate our ContractFactory. Hope this answers your query! |
Beta Was this translation helpful? Give feedback.
It is because these are some pre-defined functions by Hardhat: (if you are not technical, promises followed by colons here are returns simply put, whereas the left one is the method signature with parameters, and parameters with a ? are not compulsory - ie optional)
Whereas in Ethers (there is no getter function), we have to do it manually (ie, first c…