NomicFoundation / hardhat

Hardhat is a development environment to compile, deploy, test, and debug your Ethereum software.
https://hardhat.org
Other
7.3k stars 1.41k forks source link

Inconsistently able to access Smart Contracts using Alchemy and Hardhat #2439

Closed algorithmical closed 2 years ago

algorithmical commented 2 years ago

I'm basing my code off https://github.com/NomicFoundation/hardhat-hackathon-boilerplate

I am inconsistently able to read tokens off the chain

this._token = new ethers.Contract(
      TokenAddress,
      Tokenabi,
      this._provider.getSigner(0)
    );

 async _getTokenData() {
    console.log("Token data");
    const name = await this._token.name();    

When I read from a contract generated by hardhat (my smart contract) it works. When I read from a token on the ethereum chain (I have Alchemy in hardhat config) it SOMETIMES works. Yes, reloading the page 5 minutes after trying successfully can result in failure. the "await this._token.name()" is where it freezes.

I am wondering what could cause such inconsistent behavior?

Is there a way to view more verbose logs of interacting with the network through hardhat node or alchemy?

github-actions[bot] commented 2 years ago

This issue was marked as stale because it didn't have any activity in the last 30 days. If you think it's still relevant, please leave a comment indicating so. Otherwise, it will be closed in 7 days.

github-actions[bot] commented 2 years ago

This issue was closed because it has been stalled for 7 days with no activity.