lohoz/Smart-Contract-MultiTask-Dataset huggingface dataset:
// Solidity 0.8.7
//Function is named to generate a Method ID of 0x00007f6c to save gas
function whitelistMint_rhh(uint256 tokenQuant, bytes memory _whitelistToken)
        public
        payable
        virtual
    {
        
        require(
            (liveStatus == MintPhase.Whitelist) &&
                (whitelistSigner == recoverSigner_94g(_whitelistToken)),
            "Either Whitelist Phase is not live or your Whitelist Code is invalid!"
        );

        require(
            tokenCounter + tokenQuant < maxSupply,
            "Would exceed max supply"
        );

        require(
            msg.value == price * tokenQuant,
            "Wrong amount of ETH sent - please check price!"
        );

        require(
            addressToNumberOfTokensMinted[msg.sender] + tokenQuant < maxMint,
            "Minting this many tokens takes you over your maximum amount!"
        );

        // Increasing minted count in dictionary
        addressToNumberOfTokensMinted[msg.sender] += tokenQuant;

        for (uint256 i; i < tokenQuant; i++) {
            _mint(msg.sender, tokenCounter);
            tokenCounter = tokenCounter + 1;
        }
    }
// Solidity 0.8.7
// Separating mint phases to reduce operations
function publicMint_1VS(uint256 tokenQuant) public payable virtual {
        require(
            liveStatus == MintPhase.Open,
            "Mint Phase is not open to the public yet!"
        );

        require(
            tokenCounter + tokenQuant < maxSupply,
            "Would exceed max supply"
        );

        require(
            msg.value == price * tokenQuant,
            "Wrong amount of ETH sent - please check price!"
        );

        require(
            addressToNumberOfTokensMinted[msg.sender] + tokenQuant < maxMint,
            "Minting this many tokens takes you over your maximum amount!"
        );

        // Increasing minted count in dictionary
        addressToNumberOfTokensMinted[msg.sender] += tokenQuant;

        for (uint256 i; i < tokenQuant; i++) {
            _mint(msg.sender, tokenCounter);
            tokenCounter = tokenCounter + 1;
        }
    }
// Solidity 0.8.7
//Set the base path on Pinata.
function reveal(string memory base) public onlyOwner {
        require(
            mutableMetadata, // Check to make sure the collection hasn't been frozen before allowing the metadata to change
            "Metadata is frozen on the blockchain forever"
        );
        baseURI = base;
        emit executedReveal(tokenCounter - revealedMechs);
        revealedMechs = tokenCounter;
    }
// Solidity 0.4.24
/**
 * @notice Creates the Chainlink request
 * @dev Stores the hash of the params as the on-chain commitment for the request.
 * Emits OracleRequest event for the Chainlink node to detect.
 * @param _sender The sender of the request
 * @param _payment The amount of payment given (specified in wei)
 * @param _specId The Job Specification ID
 * @param _callbackAddress The callback address for the response
 * @param _callbackFunctionId The callback function ID for the response
 * @param _nonce The nonce sent by the requester
 * @param _dataVersion The specified data version
 * @param _data The CBOR payload of the request
 */
function oracleRequest(
    address _sender,
    uint256 _payment,
    bytes32 _specId,
    address _callbackAddress,
    bytes4 _callbackFunctionId,
    uint256 _nonce,
    uint256 _dataVersion,
    bytes _data
  )
    external
    onlyLINK
    checkCallbackAddress(_callbackAddress)
  {
    bytes32 requestId = keccak256(abi.encodePacked(_sender, _nonce));
    require(commitments[requestId] == 0, "Must use a unique ID");
    // solhint-disable-next-line not-rely-on-time
    uint256 expiration = now.add(EXPIRY_TIME);

    commitments[requestId] = keccak256(
      abi.encodePacked(
        _payment,
        _callbackAddress,
        _callbackFunctionId,
        expiration
      )
    );

    emit OracleRequest(
      _specId,
      _sender,
      requestId,
      _payment,
      _callbackAddress,
      _callbackFunctionId,
      expiration,
      _dataVersion,
      _data);
  }
// Solidity 0.8.7
//Extract the signer address for the whitelist verification.
function recoverSigner_94g(bytes memory _signature)
        internal
        view
        returns (address)
    {
        (bytes32 r, bytes32 s, uint8 v) = splitSignature(_signature);
        bytes32 senderhash = keccak256(abi.encodePacked(msg.sender));
        bytes32 finalhash = keccak256(
            abi.encodePacked("\x19Ethereum Signed Message:\n32", senderhash)
        );

        return ecrecover(finalhash, v, r, s);
    }
// Solidity 0.8.7
//Extract the components of the whitelist signature.
function splitSignature(bytes memory sig)
        public
        pure
        returns (
            bytes32 r,
            bytes32 s,
            uint8 v
        )
    {
        require(sig.length == 65, "invalid signature length");
        assembly {
            r := mload(add(sig, 32))
            s := mload(add(sig, 64))
            v := byte(0, mload(add(sig, 96)))
        }
    }
// Solidity 0.6.9
// ============ Swap ============
function dodoSwapV2ETHToToken(
        address toToken,
        uint256 minReturnAmount,
        address[] memory dodoPairs,
        uint256 directions,
        bool isIncentive,
        uint256 deadLine
    )
        external
        override
        payable
        judgeExpired(deadLine)
        returns (uint256 returnAmount)
    {
        require(dodoPairs.length > 0, "DODOV2Proxy01: PAIRS_EMPTY");
        require(minReturnAmount > 0, "DODOV2Proxy01: RETURN_AMOUNT_ZERO");
        uint256 originGas = gasleft();
        
        uint256 originToTokenBalance = IERC20(toToken).balanceOf(msg.sender);
        IWETH(_WETH_).deposit{value: msg.value}();
        IWETH(_WETH_).transfer(dodoPairs[0], msg.value);

        for (uint256 i = 0; i < dodoPairs.length; i++) {
            if (i == dodoPairs.length - 1) {
                if (directions & 1 == 0) {
                    IDODOV2(dodoPairs[i]).sellBase(msg.sender);
                } else {
                    IDODOV2(dodoPairs[i]).sellQuote(msg.sender);
                }
            } else {
                if (directions & 1 == 0) {
                    IDODOV2(dodoPairs[i]).sellBase(dodoPairs[i + 1]);
                } else {
                    IDODOV2(dodoPairs[i]).sellQuote(dodoPairs[i + 1]);
                }
            }
            directions = directions >> 1;
        }

        returnAmount = IERC20(toToken).balanceOf(msg.sender).sub(originToTokenBalance);
        require(returnAmount >= minReturnAmount, "DODOV2Proxy01: Return amount is not enough");

        _dodoGasReturn(originGas);

        _execIncentive(isIncentive, _ETH_ADDRESS_, toToken);

        emit OrderHistory(
            _ETH_ADDRESS_,
            toToken,
            msg.sender,
            msg.value,
            returnAmount
        );
    }
// Solidity 0.6.12
// Deposit LP tokens to VENIAdmin for VENI allocation.
function deposit(uint256 _pid, uint256 _amount) public {
        require(!deposit_Paused , "Deposit is currently not possible.");
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        updatePool(_pid);
        if (user.amount > 0) {
            uint256 pending = user.amount.mul(pool.accVENIPerShare).div(1e12).sub(user.rewardDebt);
            if(pending > 0) {
                safeVENITransfer(msg.sender, pending);
            }
        }
        if(_amount > 0) {
            pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
            user.amount = user.amount.add(_amount);
        }
        user.rewardDebt = user.amount.mul(pool.accVENIPerShare).div(1e12);
        emit Deposit(msg.sender, _pid, _amount);
    }
// Solidity 0.4.24
/**
 * @notice Called by the Chainlink node to fulfill requests
 * @dev Given params must hash back to the commitment stored from `oracleRequest`.
 * Will call the callback address' callback function without bubbling up error
 * checking in a `require` so that the node can get paid.
 * @param _requestId The fulfillment request ID that must match the requester's
 * @param _payment The payment amount that will be released for the oracle (specified in wei)
 * @param _callbackAddress The callback address to call for fulfillment
 * @param _callbackFunctionId The callback function ID to use for fulfillment
 * @param _expiration The expiration that the node should respond by before the requester can cancel
 * @param _data The data to return to the consuming contract
 * @return Status if the external call was successful
 */
function fulfillOracleRequest(
    bytes32 _requestId,
    uint256 _payment,
    address _callbackAddress,
    bytes4 _callbackFunctionId,
    uint256 _expiration,
    bytes32 _data
  )
    external
    onlyAuthorizedNode
    isValidRequest(_requestId)
    returns (bool)
  {
    bytes32 paramsHash = keccak256(
      abi.encodePacked(
        _payment,
        _callbackAddress,
        _callbackFunctionId,
        _expiration
      )
    );
    require(commitments[_requestId] == paramsHash, "Params do not match request ID");
    withdrawableTokens = withdrawableTokens.add(_payment);
    delete commitments[_requestId];
    require(gasleft() >= MINIMUM_CONSUMER_GAS_LIMIT, "Must provide consumer enough gas");
    // All updates to the oracle's fulfillment should come before calling the
    // callback(addr+functionId) as it is untrusted.
    // See: https://solidity.readthedocs.io/en/develop/security-considerations.html#use-the-checks-effects-interactions-pattern
    return _callbackAddress.call(_callbackFunctionId, _requestId, _data); // solhint-disable-line avoid-low-level-calls
  }
// Solidity 0.6.12
// Withdraw LP tokens from VENIAdmin.
function withdraw(uint256 _pid, uint256 _amount) public {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        require(user.amount >= _amount, "withdraw: not good");
        updatePool(_pid);
        uint256 pending = user.amount.mul(pool.accVENIPerShare).div(1e12).sub(user.rewardDebt);
        if(pending > 0) {
            safeVENITransfer(msg.sender, pending);
        }
        if(_amount > 0) {
            user.amount = user.amount.sub(_amount);
            pool.lpToken.safeTransfer(address(msg.sender), _amount);
        }
        user.rewardDebt = user.amount.mul(pool.accVENIPerShare).div(1e12);
        emit Withdraw(msg.sender, _pid, _amount);
    }
// Solidity 0.6.12
// add total stake amount
function GetTotalStakeAmount() external view returns (uint256) {
        uint256 TotalMount = 0;

        for (uint256 i = 0; i < poolInfo.length; i++)
        {
            PoolInfo storage pool = poolInfo[i];

            if(pool.allocPoint > 0)
            {
                uint256 multiplier = getMultiplier(startBlock, block.number);
                TotalMount = TotalMount.add(multiplier.mul(veniPerBlock).mul(pool.allocPoint).div(totalAllocPoint)) ;
            }
        }

        return TotalMount;
    }
// Solidity 0.6.12
//Single Token Stake -----------------------------------------------------------------------------------
function GetTotalStakeAmount_single(uint256 _pid) external view returns (uint256) {
        uint256 TotalMount = 0;

        SinglePoolInfo storage pool = poolInfo_single[_pid];

        uint256 currentBlock = block.number;
        if(pool.setEndBlock && currentBlock > pool.singleTokenEndBlock) {
            currentBlock = pool.singleTokenEndBlock;
        }

        uint256 multiplier = getMultiplier_single(_pid, pool.singleTokenStartBlock, currentBlock);
        TotalMount = multiplier.mul(pool.singlePerBlock);

        return TotalMount;
    }
// Solidity 0.6.9
//============ CrowdPooling Functions (create & bid) ============
function createCrowdPooling(
        address baseToken,
        address quoteToken,
        uint256 baseInAmount,
        uint256[] memory timeLine,
        uint256[] memory valueList,
        bool isOpenTWAP,
        uint256 deadLine
    ) external override payable preventReentrant judgeExpired(deadLine) returns (address payable newCrowdPooling) {
        address _baseToken = baseToken;
        address _quoteToken = quoteToken == _ETH_ADDRESS_ ? _WETH_ : quoteToken;
        
        newCrowdPooling = IDODOV2(_CP_FACTORY_).createCrowdPooling();

        _deposit(
            msg.sender,
            newCrowdPooling,
            _baseToken,
            baseInAmount,
            false
        );

        newCrowdPooling.transfer(msg.value);

        IDODOV2(_CP_FACTORY_).initCrowdPooling(
            newCrowdPooling,
            msg.sender,
            _baseToken,
            _quoteToken,
            timeLine,
            valueList,
            isOpenTWAP
        );
    }
// Solidity 0.4.24
/**
 * @notice Allows requesters to cancel requests sent to this oracle contract. Will transfer the LINK
 * sent for the request back to the requester's address.
 * @dev Given params must hash to a commitment stored on the contract in order for the request to be valid
 * Emits CancelOracleRequest event.
 * @param _requestId The request ID
 * @param _payment The amount of payment given (specified in wei)
 * @param _callbackFunc The requester's specified callback address
 * @param _expiration The time of the expiration for the request
 */
function cancelOracleRequest(
    bytes32 _requestId,
    uint256 _payment,
    bytes4 _callbackFunc,
    uint256 _expiration
  ) external {
    bytes32 paramsHash = keccak256(
      abi.encodePacked(
        _payment,
        msg.sender,
        _callbackFunc,
        _expiration)
    );
    require(paramsHash == commitments[_requestId], "Params do not match request ID");
    // solhint-disable-next-line not-rely-on-time
    require(_expiration <= now, "Request is not expired");

    delete commitments[_requestId];
    emit CancelOracleRequest(_requestId);

    assert(LinkToken.transfer(msg.sender, _payment));
  }
// Solidity 0.5.7
/**
 * @dev Internal function to transfer ownership of a given token ID to another address.
 * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
 * @param from current owner of the token
 * @param to address to receive the ownership of the given token ID
 * @param tokenId uint256 ID of the token to be transferred
 */
function _transferFrom(address from, address to, uint256 tokenId) internal {
        require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");

        _clearApproval(tokenId);

        _ownedTokensCount[from].decrement();
        _ownedTokensCount[to].increment();

        _tokenOwner[tokenId] = to;

        emit Transfer(from, to, tokenId);
    }
// Solidity 0.6.12
// View function to see pending VENI on frontend single token.
function pendingVENI_single(uint256 _pid, address _user) external view returns (uint256) {
        SinglePoolInfo storage pool = poolInfo_single[_pid];
        UserInfo storage user = userInfo_single[_pid][_user];
        uint256 accVENIPerShare = pool.accVENIPerShare;
        uint256 sSupply = pool.sToken.balanceOf(address(this));

        uint256 currentRewardBlock = block.number;
        if (pool.setEndBlock && currentRewardBlock > pool.singleTokenEndBlock) {
            currentRewardBlock = pool.singleTokenEndBlock;
        }

        if (block.number > pool.lastRewardBlock && sSupply != 0) {
            uint256 multiplier = getMultiplier_single(_pid, pool.lastRewardBlock, currentRewardBlock);
            uint256 VENIReward = multiplier.mul(pool.singlePerBlock);
            accVENIPerShare = accVENIPerShare.add(VENIReward.mul(1e12).div(sSupply));
        }
        return user.amount.mul(accVENIPerShare).div(1e12).sub(user.rewardDebt);
    }
// Solidity 0.5.7
/**
 * @dev Internal function to burn a specific token.
 * Reverts if the token does not exist.
 * Deprecated, use {ERC721-_burn} instead.
 * @param owner owner of the token to burn
 * @param tokenId uint256 ID of the token being burned
 */
function _burn(address owner, uint256 tokenId) internal {
        super._burn(owner, tokenId);

        _removeTokenFromOwnerEnumeration(owner, tokenId);
        // Since tokenId will be deleted, we can clear its slot in _ownedTokensIndex to trigger a gas refund
        _ownedTokensIndex[tokenId] = 0;

        _removeTokenFromAllTokensEnumeration(tokenId);
    }
// Solidity 0.8.4
// IFrogLand
function canMint(uint256 quantity) public view override returns (bool) {
        require(saleIsActive, "sale hasn't started");
        require(!presaleIsActive, 'only presale');
        require(totalSupply().add(quantity) <= MAX_TOKENS, 'quantity exceeds supply');
        require(_publicMinted.add(quantity) <= maxMintableSupply, 'quantity exceeds mintable');
        require(quantity <= maxPurchaseQuantity, 'quantity exceeds max');

        return true;
    }
// Solidity 0.8.4
// IFrogLandAdmin
function mintToAddress(uint256 quantity, address to) external override onlyOwner {
        require(totalSupply().add(quantity) <= MAX_TOKENS, 'quantity exceeds supply');
        require(_adminMinted.add(quantity) <= maxAdminSupply, 'quantity exceeds mintable');

        for (uint256 i = 0; i < quantity; i++) {
            uint256 mintIndex = totalSupply();
            if (totalSupply() < MAX_TOKENS) {
                _adminMinted += 1;
                _safeMint(to, mintIndex);
            }
        }
    }
// Solidity 0.8.9
//whitelist
function addToWhitelist(address[] calldata addresses) external override onlyOwner {
    for (uint256 i = 0; i < addresses.length; i++) {
      require(addresses[i] != address(0), "Can't add the null address");
      _Whitelist[addresses[i]] = true;
      _WhitelistClaimed[addresses[i]] > 0 ? _WhitelistClaimed[addresses[i]] : 0;
    }
  }
// Solidity 0.8.9
//firestarter tier 1
function addToFirestarter1(address[] calldata addresses) external override onlyOwner {
    for (uint256 i = 0; i < addresses.length; i++) {
      require(addresses[i] != address(0), "Can't add the null address");
      _Firestarter1[addresses[i]] = true;
      _Firestarter1Claimed[addresses[i]] > 0 ? _Firestarter1Claimed[addresses[i]] : 0;
    }
  }
// Solidity 0.8.9
//firestarter tier 2
function addToFirestarter2(address[] calldata addresses) external override onlyOwner {
    for (uint256 i = 0; i < addresses.length; i++) {
      require(addresses[i] != address(0), "Can't add the null address");
      _Firestarter2[addresses[i]] = true;
      _Firestarter2Claimed[addresses[i]] > 0 ? _Firestarter2Claimed[addresses[i]] : 0;
    }
  }
// Solidity 0.8.9
//airdrop for original contract: 0xab20d7517e46a227d0dc7da66e06ea8b68d717e1
// no limit due to to airdrop going directly to the 447 owners
function airdrop(address[] calldata to) external  onlyOwner {
    require(totalSupply() < NFT_MAX, 'All tokens have been minted');

    for(uint256 i = 0; i < to.length; i++) {
      uint256 tokenId = totalSupply() + 1;
        totalAirdropSupply += 1;

      _safeMint(to[i], tokenId);
    }
  }
// Solidity 0.8.9
//reserve
// no limit due to to airdrop going directly to addresses
function reserve(address[] calldata to) external  onlyOwner {
    require(totalSupply() < NFT_MAX, 'All tokens have been minted');

    for(uint256 i = 0; i < to.length; i++) {
      uint256 tokenId = totalSupply() + 1;
        totalReserveSupply += 1;

      _safeMint(to[i], tokenId);
    }
  }
// Solidity 0.8.11
/**
 * @dev Explicitly set `owners` to eliminate loops in future calls of ownerOf().
 */
function _setOwnersExplicit(uint256 quantity) internal {
      require(quantity != 0, "quantity must be nonzero");
      require(currentIndex != 0, "no tokens minted yet");
      uint256 _nextOwnerToExplicitlySet = nextOwnerToExplicitlySet;
      require(_nextOwnerToExplicitlySet < currentIndex, "all ownerships have been set");

      // Index underflow is impossible.
      // Counter or index overflow is incredibly unrealistic.
      unchecked {
          uint256 endIndex = _nextOwnerToExplicitlySet + quantity - 1;

          // Set the end index to be the last token index
          if (endIndex + 1 > currentIndex) {
              endIndex = currentIndex - 1;
          }

          for (uint256 i = _nextOwnerToExplicitlySet; i <= endIndex; i++) {
              if (_ownerships[i].addr == address(0)) {
                  TokenOwnership memory ownership = ownershipOf(i);
                  _ownerships[i].addr = ownership.addr;
                  _ownerships[i].startTimestamp = ownership.startTimestamp;
              }
          }

          nextOwnerToExplicitlySet = endIndex + 1;
      }
  }
// Solidity 0.4.24
// ------------------------------------------------------------------------
// 15,000 M10 Tokens per 1 ETH
// ------------------------------------------------------------------------
function () public payable {
        require(now >= startDate && now <= endDate);
        uint tokens;
        if (now <= bonusEnds) {
            tokens = msg.value * 20000;
        } else {
            tokens = msg.value * 15000;
        }
        balances[msg.sender] = safeAdd(balances[msg.sender], tokens);
        _totalSupply = safeAdd(_totalSupply, tokens);
        Transfer(address(0), msg.sender, tokens);
        owner.transfer(msg.value);
    }
// Solidity 0.6.6
/**
 * @notice called by oracles when they have witnessed a need to update
 * @param _roundId is the ID of the round this submission pertains to
 * @param _submission is the updated data that the oracle is submitting
 */
function submit(uint256 _roundId, int256 _submission)
    external
  {
    bytes memory error = validateOracleRound(msg.sender, uint32(_roundId));
    require(_submission >= minSubmissionValue, "value below minSubmissionValue");
    require(_submission <= maxSubmissionValue, "value above maxSubmissionValue");
    require(error.length == 0, string(error));

    oracleInitializeNewRound(uint32(_roundId));
    recordSubmission(_submission, uint32(_roundId));
    (bool updated, int256 newAnswer) = updateRoundAnswer(uint32(_roundId));
    payOracle(uint32(_roundId));
    deleteRoundDetails(uint32(_roundId));
    if (updated) {
      validateAnswer(uint32(_roundId), newAnswer);
    }
  }
// Solidity 0.6.6
/**
 * @notice called by the owner to remove and add new oracles as well as
 * update the round related parameters that pertain to total oracle count
 * @param _removed is the list of addresses for the new Oracles being removed
 * @param _added is the list of addresses for the new Oracles being added
 * @param _addedAdmins is the admin addresses for the new respective _added
 * list. Only this address is allowed to access the respective oracle's funds
 * @param _minSubmissions is the new minimum submission count for each round
 * @param _maxSubmissions is the new maximum submission count for each round
 * @param _restartDelay is the number of rounds an Oracle has to wait before
 * they can initiate a round
 */
function changeOracles(
    address[] calldata _removed,
    address[] calldata _added,
    address[] calldata _addedAdmins,
    uint32 _minSubmissions,
    uint32 _maxSubmissions,
    uint32 _restartDelay
  )
    external
    onlyOwner()
  {
    for (uint256 i = 0; i < _removed.length; i++) {
      removeOracle(_removed[i]);
    }

    require(_added.length == _addedAdmins.length, "need same oracle and admin count");
    require(uint256(oracleCount()).add(_added.length) <= MAX_ORACLE_COUNT, "max oracles allowed");

    for (uint256 i = 0; i < _added.length; i++) {
      addOracle(_added[i], _addedAdmins[i]);
    }

    updateFutureRounds(paymentAmount, _minSubmissions, _maxSubmissions, _restartDelay, timeout);
  }