Skip to content

Hardhat FundMe Testing State Not working .connect not working #85

Answered by conqryash007
slimmsyd asked this question in Q&A
Discussion options

You must be logged in to vote

contract.connect( providerOrSigner ) ⇒ Contractsource
Returns a new instance of the Contract, but connected to providerOrSigner.
By passing in a Provider, this will return a downgraded Contract which only has read-only access (i.e. constant calls).
By passing in a Signer. this will return a Contract which will act on behalf of that signer.

The .connect method ties the same contract with different signers/accounts, i.e., all the requests to the contract will be made from the connected account.

Your code

console.log(`${fundMeConnectedContract.address}: is a different account  `)

is just printing the address of the same contract, and that is why the outputs are all the same address.

If you…

Replies: 1 comment

Comment options

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