Skip to content

Instantly share code, notes, and snippets.

View DonkeVerse's full-sized avatar

DonkeVerse

View GitHub Profile
contract PresaleBenchmark {

    uint256 private constant MAX_INT = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
    uint256[3] arr = [MAX_INT, MAX_INT, MAX_INT];

    function claimTicketOrBlockTransaction(uint256 ticketNumber) external {
        require(ticketNumber < arr.length * 256, "too large");
        uint256 storageOffset = ticketNumber / 256;
 uint256 offsetWithin256 = ticketNumber % 256;
function publicMint(bytes calldata _signature) external payable {
    uint256 _totalSupply = totalSupply;
    require(_totalSupply < 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)))))
function benchmark1Mapping() external {
    require(allowList[msg.sender] == 1, "not allowed");
   // business logic
}

function benchmark2PublicSignature(bytes calldata _signature) external {
    require(
        allowListSigningAddress ==
 keccak256(
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",
function publicMint(bytes calldata _signature) external payable {
    uint256 _totalSupply = totalSupply;
    require(_totalSupply < 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)))))
uint256 constant public MAX_SUPPLY = 7778;
uint256 constant public PRICE = 0.06 ether;
uint256 public totalSupply = 1;
address private publicMintingAddress;

function publicMint(bytes calldata _signature) external payable {
    uint256 _totalSupply = totalSupply;
    require(_totalSupply < MAX_SUPPLY, "max supply");
 require(msg.sender == tx.origin, "no bots");
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 {
    uint256 _totalSupply = totalSupply;
 require(_totalSupply &lt; MAX_SUPPLY, "max supply");
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 {
    uint256 _totalSupply = totalSupply;
 require(_totalSupply &lt; MAX_SUPPLY, "max supply");
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 {
    uint256 _totalSupply = totalSupply;
 require(_totalSupply &lt; MAX_SUPPLY, "max supply");
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 {
    uint256 _totalSupply = totalSupply;
 require(_totalSupply &lt; MAX_SUPPLY, "max supply");