You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by MustafaMansoor August 10, 2024
Hi,
In the tutorial, the deployment was done on Rinkeby, but since it was deprecated, I decided to deploy on the Sepolia testnet. I added my API key from MetaMask and selected the Sepolia network in Alchemy. However, I'm encountering an issue where the contract address shows as undefined after deployment. The transaction amount is being deducted from my MetaMask, so I believe the contract is being deployed, but I can't figure out what's causing the issue. Any help would be appreciated.
here is the code
const ethers = require("ethers");
const fs = require("fs-extra");
require("dotenv").config();
const main = async () => {
const provider = new ethers.JsonRpcProvider(process.env.URL);
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider);
const abi = fs.readFileSync("./simpleStorage_sol_SimpleStorage.abi", "utf8");
const binary = fs.readFileSync(
"./simpleStorage_sol_SimpleStorage.bin",
"utf8"
);
const contractFac = new ethers.ContractFactory(abi, binary, wallet);
console.log("Deploying contract, please wait...");
const contract = await contractFac.deploy();
// Wait for the contract deployment to be mined
await contract.waitForDeployment("1");
// Now the address should be available
console.log(`Contract deployed at ${contract.address}`);
// Retrieve the initial value stored in the contract
// const res = await contract.retrieve();
// console.log("Initial retrieved value:", res.toString());
// // Store a new value
// const TransRes = await contract.store("1217");
// await TransRes.wait(); // Wait for 1 confirmation
// console.log("New value stored.");
// // Retrieve the updated value
// const update = await contract.retrieve();
// console.log("Updated retrieved value:", update.toString());
};
main()
.catch(console.error)
.then(() => process.exit(0));
and here is the error
Deploying contract, please wait...
Contract deployed at undefined
The text was updated successfully, but these errors were encountered:
Discussed in #6710
Originally posted by MustafaMansoor August 10, 2024
Hi,
In the tutorial, the deployment was done on Rinkeby, but since it was deprecated, I decided to deploy on the Sepolia testnet. I added my API key from MetaMask and selected the Sepolia network in Alchemy. However, I'm encountering an issue where the contract address shows as undefined after deployment. The transaction amount is being deducted from my MetaMask, so I believe the contract is being deployed, but I can't figure out what's causing the issue. Any help would be appreciated.
here is the code
and here is the error
The text was updated successfully, but these errors were encountered: