hardhat
hardhat copied to clipboard
Read/View only function call being sent as a transaction to the chain.
I don't see any way to reach out to this part of the code, through which we can call the read/view only function of the smart contract.
Even if the signer is undefined, it still tries to get the signer over here.
I have this view only smart contract function -
function getArtistCollection(string memory artistName) public view returns (address) { return artistToCollection[artistName]; }
I am creating my contract instance as mentioned below -
const contractInstance = await hre.ethers.getContractAt(contractAbi, '0xB91Ee6f47bd98d1A78aa3267cf3Df5ED0C9Bb0Cc');
and am calling the view only smart contract function mentioned below
const res = await factoryInstance.getArtistCollection(artistName);
On executing my hardhat task, i encounter with the following error which is trying to send the signed transaction -
Error: call revert exception [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (method="artistToCollection(string)", data="0x", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.6.3) at Logger.makeError (/home/coder/new-erc721/node_modules/@ethersproject/logger/src.ts/index.ts:261:28) at Logger.throwError (/home/coder/new-erc721/node_modules/@ethersproject/logger/src.ts/index.ts:273:20) at Interface.decodeFunctionResult (/home/coder/new-erc721/node_modules/@ethersproject/abi/src.ts/interface.ts:427:23) at Contract.
(/home/coder/new-erc721/node_modules/@ethersproject/contracts/src.ts/index.ts:400:44) at step (/home/coder/new-erc721/node_modules/@ethersproject/contracts/lib/index.js:48:23) at Object.next (/home/coder/new-erc721/node_modules/@ethersproject/contracts/lib/index.js:29:53) at fulfilled (/home/coder/new-erc721/node_modules/@ethersproject/contracts/lib/index.js:20:58) { reason: null, code: 'CALL_EXCEPTION', method: 'artistToCollection(string)', data: '0x', errorArgs: null, errorName: null, errorSignature: null, address: '0xB91Ee6f47bd98d1A78aa3267cf3Df5ED0C9Bb0Cc', args: [ 'ashlesh' ], transaction: { data: '0xabc1bfde000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000076173686c65736800000000000000000000000000000000000000000000000000', to: '0xB91Ee6f47bd98d1A78aa3267cf3Df5ED0C9Bb0Cc', from: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', gasLimit: BigNumber { _hex: '0x01bad818', _isBigNumber: true } } }
This issue is also being tracked on Linear.
We use Linear to manage our development process, but we keep the conversations on Github.
LINEAR-ID: 1becde2c-8f57-49e5-b1ef-1bff80b4ba9d
Thank you for using Hardhat. In general, if there is a problem in Hardhat, we will need a minimal reproducible example in order to investigate it. See https://stackoverflow.com/help/minimal-reproducible-example
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.
Closing for lack of reproduction steps.
Maybe my issue is very similar. I provided also a reproducable github repository: https://github.com/NomicFoundation/hardhat/issues/3230