0

I am using uniswap v2 router in with the following code:

  function mintNFT(address recipient)
    public payable 
    returns (uint256) {
      require(msg.value >= mintCost, "Insufficient funds");
      require(bytes(tokenURI).length > 0, "Token URI not set yet");
      require(locked != 1, "Contract Locked");
      require(minted + 1 <= MAX_SUPPLY, "Max Supply Hit");
  buyAndSend();
  uint256 newItemId = _tokenIds.current();
  _tokenIds.increment();
  _safeMint(recipient, newItemId);
  _setTokenURI(newItemId, tokenURI);
  minted += 1;
  return newItemId;

}

function buyAndSend() internal { address[] memory path = new address2; uint amountOutMin = mintCost * percentage / 100; if (amountOutMin > 0) { address WETH_ADDRESS = uniswapRouter.WETH(); path[0] = WETH_ADDRESS; path[1] = TOKEN_ADDRESS; address to = address(this); uint deadline = block.timestamp + 100; uniswapRouter.swapExactETHForTokens{ value: amountOutMin }(amountOutMin, path, to, deadline); IERC20 my_tokens = IERC20(TOKEN_ADDRESS); require(my_tokens.balanceOf(address(this)) >= 0, "Insufficient funds"); my_tokens.transfer(REWARD_WALLET, my_tokens.balanceOf(address(this))); } }

I am getting this error when attempting to mint: Returned error: {"jsonrpc":"2.0","error":"execution reverted: _transfer:: Transfer Delay enabled. Only one purchase per block allowed.","id":4001018723196707}

This function works correctly on goerli but is failing on mainnet.

0 Answers0