Skip to content

Instantly share code, notes, and snippets.

@DonkeVerse
Created March 2, 2022 07:41
Show Gist options
  • Save DonkeVerse/7d16df9300abb350986fd9dbab9487ea to your computer and use it in GitHub Desktop.
Save DonkeVerse/7d16df9300abb350986fd9dbab9487ea to your computer and use it in GitHub Desktop.
function mint() external payable {
    uint256 _currentIndex = currentIndex;
    require(_currentIndex < MAX_ID_PLUS_ONE);
    require(msg.value == PRICE, "wrong price");
    require(msg.sender == tx.origin, "only EOA");

    _owners[_currentIndex] = msg.sender;
    emit TransferSingle(msg.sender, address(0), msg.sender, _currentIndex, 1);

    unchecked {
        _currentIndex++;
    }
    currentIndex = _currentIndex;
}

gas cost to mint: 50,998 (optimizer set to 10,000)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment