Skip to content

Instantly share code, notes, and snippets.

@DonkeVerse
Last active January 7, 2022 06:04
Show Gist options
  • Save DonkeVerse/08eed5950cf84b9c8f0bc5379f65af61 to your computer and use it in GitHub Desktop.
Save DonkeVerse/08eed5950cf84b9c8f0bc5379f65af61 to your computer and use it in GitHub Desktop.
function publicMint(bytes calldata _signature) external payable {
      uint256 _tokenSupply = tokenSupply;
      require(_tokenSupply < MAX_SUPPLY, "max supply");
      require(msg.sender == tx.origin, "no bots");
      require(
          publicMintingAddress ==
              keccak256(
                  abi.encodePacked(
                      "\x19Ethereum Signed Message:\n32",
                      bytes32(uint256(uint160(msg.sender)))
                  )
              ).recover(_signature),
          "not allowed"
      );
      
      require(ERC721._balances[msg.sender] < 2, "too many");
      require(msg.value == 0.06 ether, "wrong price");

      _mint(msg.sender, _tokenSupply);
      unchecked {
          _tokenSupply++;
      }
      tokenSupply = _tokenSupply;
  }
·---------------------------------------|---------------------------|
|         Solc version: 0.8.10          ·  Optimizer enabled: true  ·
········································|···························|
|  Methods                                                           
···············|························|·············|·············|
|  Contract    ·  Method                ·  Min        ·  Max        ·
···············|························|·············|·············|
|  GasContest  ·  publicMint            ·      63867  ·      80967  ·
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment