Remix Deployment Failing -- contract creation code storage out of gas

Hey,

I'm new to smart contracts and I tried to deploy a test ERC-20 token on REMIX using the openzeppelin wizard contract template (code below) but I keep getting a "contract creation code storage out of gas" error.

I tried playing around with the gas limit, and even forcing the transaction (which failed with the error contract creation code storage out of gas, since I had done this after lowering the fee) but nothing seems to be working. When I tested it though, it worked perfectly as expected on Remix's VM, and the gas fee charged was minimal.

Is there a fix for this? Or am I missing something?

Contract:


// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract MyToken is ERC20, ERC20Burnable, Ownable {
    constructor() ERC20("MyToken", "MTK") {
        _mint(msg.sender, 4000000000000 * 10 ** decimals());
    }
}
1 Like

Hello @Taya
Which network are you targetting ? Mainnet ? Are you using the injected metamask provider ?

If you are deployingh on ETH mainent, I suggest to use https://eth.llamarpc.com RPC. That issue is caused by a wrong gas estimation

i am having the same issue, i am targeting ethereum mainnet, yes i am using injector provider metamask. please help me i have been stuck here for days