Skip to content

Instantly share code, notes, and snippets.

@DonkeVerse
Last active January 7, 2022 05:58
Show Gist options
  • Save DonkeVerse/c05eb7c572d169d65a1c2c14b83b7736 to your computer and use it in GitHub Desktop.
Save DonkeVerse/c05eb7c572d169d65a1c2c14b83b7736 to your computer and use it in GitHub Desktop.
uint256 constant public MAX_SUPPLY = 7778;
uint256 constant public PRICE = 0.06 ether;
bool public enablePublicMint = true;
uint256 public totalSupply = 1;
address private publicMintingAddress;

function publicMint(bytes calldata _signature) external payable {
    require(totalSupply < MAX_SUPPLY, "max supply");
    require(enablePublicMint, "public mint enabled");
    require(msg.sender == tx.origin);
    require(publicMintingAddress ==
        bytes32(uint256(uint160(msg.sender)))
            .toEthSignedMessageHash()
            .recover(_signature),
        "not allowed"
    );
    require(balanceOf(msg.sender) < 2, "too many");
    require(msg.value == PRICE, "wrong price");

    totalSupply++;
    _safeMint(msg.sender, totalSupply - 1);
}
|  Methods                              · 
···············|························|··············|·············|
|  Contract    ·  Method                ·  Min         ·  Max        ·
···············|························|··············|·············|
|  GasContest  ·  publicMint            ·       68511  ·      85611  ·
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment