Search code examples
ethereumpolygonsmartcontractsnftopensea

Smart Contract on Polygon not showing proper cost?


I'm using HashLips' new LowGasFees smart contract. I'm deploying on Polygon network, and I´m minting all NFTs into my opensea to sell later on in batches. So no DAPP involved.

For me to be safe in terms of avoiding free-minters, I put the cost to 100 ether, that would be 100 matic. But whenever I test through Remix or even through contract itself on polygon scan, it never shows the cost added, only gas fees. Which are way above normal price on mainnet don't know why (~0,47 MATIC when normal is like ~0,005-0,007 MATIC).

What could be the reason of this? Is this normal? I don't want anyone to snipe my nfts for pennies whenever I unpause the contract.

This is how I set up my public props

string public uriPrefix = "";
string public uriSuffis = ".json";
string public hiddenMetadataUri;

uint256 public cost = 100 ether;
uint256 public maxSupply = 10000;
uint256 public maxMintAmountPerTx = 50;

bool public paused = true;
bool public revealed = true;

This is how the mint works:

function mint(uint256 _mintAmount) public payable mintCompliance(_mintAmount) {
   require(!paused, "Contract is paused");
   if (msg.sender != owner()) {
     require(msg.value >= cost * _mintAmount, "Insufficient funds!");
   }

   _mintLoop(msg.sender, _mintAmount);
}


function _mintLoop(address _receiver, uint256 _mintAmount) internal {
   for(uint256 i = 0; i < _mintAmount; i++) {
       supply.increment();
       _safeMint(_receiver, supply.current());
   }
}

I also wish to be able to modify the maxSupply on runtime, so I made this setter function, not really sure if it's okay or if there's something else to check on that I could have missed.

 function setMaxSupply(uint256 _maxSupply) public onlyOwner {
    require(_maxSupply >= supply.current(), "You can't set a value lower than current supply minted!");
    
    maxSupply = _maxSupply;
  }

Thanks in advance.


Solution

  • thats because your contract is paused, making it unusable. You need to transact on your deployed contract to make pause = false. It will let you mint normally and the gas will drop to realistic prices.