Contract deployment using Remix IDE

Hi, I am trying to deploy a sample contract using remix IDE on mainnet, however when I keep on getting "jsonrpc":"2.0","error":"contract creation code storage out of gas","id":888278891666324}" error. I tried increasing gas limit and optimizing it. is there anything I am missing?

hey , this could happen for different reasons. The first one could be the rpc that fails to estimatethe gas. Can you please try using llamarpc? https://llamanodes.notion.site/Getting-Started-9e6fdb1120494601ac0eae69b2ee41bc

If you still get that error probably there is an issue with the code. In that case can you share the contrusctor code?

 constructor(address _factory, address _v3Router) {
        factory = IUniswapV2Factory(_factory);
        uniswapV3Router = ISwapRouter(_v3Router);

this is the constructor for the first contract

constructor() {
        pair = IUniswapV2Pair(factory.getPair(DAI, WETH));

this one is the second one. if needed I can share the whole code

Hi, I'm hoping you could please help us? We're also getting the same issue. However, we implemented llamanodes like you advised above yet it's still getting this error on remix when we click deploy:

{"jsonrpc":"2.0","error":"contract creation code storage out of gas","id":8157254551788903}

We get the same error however high we increase the gas limit to. We also tried forcing the transaction but it failed and gave this error:

Warning! Error encountered during contract execution [contract creation code storage out of gas] 

This deploys fine on the vms and on sepolia and goerli but just not when using injected provider on mainnet. See our contract code below:

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

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/utils/math/SafeCast.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "erc721a/contracts/ERC721A.sol";

contract GenericName is ERC721A, Ownable {

  using Strings for uint256;
  using Address for address;
  using SafeCast for uint256;

  struct DutchAuctionConfig {
    uint32 txLimit;
    uint32 dropCeiling;
    uint32 startTime;
    uint32 bottomTime;
    uint32 stepInterval;
    uint256 startPrice;
    uint256 bottomPrice;
    uint256 priceStep;
  }

  uint256 public constant MAX_SUPPLY = 10000;

  string private baseURI;
  string private notRevealedURI;
  bool public revealed = false;

  uint256 public maxPresaleMint = 5;
  uint256 public presalePrice = 0.015 ether;
  bool public presaleIsActive = false;
  bytes32 public whitelistMerkleRoot;

  DutchAuctionConfig public dutchAuctionConfig;

  constructor() ERC721A("Generic Name Project", "GNP") {
    notRevealedURI = "ipfs://1234567890/hidden.json";
  }

  function _verify(
    bytes32[] memory proof,
    bytes32 merkleRoot
        ) internal view returns (bool) {
    return MerkleProof.verify(proof, merkleRoot, keccak256(abi.encodePacked(msg.sender)));
  }

  function mintPresale(uint256 amount, bytes32[] calldata proof)
    external
    payable
  {
    require(presaleIsActive, "Presale is not active");
    uint256 mintCount = _getAux(msg.sender) + amount;
    require(mintCount <= maxPresaleMint, "User allotment exceeded");
    require(msg.value == presalePrice * amount, "Insufficient payment");
    require(totalSupply() + amount <= MAX_SUPPLY, "Max limit exceeded");
    require(_verify(proof, whitelistMerkleRoot), "Invalid proof");

    _setAux(msg.sender, uint64(mintCount));

    _safeMint(msg.sender, amount);
  }

  function mintPublicSale(uint256 amount)
    external
    payable
  {

    require((!msg.sender.isContract() && msg.sender == tx.origin), "Contract buys not allowed");

    DutchAuctionConfig memory _config = dutchAuctionConfig;

    require(totalSupply() + amount <= _config.dropCeiling, "Max limit exceeded");

    require(block.timestamp >= _config.startTime, "Sale is not active");
    require(amount <= _config.txLimit, "Transaction limit exceeded");

    uint256 mintPrice = getCurrentAuctionPrice() * amount;
    require(msg.value >= mintPrice, "Insufficient payment");


    // Refund if customer paid more than the cost to mint
    if (msg.value > mintPrice) {
      Address.sendValue(payable(msg.sender), msg.value - mintPrice);
    }

    _safeMint(msg.sender, amount);
  }

  function getCurrentAuctionPrice() public view returns (uint256 currentPrice) {
    DutchAuctionConfig memory _config = dutchAuctionConfig;

    uint256 timestamp = block.timestamp;

    if (timestamp < _config.startTime) {
      currentPrice = _config.startPrice;
    } else if (timestamp >= _config.bottomTime) {
      currentPrice = _config.bottomPrice;
    } else {
      uint256 elapsedIntervals = (timestamp - _config.startTime) /
      _config.stepInterval;
      currentPrice =
      _config.startPrice -
      (elapsedIntervals * _config.priceStep);
    }

    return currentPrice;
  }
  
  function setPresaleIsActive(bool state) external onlyOwner {
    presaleIsActive = state;
  }

  function setMaxPresaleMint(uint256 amount) external onlyOwner {
    maxPresaleMint = amount;
  }

  function setWhitelistMerkleRoot(bytes32 merkleRoot) external onlyOwner {
    whitelistMerkleRoot = merkleRoot;
  }

  function reveal(bool state) external onlyOwner {
    revealed = state;
  }

  function gift(uint256 amount, address to) external onlyOwner {
    require(totalSupply() + amount <= MAX_SUPPLY, "Max supply exceeded");

    _safeMint(to, amount);
  }

  function setBaseURI(string memory newbaseURI) external onlyOwner {
    baseURI = newbaseURI;
  }

  function configureDutchAuction(
    uint256 txLimit,
    uint256 dropCeiling,
    uint256 startTime,
    uint256 bottomTime,
    uint256 stepInterval,
    uint256 startPrice,
    uint256 bottomPrice,
    uint256 priceStep
  ) external onlyOwner {
    require(dropCeiling <= MAX_SUPPLY, "Drop limit exceeds max supply");
    uint32 _txLimit = txLimit.toUint32();
    uint32 _dropCeiling = dropCeiling.toUint32();
    uint32 _startTime = startTime.toUint32();
    uint32 _bottomTime = bottomTime.toUint32();
    uint32 _stepInterval = stepInterval.toUint32();

    dutchAuctionConfig.txLimit = _txLimit;
    dutchAuctionConfig.dropCeiling = _dropCeiling;
    dutchAuctionConfig.startTime = _startTime;
    dutchAuctionConfig.bottomTime = _bottomTime;
    dutchAuctionConfig.stepInterval = _stepInterval;
    dutchAuctionConfig.startPrice = startPrice;
    dutchAuctionConfig.bottomPrice = bottomPrice;
    dutchAuctionConfig.priceStep = priceStep;
  }

  function withdraw() external onlyOwner {
    (bool success, ) = msg.sender.call{value: address(this).balance}("");
    require(success, "Failed to transfer ether");
  }

  function getPresaleMints(address _owner) external view returns (uint64) {
    return _getAux(_owner);
  }

  function _startTokenId() internal pure override returns (uint256) {
    return 1;
  }

  function _baseURI() internal view override returns (string memory) {
    return baseURI;
  }

  function tokenURI(uint256 tokenId)
    public
    view
    override
    returns (string memory)
  {
    require(_exists(tokenId), "Nonexistent token");

    if(!revealed) {
      return notRevealedURI;
    }

    return string(abi.encodePacked(baseURI, "/", tokenId.toString(), ".json"));
  }
}

Interestingly the official Azuki github contract example is giving the same error if we try to deploy that to mainnet also:

pragma solidity ^0.8.4;

import "erc721a/contracts/ERC721A.sol";

contract Azuki is ERC721A {
    constructor() ERC721A("Azuki", "AZUKI") {}

    function mint(uint256 quantity) external payable {
        // `_mint`'s second argument now takes in a `quantity`, not a `tokenId`.
        _mint(msg.sender, quantity);
    }
}