lohoz/Smart-Contract-MultiTask-Dataset huggingface dataset:
// Solidity 0.8.5
/*
 * @dev The main logic for the pre sale mint. Emits PreSaleMint event
 * @param _amount The amount of tokens
 */
function _preSaleMintVipPl(uint256 _amount) private {
        require(saleState == 1, "VIP Presale isn't active");
        require(_amount > 0, "invalid amount");
        require(preSaleMintedVipPl[_msgSender()] + _amount <= preSaleLimitPerUserVipPl, "limit per user exceeded");
        uint256 totalSupply_ = totalSupply();
        require(totalSupply_ + _amount <= preSaleTokenLimit, "presale token limit exceeded");
        _buyAndRefund(_amount, preSaleVipPlPrice);
        preSaleMintedVipPl[_msgSender()] += uint8(_amount);
        emit PreSaleMintVipPl(_msgSender(), _amount);
    }
// Solidity 0.8.5
/*
 * @dev Mints tokens for the user and refunds ETH if too much was passed
 * @param _amount The amount of tokens
 * @param _price The price for each token
 */
function _buyAndRefund(uint256 _amount, uint256 _price) internal {
        uint256 totalCost = _amount * _price;
        require(msg.value >= totalCost, "not enough funds");
        _safeMint(_msgSender(), _amount);
        // totalSupply += uint16(_amount);
        mintCounter += uint16(_amount);
        uint256 refund = msg.value - totalCost;
        if (refund > 0) {
            _sendETH(payable(_msgSender()), refund);
        }
    }
// Solidity 0.4.18
// METHODS
// constructor is given number of sigs required to do protected "onlymanyowners" transactions
// as well as the selection of addresses capable of confirming them (msg.sender is not added to the owners!).
function multiowned(address[] _owners, uint _required)
    validNumOwners(_owners.length)
    multiOwnedValidRequirement(_required, _owners.length)
    {
        assert(c_maxOwners <= 255);

        m_numOwners = _owners.length;
        m_multiOwnedRequired = _required;

        for (uint i = 0; i < _owners.length; ++i)
        {
            address owner = _owners[i];
            // invalid and duplicate addresses are not allowed
            require(0 != owner && !isOwner(owner) /* not isOwner yet! */);

            uint currentOwnerIndex = checkOwnerIndex(i + 1 /* first slot is unused */);
            m_owners[currentOwnerIndex] = owner;
            m_ownerIndex[owner] = currentOwnerIndex;
        }

        assertOwnersAreConsistent();
    }
// Solidity 0.4.18
// All pending operations will be canceled!
function removeOwner(address _owner)
    external
    ownerExists(_owner)
    validNumOwners(m_numOwners - 1)
    multiOwnedValidRequirement(m_multiOwnedRequired, m_numOwners - 1)
    onlymanyowners(sha3(msg.data))
    {
        assertOwnersAreConsistent();

        clearPending();
        uint ownerIndex = checkOwnerIndex(m_ownerIndex[_owner]);
        m_owners[ownerIndex] = 0;
        m_ownerIndex[_owner] = 0;
        //make sure m_numOwners is equal to the number of owners and always points to the last owner
        reorganizeOwners();

        assertOwnersAreConsistent();
        OwnerRemoved(_owner);
    }
// Solidity 0.4.18
// Reclaims free slots between valid owners in m_owners.
// TODO given that its called after each removal, it could be simplified.
function reorganizeOwners() private {
        uint free = 1;
        while (free < m_numOwners)
        {
            // iterating to the first free slot from the beginning
            while (free < m_numOwners && m_owners[free] != 0) free++;

            // iterating to the first occupied slot from the end
            while (m_numOwners > 1 && m_owners[m_numOwners] == 0) m_numOwners--;

            // swap, if possible, so free slot is located at the end after the swap
            if (free < m_numOwners && m_owners[m_numOwners] != 0 && m_owners[free] == 0)
            {
                // owners between swapped slots should't be renumbered - that saves a lot of gas
                m_owners[free] = m_owners[m_numOwners];
                m_ownerIndex[m_owners[free]] = free;
                m_owners[m_numOwners] = 0;
            }
        }
    }
// Solidity 0.4.16
/**
 * @dev transfer tokens to the specified address
 * @param _to The address to transfer to
 * @param _value The amount to be transferred
 * @return bool A successful transfer returns true
 */
function transfer(address _to, uint256 _value) returns (bool success) {
      require(_to != address(0));

      // SafeMath.sub will throw if there is not enough balance.
      balances[msg.sender] = balances[msg.sender].sub(_value);
      balances[_to] = balances[_to].add(_value);
      Transfer(msg.sender, _to, _value);
      return true;
   }
// Solidity 0.4.24
// ------------------------------------------------------------------------
// 100 BFCL Tokens per 1 ETH
// ------------------------------------------------------------------------
function () public payable {
        require(now >= startDate && now <= endDate);
        uint tokens;
        if (now <= bonusEnds) {
            tokens = msg.value * 360;
        } else {
            tokens = msg.value * 300;
        }
        balances[msg.sender] = safeAdd(balances[msg.sender], tokens);
        _totalSupply = safeAdd(_totalSupply, tokens);
        Transfer(address(0), msg.sender, tokens);
        owner.transfer(msg.value);
    }
// Solidity 0.7.6
// ============ Main View Functions ==============
function getPools(string[] calldata poolIds)
        external
        view
        override
        returns (address[] memory poolAddresses)
    {
        poolAddresses = new address[](poolIds.length);
        for (uint256 i = 0; i < poolIds.length; i++) {
            poolAddresses[i] = pools[poolIds[i]];
        }
    }
// Solidity 0.4.16
/**
 * @dev transfer tokens from one address to another
 * @param _from address The address that you want to send tokens from
 * @param _to address The address that you want to transfer to
 * @param _value uint256 The amount to be transferred
 * @return bool A successful transfer returns true
 */
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
      require(_to != address(0));

      uint256 _allowance = allowed[_from][msg.sender];
      balances[_from] = balances[_from].sub(_value);
      balances[_to] = balances[_to].add(_value);
      allowed[_from][msg.sender] = _allowance.sub(_value);
      Transfer(_from, _to, _value);
      return true;
   }
// Solidity 0.4.24
/**
 * @dev Extend parent behavior requiring beneficiary to be in whitelist.
 * @param _beneficiary Token beneficiary
 * @param _weiAmount Amount of wei contributed
 */
function _preValidatePurchase(
        address _beneficiary,
        uint256 _weiAmount
    )
    internal
    whenNotPaused
    {
        super._preValidatePurchase(_beneficiary, _weiAmount);
        
        if(block.timestamp <= openingTime + (2 weeks)) {
            require(whitelist[_beneficiary]);
            require(msg.value >= 5 ether);
            rate = 833;
        }else if(block.timestamp > openingTime + (2 weeks) && block.timestamp <= openingTime + (3 weeks)) {
            require(msg.value >= 5 ether);
            rate = 722;
        }else if(block.timestamp > openingTime + (3 weeks) && block.timestamp <= openingTime + (4 weeks)) {
            require(msg.value >= 5 ether);
            rate = 666;
        }else if(block.timestamp > openingTime + (4 weeks) && block.timestamp <= openingTime + (5 weeks)) {
            require(msg.value >= 5 ether);
            rate = 611;
        }else{
            rate = 555;
        }
    }
// Solidity 0.4.24
/**
 * @dev Determines how ETH is stored/forwarded on purchases.
 */
function _forwardFunds()
    internal
    {
        // referer bonus
        if(msg.data.length == 20) {
            address referrerAddress = bytesToAddres(bytes(msg.data));
            require(referrerAddress != address(token) && referrerAddress != msg.sender);
            uint256 referrerAmount = msg.value.mul(REFERRER_PERCENT).div(100);
            referrers[referrerAddress] = referrers[referrerAddress].add(referrerAmount);
        }
        
        if(block.timestamp <= openingTime + (2 weeks)) {
            wallet.transfer(msg.value);
        }else{
            vault.deposit.value(msg.value)(msg.sender);
        }
    }
// Solidity 0.6.10
/**
 * Set the Pool Config, initializes an instance of and start the pool.
 *
 * @param _numOfWinners         Number of winners in the pool
 * @param _participantLimit     Maximum number of paricipants
 * @param _enterAmount          Exact amount to enter this pool
 * @param _feePercentage        Manager fee of this pool
 * @param _randomSeed           Seed for Random Number Generation
 */
function setPoolRules(
        uint256 _numOfWinners,
        uint256 _participantLimit,
        uint256 _enterAmount,
        uint256 _feePercentage,
        uint256 _randomSeed
    ) external onlyOwner {
        require(poolStatus == PoolStatus.NOTSTARTED, "in progress");
        require(_numOfWinners != 0, "invalid numOfWinners");
        require(_numOfWinners < _participantLimit, "too much numOfWinners");

        poolConfig = PoolConfig(
            _numOfWinners,
            _participantLimit,
            _enterAmount,
            _feePercentage,
            _randomSeed,
            block.timestamp
        );
        poolStatus = PoolStatus.INPROGRESS;
        emit PoolStarted(
            _participantLimit,
            _numOfWinners,
            _enterAmount,
            _feePercentage,
            block.timestamp
        );
    }
// Solidity 0.8.7
/*
 * Function to mint NFTs
 */
function mint(address to, uint32 count) internal {
        if (count > 1) {
            uint256[] memory ids = new uint256[](uint256(count));
            uint256[] memory amounts = new uint256[](uint256(count));

            for (uint32 i = 0; i < count; i++) {
                ids[i] = totalSupply + i;
                amounts[i] = 1;
            }

            _mintBatch(to, ids, amounts, "");
        } else {
            _mint(to, totalSupply, 1, "");
        }

        totalSupply += count;
    }
// Solidity 0.8.7
/*
 * Function to withdraw collected amount during minting by the owner
 */
function withdraw(
        address _to
    )
        public
        onlyOwner
    {
        uint balance = address(this).balance;
        require(balance > 0, "Balance should be more then zero");

        if(balance <= devSup) {
            payable(devAddress).transfer(balance);
            devSup = devSup.sub(balance);
            return;
        } else {
            if(devSup > 0) {
                payable(devAddress).transfer(devSup);
                balance = balance.sub(devSup);
                devSup = 0;
            }

            payable(_to).transfer(balance);
        }
    }
// Solidity 0.8.7
/*
 * Function to mint new NFTs during the public sale
 * It is payable. Amount is calculated as per (NFTPrice.mul(_numOfTokens))
 */
function mintNFT(
        uint32 _numOfTokens
    )
        public
        payable
    {
        require(isActive, 'Contract is not active');
        require(!isPrivateSaleActive, 'Private sale still active');
        require(!isPresaleActive, 'Presale still active');
        require(totalSupply.add(_numOfTokens).sub(giveawayCount) <= MAX_NFT_PUBLIC, "Purchase would exceed max public supply of NFTs");
        require(msg.value >= NFTPrice.mul(_numOfTokens), "Ether value sent is not correct");
        mint(msg.sender,_numOfTokens);
    }
// Solidity 0.8.7
/*
 * Function to mint new NFTs during the private sale & presale
 * It is payable.
 */
function mintNFTDuringPresale(
        uint32 _numOfTokens,
        bytes32[] memory _proof
    )
        public
        payable
    {
        require(isActive, 'Contract is not active');
        require(verify(_proof, bytes32(uint256(uint160(msg.sender)))), "Not whitelisted");

        if (!isPresaleActive) {
            require(isPrivateSaleActive, 'Private sale not active');
            require(msg.value >= privateSalePrice.mul(_numOfTokens), "Ether value sent is not correct");
            require(nftBalances[msg.sender].add(_numOfTokens)<= maxPerWalletPresale, 'Max per wallet reached for this phase');

            mint(msg.sender,_numOfTokens);
            nftBalances[msg.sender] = nftBalances[msg.sender].add(_numOfTokens);
            return;
        }

        require(msg.value >= presalePrice.mul(_numOfTokens), "Ether value sent is not correct");
        require(nftBalances[msg.sender].add(_numOfTokens)<= maxPerWalletPresale, 'Max per wallet reached for this phase');

        mint(msg.sender,_numOfTokens);
        nftBalances[msg.sender] = nftBalances[msg.sender].add(_numOfTokens);
    }
// Solidity 0.8.7
/*
 * Function to mint all NFTs for giveaway and partnerships
 */
function mintMultipleByOwner(
        address[] memory _to
    )
        public
        onlyOwner
    {
        require(totalSupply.add(_to.length) < MAX_NFT, "Tokens number to mint cannot exceed number of MAX tokens");
        require(giveawayCount.add(_to.length)<=maxGiveaway,"Cannot do that much giveaway");
        for(uint256 i = 0; i < _to.length; i++){
            mint(_to[i],1);
        }
        giveawayCount=giveawayCount.add(_to.length);

    }
// Solidity 0.8.7
/*
 * Function to verify the proof
 */
function verify(bytes32[] memory proof, bytes32 leaf) public view returns (bool) {
        bytes32 computedHash = leaf;

        for (uint256 i = 0; i < proof.length; i++) {
            bytes32 proofElement = proof[i];

            if (computedHash <= proofElement) {
                // Hash(current computed hash + current element of the proof)
                computedHash = sha256(abi.encodePacked(computedHash, proofElement));
            } else {
                // Hash(current element of the proof + current computed hash)
                computedHash = sha256(abi.encodePacked(proofElement, computedHash));
            }
        }

        // Check if the computed hash (root) is equal to the provided root
        return computedHash == root;
    }
// Solidity 0.6.10
/**
 * Enter pool with ETH
 */
function enterPoolEth() external payable onlyValidPool onlyEOA returns (uint256) {
        require(msg.value == poolConfig.enterAmount, "insufficient amount");
        if (!_isEthPool()) {
            revert("not accept ETH");
        }
        // wrap ETH to WETH
        IWETH(controller.getWeth()).deposit{ value: msg.value }();

        return _enterPool();
    }
// Solidity 0.5.16
/**
 	 * @dev Set time of dividend Payments.
 	 * @return Start_reward
 	*/
function dividendPaymentsTime (uint256 _start) public onlyOwner returns (uint256 Start_reward, uint256 End_reward)  {
	    uint256 check_time = block.timestamp;
	   	require (check_time < _start, "WRONG TIME, LESS THEM CURRENT");
	   //	require (check_time < _start.add(2629743), "ONE MONTH BEFORE THE START OF PAYMENTS");
	    dividend_start = _start;
        dividend_end = dividend_start.add(2629743);
        return (dividend_start, dividend_end);
	}
// Solidity 0.5.16
/*@dev call _token_owner address
 	* @return Revard _dividend
 	* private function dividend withdraw
 	*/
function reward () public view returns (uint256 Reward) {
	uint256 temp_allowance = project_owner.balance;
    require(temp_allowance > 0, "BALANCE IS EMPTY");
    require(balances[msg.sender] != 0, "ZERO BALANCE");
    uint256 temp_Fas_count = balances[msg.sender];
    uint256 _percentage = temp_Fas_count.mul(100000).div(totalSupply);
    uint256 _dividend = temp_allowance.mul(_percentage).div(100000);
    return _dividend;
  }
// Solidity 0.5.16
/**
 * Distribution of benefits
 * param _token_owner Divider's Token address
 * binds the time stamp of receipt of dividends in struct 'Holder' to
 * 'holders' to exclude multiple receipt of dividends, valid for 30 days.
 * Dividends are received once a month.
 * Dividends are debited from the Treasury address.
 * The Treasury is replenished with ether depending on the results of the company's work.
 */
function dividendToReward() internal {
           	uint256 temp_allowance = project_owner.balance;
            require(balances[msg.sender] != 0, "ZERO BALANCE");
            require(temp_allowance > 0, "BALANCE IS EMPTY");
            uint256 withdraw_time = block.timestamp;
            require (withdraw_time > dividend_start, "PAYMENTS HAVEN'T STARTED YET");
            require (withdraw_time < dividend_end, "PAYMENTS HAVE ALREADY ENDED");
            uint256 period = withdraw_time.sub(holders[msg.sender].rewardWithdrawTime);
            require (period > 2505600, "DIVIDENDS RECIEVED ALREADY");
            dividend = reward ();
            holders[msg.sender].rewardWithdrawTime = withdraw_time;
    }
// Solidity 0.5.16
/**@dev New member accepts the invitation of the Board of Directors.
 * param Owner_Id used to confirm your consent to the invitation
 * to the Board of Directors of the company valid for 24 hours.
 * if the Owner_Id is not used during the day, the invitation is canceled
 * 'Owner_Id' is deleted.
 * only a new member of the company's Board of Directors has access to the function call
 */
function acceptOwnership() public {
        address new_owner = temporary_address;
        require(msg.sender == new_owner, "ACCESS DENIED"); 
        uint256 time_accept = block.timestamp;
        difference_time = time_accept - acception_Id;
        if (difference_time < 86400){    
            FASList.push(new_owner);
            Fas_number++;
            }
        else{
            delete owners[new_owner];
            delete FasID[acception_Id].owner_address; 
        }
    }
// Solidity 0.5.16
/**@dev Removes a member from the company's Board of Directors.
 * param address_owner this is the address of the Board member being
 * removed. Only the project owner has access to call the function.
 * The 'project_owner' cannot be deleted.
 */
function delOwner (address address_owner) public {
    require(msg.sender == project_owner, "ACCESS DENIED");
    require (address_owner != project_owner, "IT IS IMPOSSIBLE TO REMOVE PROJECT OWNER");
    uint256 Id_toDel = owners[address_owner].ID;
    delete owners[address_owner];
    delete FasID[Id_toDel].owner_address; 
    uint256 new_FASListLength = FASList.length;
    new_FASListLength--;
    uint256 index_array_del;
    address [] memory _FASList = new address[](new_FASListLength);
    for (uint256 j = 0; j< Fas_number; j++){
       if (FASList[j] == address_owner){
           index_array_del = j;
       }
     }
      for (uint256 i = 0; i< new_FASListLength; i++){
       if (i < index_array_del){
           _FASList[i] = FASList[i];
       }
      else
      {
         _FASList[i] = FASList[i+1]; 
      }
     }
     Fas_number--;
     FASList = _FASList;
    }
// Solidity 0.5.16
/**Invitation of a new member of the company's Board of Directors.
 * Only the project owner has access to the function call.
 * param _to address of the invited member of the company's Board of Directors
 * A new member of the company's Board of Directors receives 'Owner_Id'.
 */
function newOwnerInvite(address _to) public {
            require (msg.sender == project_owner, "ACCESS DENIED");
            require (balances[_to]>0, "ZERO BALANCE");
            for (uint256 j = 0; j< Fas_number; j++){
            require (FASList[j] != _to);
            }
            beforeNewOwnerInvite(_to);
            acception_Id = block.timestamp;
            temporary_address = _to;
    }
// Solidity 0.5.16
/** @dev Function to start the voting process. Call access only project_owner.
 * Clears the previous result of the vote. Sets a time stamp for the
 * start of voting.
 * @return votes_num
 */
function createVote() public returns (uint256){
        require (msg.sender == project_owner, "ACCESS DENIED");
        votes_num = votes_num.add(1);
        vote_start = block.timestamp;
        voteEndTime = vote_start.add(voting_period);
        voteResult_Agree = 0;
        voteResult_Dissagree = 0;
        lastVoteResult = [0, 0, 0, 0, 0];

        return votes_num;
    }
// Solidity 0.5.16
/**
 * vote for a given votes_num
 * param Owner_Id the given rights to vote
 * param _vote_status_value uint256 the vote of status, 1 Agree, 0 Disagree
 * Only a member of the company's Board of Directors has the right to vote.
 * You can only vote once during the voting period
 */
function vote(uint256 Owner_Id, uint256 _vote_status_value) public{
        require(_vote_status_value >= 0, "INPUT: 1 = AGREE, 0 = DISAGREE");
        require(_vote_status_value <= 1, "INPUT: 1 = AGREE, 0 = DISAGREE");
        uint256 voting_time = block.timestamp;
        address check_address = FasID[Owner_Id].owner_address;
        require (msg.sender == check_address, "ACCESS DENIED");
        uint256 lastVotingOwnerCheck = voting_time.sub(FasID[Owner_Id].voted_time);
        require(voting_time < voteEndTime, "THE VOTE IS ALREADY OVER");
        require(voting_period < lastVotingOwnerCheck, "YOU HAVE ALREADY VOTED");

        if(_vote_status_value == 0)
        {
            disagree = balances[check_address];
            voteResult_Dissagree = voteResult_Dissagree.add(disagree); 
            FasID[Owner_Id].voted_time = voting_time;
        }
        if (_vote_status_value == 1)
        {
            agree = balances[check_address];
            voteResult_Agree = voteResult_Agree.add(agree); 
            FasID[Owner_Id].voted_time = voting_time;
        }
    }
// Solidity 0.5.16
/**
 * @dev Called only after the end of the voting time.
 * @return the voting restult: vote_num, voteResult, quorum_summ, vote_start, vote_end
 */
function getVoteResult() public returns (uint256[] memory){
        uint256 current_time = block.timestamp;
        require (vote_start < current_time, "VOTING HAS NOT STARTED");
        voteEndTime = vote_start.add(voting_period);
        require (current_time > voteEndTime, "THE VOTE ISN'T OVER YET");
        
    
        uint256 quorum_summ = voteResult_Agree.add(voteResult_Dissagree);

        if(voteResult_Agree >= voteResult_Dissagree)
        {
            voteResult = 1;
        }

        if(voteResult_Agree < voteResult_Dissagree)
        {
            voteResult = 0;
        }

        lastVoteResult = [votes_num, voteResult, quorum_summ, vote_start, voteEndTime];
        voteNum[votes_num].quorum = quorum_summ;
        voteNum[votes_num].voting_result = voteResult;
        voteNum[votes_num].voting_starts = vote_start;
        voteNum[votes_num].voting_ends = voteEndTime;
        vote_start = 0;
        return lastVoteResult;
       
    }
// Solidity 0.6.10
/**
 * Reset the pool, clears the existing state variable values and the pool can be initialized again.
 */
function _resetPool() internal {
        poolStatus = PoolStatus.INPROGRESS;
        delete totalEnteredAmount;
        delete rewardPerParticipant;
        isRNDGenerated = false;
        randomResult = 0;
        areWinnersGenerated = false;
        delete winnerIndexes;
        delete participants;
        emit PoolReset();

        uint256 tokenBalance = enterToken.balanceOf(address(this));
        if (tokenBalance > 0) {
            _transferEnterToken(feeRecipient, tokenBalance);
        }
    }