-
Notifications
You must be signed in to change notification settings - Fork 128
Lesson 5 Deploy Error #85
Comments
could you give me exactly the command your running and exact error? |
node filename.js |
hello below is my code const ethers = require("ethers");
const fs = require("fs");
async function main() {
//HTTP://127.0.0.1:7545
//http://127.0.0.1:7545
const provider = new ethers.provider.JsonRpcProvider("http://127.0.0.1:7545");
const wallet = new ethers.Wallet(
"0xc4e3e75fe7c27ae52be608f7e559f308eb931d721bf684c812cb81db3402000c",
provider
);
const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
const binary = fs.readFileSync(
"./SimpleStorage_sol_SimpleStorage.bin",
"utf8"
);
const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
console.log("deploying, please wait");
// console.log(bin, binary, wallet);
const contract = await contractFactory.deploy();
console.log(contract);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error("error");
process.exit(1);
});
below is the error
|
The correct way should be:
apparently the library has changed |
Thanks |
@BurhanSiddiqui99 How to solvechange this line: //deploy
const contract = await contractFactory.deploy({ gasLimit: 3000000 }); after add gasLimit it works! |
Hey I have a similar issues here I have this code : const ethers = require("ethers");
const fs = require("fs-extra");
async function main() {
const provider = new ethers.JsonRpcProvider("HTTP://127.0.0.1:7545");
const wallet = new ethers.Wallet(
"0xa8ad19bcaa33e7bba6d7aa3085aece4e80e1b64a72a7336f077e56db3259d9a9",
provider
);
const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
const binary = fs.readFileSync(
"./SimpleStorage_sol_SimpleStorage.bin",
"utf8"
);
const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
console.log("Deploying contract...");
const contract = await contractFactory.deploy();
console.log(contract);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
}); and here is the output of "node deploy.js" in my terminal ->
the contract works very well on remix, when I deploy on the JavaScript virtual machine, but not here, and I see nothing on Ganache when I do this way I followed exactly whats does Patrick on the course, I've tried many things : add this parameter to the deploy methods :
and the error is now different :
and the I see the contracts deployed to Ganache but I have not the same object that Patrick get in the course any help please ? |
I had the same issue, so I changed the SOLC version to 0.8.19 and repeated the process from the beginning. I found the solution here: https://ethereum.stackexchange.com/questions/150281/invalid-opcode-opcode-0x5f-not-defined |
This worked for me. |
Never run this line const contract = await contractFactory.deploy(); and prompt error
Error: missing revert data (action="estimateGas", data=null, reason=null, transaction
The text was updated successfully, but these errors were encountered: