I have created an ERC-20 token contract, and I have a problem with the gas. I must not have calculated the gas expenditure correctly, and on Etherscan, I get a warning. This is the link to the contract on Etherscan: https://etherscan.io/address/0x5e974d66ae52b233006b2402f59a613576a22823. Can someone give me a hand? I would not like to lose the ETH that it cost me to create the contract. How can I solve this? The warning is this: "Error txn: contract creation code storage out of gas."

Best regards.

Good morning, I'm researching how to calculate gas using Node and a web3.js script, but this morning I added some ETH to Metamask and connected to Remix. All the ETH I had was sent to another account without me signing anything. I suppose this is due to the contract error reported on Etherscan related to gas. Can someone help me? Maybe I need to remove some functions from the contract to fix the error, because I think I've already lost the 0.017 ETH since I deployed and the contract was created. Earlier in Remix, next to my wallet address, it showed 0.015 ETH, but it wasn't reflected in my wallet. Currently, in the "DEPLOY & RUN TRANSACTIONS" section, under ACCOUNT, my Metamask address shows "0 ether". I hope I haven't lost all the Ether. Also, I'm looking at https://etherscan.io/gastracker but I'm a bit lost. The best hours seem to be around 3 - 5 in the morning, if I understand the heatmap correctly.

  • can you also share your contract code? Commented Jun 11 at 17:38
  • This is the .sol file of the contract: ``` // SPDX-License-Identifier: MIT // Compatible with OpenZeppelin Contracts ^5.0.0 pragma solidity ^0.8.20; import "@openzeppelin/[email protected]/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/[email protected]/token/ERC20/extensions/ERC20BurnableUpgradeable.sol"; import "@openzeppelin/[email protected]/token/ERC20/extensions/ERC20PausableUpgradeable.sol"; import "@openzeppelin/[email protected]/access/OwnableUpgradeable.sol"; import "@openzeppelin/[email protected]/token/ERC20/extensions/ERC
    Commented Jun 13 at 22:54

1 Answer 1

  1. It seems that your contract deployment failed due to insufficient gas, as indicated by the 'out of gas' error during contract creation. To resolve this, review and optimize your contract code for gas efficiency, accurately estimate the required gas using tools like Remix IDE, and adjust the gas limit accordingly during redeployment.

  2. Ensure to test on an Ethereum testnet before deploying on the mainnet to avoid further ETH loss.

  3. I checked your deployed contract and it's not verified and published. So after successful deployment, verify your contract on Etherscan for transparency.

  • Thank you for the response. I configured the contract using OpenZeppelin and deployed it with Remix. When I clicked deploy, I had enough Gas and ETH in my MetaMask account. I don't understand why it allowed me to create the contract and then told me that there wasn't enough Gas. So, have I lost the ETH that I used for the contract? Another question: why does a contract cost €50 at 6 in the morning and now costs €120 at 12:30?
    Commented Jun 11 at 10:33
  • @UNDERDOG If transaction while deploying the contract is done then it will deduct ETH from your wallet in in order to mine it. The coast changes every time, it totally depends on the network traffic. Commented Jun 11 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.