Skip to content
Discussion options

You must be logged in to vote

You need to pass constructor arguments only while deploying a contract. You can refer to ContractFactory docs.

const factory = new ContractFactory(Exchange.abi, Exchange.bytecode, signer)

// Deploy an instance of the contract passing in constructor arguments
contract = await factory.deploy(_token);

contract.address // address of the deployed contract

Once you deploy a contract, you get the contract object like above.

But if you already have deployed a contract and have an address of the deployed contract (contract.address), that's when you have two ways:

  • use the new ethers.Contract code that you mentioned to get the contract object.
  • Use factory.attach.

Does that help?

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ricmoo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant