tryethernal / hardhat-ethernal

Hardhat plugin for Ethernal
MIT License
102 stars 17 forks source link

call revert exception when interacting with contract #37

Closed emretepedev closed 2 years ago

emretepedev commented 2 years ago

hardhat.config.ts

const config: HardhatUserConfig = {
  // ...
  ethernal: {
    disabled: false,
    uploadAst: false,
    workspace: process.env.ETHERNAL_WORKSPACE || '',
    email: process.env.ETHERNAL_EMAIL || '',
    password: process.env.ETHERNAL_PASSWORD || '',
    resetOnStart: process.env.ETHERNAL_WORKSPACE || '',
  },
  // ...
};

deploy.ts

import { ethers, ethernal } from 'hardhat';

async function main() {
  // deploy contract
  const erc20TokenName = 'FooToken';
  const erc20TokenConstrArgs = ['1000000000000'];
  const erc20Token = await (await ethers.getContractFactory(erc20TokenName)).deploy(...erc20TokenConstrArgs);
  await erc20Token.deployed();
  console.log(erc20TokenName + ' deployed to:', erc20Token.address);

  // push to ethernal
  await ethernal.push({
    name: erc20TokenName,
    address: erc20Token.address,
  });
}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});

It throws this error when I interact with the contract: call revert exception [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (method="decimals()", data="0x", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.6.4) image

I am running on the Hardhat network via hardhat node. Started HTTP and WebSocket JSON-RPC server at http://127.0.0.1:8545/

And I run deploy script: hardhat run scripts/deploy.ts --network hardhat

What am I missing?

antoinedc commented 2 years ago

This can happen when you are deploying the contract on a different network than the one connected to the workspace. Can you double check that the workspace rpc endpoint is the same than the one you are passing when doing npx hardhat run --network?

emretepedev commented 2 years ago

This can happen when you are deploying the contract on a different network than the one connected to the workspace. Can you double check that the workspace rpc endpoint is the same than the one you are passing when doing npx hardhat run --network?

I am running on the Hardhat network via hardhat node. Started HTTP and WebSocket JSON-RPC server at http://127.0.0.1:8545/

And I run deploy script: hardhat run scripts/deploy.ts --network hardhat

KtaToken deployed to: 0x5FbDB2315678afecb367f032d93F642f64180aa3 [Ethernal] Updated artifacts for contract KtaToken (0x5FbDB2315678afecb367f032d93F642f64180aa3). Dependencies: ...

antoinedc commented 2 years ago

And I run deploy script: hardhat run scripts/deploy.ts --network hardhat

Can you try npx hardhat run scripts/deploy.ts --network localhost?

emretepedev commented 2 years ago

And I run deploy script: hardhat run scripts/deploy.ts --network hardhat

Can you try npx hardhat run scripts/deploy.ts --network localhost?

It works, Thanks for all!

antoinedc commented 2 years ago

Nice! No worries, let me know if you need anything else :)