shortMessage: 'insufficient funds for intrinsic transaction cost'. What could be the problem? #6675
Unanswered
EddiePumpin
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
const { ethers, JsonRpcProvider } = require("ethers"); const fs = require("fs-extra"); require("dotenv").config(); async function main() { const provider = new JsonRpcProvider(process.env.RPC_URL); const encryptedJson = fs.readFileSync("./.encryptedKey.json", "utf8"); let wallet = ethers.Wallet.fromEncryptedJsonSync( encryptedJson, process.env.PRIVATE_KEY_PASSWORD ); wallet = await wallet.connect(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..."); const contract = await contractFactory.deploy(); await contract.deploymentTransaction().wait(1); const currentFavouriteNumber = await contract.retrieve(); console.log(`Current Favourite Number: ${currentFavouriteNumber.toString()}`); const transactionResponse = await contract.store("7"); const transactionReceipt = await transactionResponse.wait(1); const updatedFavouriteNumber = await contract.retrieve(); console.log(`Updated favourite number is: ${updatedFavouriteNumber}`); } main() .then(() => process.exit(0)) .catch((error) => { console.error(error); process.exit(1); });Beta Was this translation helpful? Give feedback.
All reactions