Cannot get access to upgrade smart contract after deploy

Hello. When i try to interact with contract after deploy with instance, all work correctly.


const contract = await MyContract.deployed();
console.log(await contract.owner())

But if i try to interact like this:

  const contractAddress = "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9";
  const provider = new ethers.providers.JsonRpcProvider();
  const contract = new ethers.Contract(contractAddress, MyContractAbi, provider);
  console.log(await contract.owner())

then i get this error:

Error: call revert exception (method="owner()", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.3.1)
  reason: null,
  method: 'owner()',
  errorArgs: null,
  errorName: null,
  errorSignature: null,
  address: '0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9',
  args: [],
  transaction: {
    data: '0x8da5cb5b',
    to: '0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9',
    from: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
    gasLimit: BigNumber { _hex: '0xaf09a8', _isBigNumber: true }

Why? What i do is wrong?

ABI i get from ./artifacts/contracts/MyContract.sol/MyContract.json

in general, i slept, drank coffe and found that i deployed to network hardhat, but after that try to interact with localhost network.

Thanks coffe and my dreams! Guys, sleep more)

1 Like