Replies: 2 comments
-
|
Does your constructor have any reverts? This indicates an error during simulation of your contract deployment. Does it call to an external contract? The constructor is likely where the issue lies… |
Beta Was this translation helpful? Give feedback.
-
|
Hi @amol9372, thanks for creating this issue. I had this same issue and fixed it. Basically, because of newer versions being released, things also behave differently. So to achieve the same results in the Tutorial, there are 2 things I have done: 1. *Use SOLC version 0.8.7-fixed (which was the same version used in the tutorial)Edit Then, update the packages (files in And of course, use the same solidity version in your Solidity Contract file: (Just in case the error still persists or it requires higher gasLimit, like 2. Set a higher gas limit.Let me know if that helps! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Ethers Version
6.6.1
Search Terms
estimateGas, CALL_EXCEPTION, ganache
Describe the Problem
I am trying to deploy a contract to a local ganache network using Nodejs v20. Nodejs is able to connect with local Ganache but the
deploy()method is giving following error:Error: missing revert data (action="estimateGas", data=null, reason=null, transaction={ "data": "0x608060405234801561000f575f8....", "from": "0xfeBaeDDecD30....", "to": null }, invocation=null, revert=null, code=CALL_EXCEPTION, version=6.6.1)
It is trying to call this
eth_estimateGasfunction and it fails. I am usingsolcjsto compile the Solidity contract using the commandsolcjs --bin --abi SimpleStorage.solThese are the versions:
Code Snippet
const { ethers } = require("ethers"); const fs = require("fs-extra"); const solc = require("solc"); async function main() { // http://127.0.0.1:7545 RPC URL for Ganache const provider = new ethers.JsonRpcProvider("http://192.168.2.17:8545"); const wallet = new ethers.Wallet( "0xe75a169f13fdd5308........", provider ); const abi = JSON.parse( fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi").toString() ); const binary = fs .readFileSync("./SimpleStorage_sol_SimpleStorage.bin") .toString(); const contractFactory = new ethers.ContractFactory(abi, binary, wallet); // const options = {gasLimit: 100000, gasPrice: ethers.parseUnits(price, 'gwei')} await contractFactory.deploy(); } main() .then(() => process.exit(0)) .catch((err) => console.log(err));Contract ABI
[ { "inputs": [], "name": "favoriteNumber", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "retrieve", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_favoriteNumber", "type": "uint256" } ], "name": "store", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ]Errors
Environment
node.js (v12 or newer)
Environment (Other)
Local ganache
Beta Was this translation helpful? Give feedback.
All reactions