Cant deploy smart contracts on Polygon Amoy or Sepolia

Cant deploy smart contracts on Polygon Amoy or Sepolia

Manage alerts

Loading saved threads...

lladane · External communityPost link
External question — Ethereum Stack Exchange Author: lladane Original post: https://ethereum.stackexchange.com/questions/166097 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I have been trying to deploy a simple smart contarct to make custom ERC20 tokens: // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract OZToken is ERC20 { uint dec = 10 ** 18; constructor() ERC20("OZToken", "OZT") { _mint(msg.sender, 1000 * dec); } } but I am having these errors and I dont know how to solve them. This error comes when I try to deploy on Amoy using npx hardhat ignition deploy ./ignition/modules/OZToken.ts --network amoy : dane@ubuntu:~/Desktop/Contracts/applications$ npx hardhat ignition deploy ./ignition/modules/OZToken.ts --network amoy ✔ Confirm deploy to network amoy (11155111)? … yes Hardhat Ignition 🚀 Resuming existing deployment from ./ignition/deployments/chain-11155111 Deploying [ OZTokenModule ] Warning - previously executed futures are not in the module: - WalletModule#EtherWallet Batch #1 Executing OZTokenModule#OZToken... An unexpected error occurred: IgnitionError: IGN410: Gas estimation failed: gas required exceeds allowance (190337) at sendTransactionForOnchainInteraction (/home/dane/Desktop/Contracts/applications/node_modules/@nomicfoundation/ignition-core/src/internal/execution/future-processor/helpers/network-interaction-execution.ts:181:13) at processTicksAndRejections (node:internal/process/task_queues:95:5) at async sendTransaction (/home/dane/Desktop/Contracts/applications/node_modules/@nomicfoundation/ignition-core/src/internal/execution/future-processor/handlers/send-transaction.ts:85:18) at async FutureProcessor.processFuture (/home/dane/Desktop/Contracts/applications/node_modules/@nomicfoundation/ignition-core/src/internal/execution/future-processor/future-processor.ts:117:9) at async ExecutionEngine._executeBatch (/home/dane/Desktop/Contracts/applications/node_modules/@nomicfoundation/ignition-core/src/internal/execution/execution-engine.ts:155:30) at async ExecutionEngine.executeModule (/home/dane/Desktop/Contracts/applications/node_modules/@nomicfoundation/ignition-core/src/internal/execution/execution-engine.ts:116:25) at async Deployer.deploy (/home/dane/Desktop/Contracts/applications/node_modules/@nomicfoundation/ignition-core/src/internal/deployer.ts:196:25) at async SimpleTaskDefinition.action (/home/dane/Desktop/Contracts/applications/node_modules/@nomicfoundation/hardhat-ignition/src/index.ts:318:24) at async Environment._runTaskDefinition (/home/dane/Desktop/Contracts/applications/node_modules/hardhat/src/internal/core/runtime-environment.ts:351:14) at async Environment.run (/home/dane/Desktop/Contracts/applications/node_modules/hardhat/src/internal/core/runtime-environment.ts:184:14) I think it says the gas limit is not set a appropriately. Below are my configuration files, please take look if I am missing something !! ./ignition/modules/OZToken.ts import { buildModule } from "@nomicfoundation/hardhat-ignition/modules"; const OZTokenModule = buildModule("OZTokenModule", (m) => { const token = m.contract("OZToken"); return { token }; }); module.exports = OZTokenModule; hardhat.config.ts import { HardhatUserConfig } from "hardhat/config"; import "@nomicfoundation/hardhat-toolbox"; import "@nomicfoundation/hardhat-ignition"; import * as dotenv from "dotenv"; dotenv.config(); const INFURA_API = process.env.INFURA_API_KEY; const ALCHEMY_API = process.env.ALCHEMY_API_KEY; const pvt_key = process.env.PRIVATE_KEY || ""; const config: HardhatUserConfig = { solidity: "0.8.20", networks: { sepolia: { url: `https://sepolia.infura.io/v3/${INFURA_API}`, accounts: [pvt_key], gas: 1000000, gasPrice: 20000000, }, amoy: { url: `https://eth-sepolia.g.alchemy.com/v2/${ALCHEMY_API}`, accounts: [pvt_key], gas: 1000000, gasPrice: 20000000, }, }, }; export default config; Moreover, it is working perfectly in the hardhat local network, but not in remote networks
Quote
Report
Bhanu Partap · External communityPost link
External answer — Ethereum Stack Exchange Author: Bhanu Partap Original post: https://ethereum.stackexchange.com/a/166108 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. Try to remove the gas and gasPrice from the hardhat.config.js file. const config: HardhatUserConfig = { solidity: "0.8.20", networks: { sepolia: { url: `https://sepolia.infura.io/v3/${INFURA_API}`, accounts: [pvt_key], }, amoy: { url: `https://ethsepolia.g.alchemy.com/v2/${ALCHEMY_API}`, accounts: [pvt_key], }, }, }; change this in your hardhat file or just remove the gas and gasPrice key from the hardhat config file. The hardhat will auto call the estimateGas function and calculate the gas fees required for the transaction.
Quote
Report
Nulik · External communityPost link
External answer — Ethereum Stack Exchange Author: Nulik Original post: https://ethereum.stackexchange.com/a/166142 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. You can use gasMultiplier paramter on per-network basis, for example: sepolia: { url: `http://host:port/`, accounts: process.env.SEPOLIA_PRIVATE_KEY !== undefined ? [process.env.SEPOLIA_PRIVATE_KEY] : [], gasMultiplier: 2, }, the above will double the gasLimit for Sepolia. Different networks have different gas requirements
Quote
Report

Post Reply

Quoted from Forex.com.bd-Editorial External question — Ethereum Stack Exchange Author: lladane Source score (net votes, not local likes): 2 Original post: https://ethereum.stackexchange.com/questions/166097 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I have been trying to deploy a simple smart contarct to make custom ERC20 tokens: // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract OZToken is ERC20 { uint dec = 10 ** 18; constructor() ERC20("OZToken", "OZT") { _mint(msg.sender, 1000 * dec); } } but I am having these errors and I dont know how to solve them. This error comes when I try to deploy on Amoy using npx hardhat ignition deploy ./ignition/modules/OZToken.ts --network amoy : dane@ubuntu:~/Desktop/Contracts/applications$ npx hardhat ignition deploy ./ignition/modules/OZToken.ts --network amoy ✔ Confirm deploy to network amoy (11155111)? … yes Hardhat Ignition 🚀 Resuming existing deployment from ./ignition/deployments/chain-11155111 Deploying [ OZTokenModule ] Warning - previously executed futures are not in the module: - WalletModule#EtherWallet Batch #1 Executing OZTokenModule#OZToken... An unexpected error occurred: IgnitionError: IGN410: Gas estimation failed: gas required exceeds allowance (190337) at sendTransactionForOnchainInteraction (/home/dane/Desktop/Contracts/applications/node_modules/@nomicfoundation/ignition-core/src/internal/execution/future-processor/helpers/network-interaction-execution.ts:181:13) at processTicksAndRejections (node:internal/process/task_queues:95:5) at async sendTransaction (/home/dane/Desktop/Contracts/applications/node_modules/@nomicfoundation/ignition-core/src/internal/execution/future-processor/handlers/send-transaction.ts:85:18) at async FutureProcessor.processFuture (/home/dane/Desktop/Contracts/applications/node_modules/@nomicfoundation/ignition-core/src/internal/execution/future-processor/future-processor.ts:117:9) at async ExecutionEngine._executeBatch (/home/dane/Desktop/Contracts/applications/node_modules/@nomicfoundation/ignition-core/src/internal/execution/execution-engine.ts:155:30) at async ExecutionEngine.executeModule (/home/dane/Desktop/Contracts/applications/node_modules/@nomicfoundation/ignition-core/src/internal/execution/execution-engine.ts:116:25) at async Deployer.deploy (/home/dane/Desktop/Contracts/applications/node_modules/@nomicfoundation/ignition-core/src/internal/deployer.ts:196:25) at async SimpleTaskDefinition.action (/home/dane/Desktop/Contracts/applications/node_modules/@nomicfoundation/hardhat-ignition/src/index.ts:318:24) at async Environment._runTaskDefinition (/home/dane/Desktop/Contracts/applications/node_modules/hardhat/src/internal/core/runtime-environment.ts:351:14) at async Environment.run (/home/dane/Desktop/Contracts/applications/node_modules/hardhat/src/internal/core/runtime-environment.ts:184:14) I think it says the gas limit is not set a appropriately. Below are my configuration files, please take look if I am missing something !! ./ignition/modules/OZToken.ts import { buildModule } from "@nomicfoundation/hardhat-ignition/modules"; const OZTokenModule = buildModule("OZTokenModule", (m) => { const token = m.contract("OZToken"); return { token }; }); module.exports = OZTokenModule; hardhat.config.ts import { HardhatUserConfig } from "hardhat/config"; import "@nomicfoundation/hardhat-toolbox"; import "@nomicfoundation/hardhat-ignition"; import * as dotenv from "dotenv"; dotenv.config(); const INFURA_API = process.env.INFURA_API_KEY; const ALCHEMY_API = process.env.ALCHEMY_API_KEY; const pvt_key = process.env.PRIVATE_KEY || ""; const config: HardhatUserConfig = { solidity: "0.8.20", networks: { sepolia: { url: `https://sepolia.infura.io/v3/${INFURA_API}`, accounts: [pvt_key], gas: 1000000, gasPrice: 20000000, }, amoy: { url: `https://eth-sepolia.g.alchemy.com/v2/${ALCHEMY_API}`, accounts: [pvt_key], gas: 1000000, gasPrice: 20000000, }, }, }; export default config; Moreover, it is working perfectly in the hardhat local network, but not in remote networks

Cancel quote

Checking account access…