From fb04f7a4c604bb7d7a6b010ffb9d8cbdf50c4fcd Mon Sep 17 00:00:00 2001 From: Ryuji Eguchi Date: Wed, 29 Mar 2023 08:38:39 +1100 Subject: [PATCH] increase gas price to prevent error: insufficient funds for gas * price + value --- section7-kickstart-solc-0.8.9/ethereum/deploy.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/section7-kickstart-solc-0.8.9/ethereum/deploy.js b/section7-kickstart-solc-0.8.9/ethereum/deploy.js index 21401e2..ca22220 100644 --- a/section7-kickstart-solc-0.8.9/ethereum/deploy.js +++ b/section7-kickstart-solc-0.8.9/ethereum/deploy.js @@ -9,6 +9,7 @@ const provider = new HDWalletProvider( process.env.GOERLI_ENDPOINT_WITH_API_KEY, ); const web3 = new Web3(provider); +const gasForDeploy = 2000000; const deploy = async () => { const accounts = await web3.eth.getAccounts(); @@ -18,7 +19,7 @@ const deploy = async () => { try { const result = await new web3.eth.Contract(compiledFactory.abi) .deploy({ data: compiledFactory.evm.bytecode.object }) - .send({ gas: "1400000", from: accounts[0] }); + .send({ gas: gasForDeploy, from: accounts[0] }); console.log("Contract deployed to", result.options.address); } catch (err) {