Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: could not decode result data (value="0x", info={ "method": ... #4447

Closed
moneyDev1111 opened this issue Oct 6, 2023 · 1 comment
Closed
Assignees

Comments

@moneyDev1111
Copy link

moneyDev1111 commented Oct 6, 2023

Version of Hardhat

2.17.3

What happened?

When forking the Goerli network in hardhat on block 8660077

there's a contract 0x148f340701D3Ff95c7aA0491f5497709861Ca27D

getting the public bool throws the error..

outside hardhat using ethers everything works fine

const provider = new JsonRpcProvider('https://rpc.goerli.eth.gateway.fm');
const contract = new Contract('0x148f340701D3Ff95c7aA0491f5497709861Ca27D', abi, provider);

console.log(await contract.isLocked()); // true

Minimal reproduction steps

Fork goerli on block >= 8649158 and run the code

const abi = [
  {
    "inputs": [
      {
        "internalType": "uint8",
        "name": "_doorNumber",
        "type": "uint8"
      },
      {
        "internalType": "bytes32",
        "name": "_doorOwnerName",
        "type": "bytes32"
      },
      {
        "internalType": "bool",
        "name": "_isLocked",
        "type": "bool"
      },
      {
        "internalType": "bytes32",
        "name": "_secretSpell",
        "type": "bytes32"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "constructor"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "previousOwner",
        "type": "address"
      },
      {
        "indexed": true,
        "internalType": "address",
        "name": "newOwner",
        "type": "address"
      }
    ],
    "name": "OwnershipTransferred",
    "type": "event"
  },
  {
    "inputs": [],
    "name": "isLocked",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "owner",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "renounceOwnership",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "newOwner",
        "type": "address"
      }
    ],
    "name": "transferOwnership",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "bytes32",
        "name": "_secretSpell",
        "type": "bytes32"
      }
    ],
    "name": "unlockDoor",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  }
]

const [user] = await getSigners();

const theContract = new ethers.Contract('0x148f340701D3Ff95c7aA0491f5497709861Ca27D, abi, user);
await theContract.isLocked() // throws the error

Search terms

Error: could not decode result data

@moneyDev1111
Copy link
Author

sorry, my bad, I had a wrong rpc in .env

@github-project-automation github-project-automation bot moved this from Ready to Done in Hardhat Oct 6, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

No branches or pull requests

2 participants