Hello, the code below is what i have coded so far following the video. The contract is deploying as i can see it in ganache but the code is not able to "see" or "extract" the data from the abi or the bin files. After running node deploys.js the code runs without errors but the output is not showing the data in the files as shown in the tutorial.
The 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(
"0xa6db4d7de0123415d6bdf455138d181454b988453c30786ed93465faef88e131",
provider
);
const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
const binary = fs.readFileSync(
"./SimpleStorage_solSimpleStorage.bin",
"utf8"
);
const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
console.log("Deploying...");
const contract = await contractFactory.deploy();
console.log(contract);
}
Hello, the code below is what i have coded so far following the video. The contract is deploying as i can see it in ganache but the code is not able to "see" or "extract" the data from the abi or the bin files. After running node deploys.js the code runs without errors but the output is not showing the data in the files as shown in the tutorial.
The 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( "0xa6db4d7de0123415d6bdf455138d181454b988453c30786ed93465faef88e131", provider ); const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8"); const binary = fs.readFileSync( "./SimpleStorage_solSimpleStorage.bin", "utf8" ); const contractFactory = new ethers.ContractFactory(abi, binary, wallet); console.log("Deploying..."); const contract = await contractFactory.deploy(); console.log(contract); }
The response:
`Deploying... BaseContract { target: '0xb8a4fafabF95dC3B95c49e0Bb52a463A00E8c363', interface: Interface { fragments: [ [FunctionFragment], [FunctionFragment], [FunctionFragment], [FunctionFragment], [FunctionFragment] ], deploy: ConstructorFragment { type: 'constructor', inputs: [], payable: false, gas: null }, fallback: null, receive: false }, runner: Wallet { provider: JsonRpcProvider {}, address: '0xd339349a6659d877a4849A7111E8e1cf5f722e72' }, filters: {}, fallback: null,
}`
Tutorial timestamp: https://youtu.be/gyMwXuJrbJQ?si=DQQlZoE3Lek5AECQ&t=25654
if anyone had the same issue, please help me with a solution. Thanks.