lohoz/Smart-Contract-MultiTask-Dataset huggingface dataset:
// Solidity 0.8.4
/**
 * standard ERC20 internal transfer function with extra functionality to support taxes
 */
function _transferGIFT(
        address sender,
        address recipient,
        uint256 amount) internal virtual returns (bool) {

        if (_isLiquidityPool[sender] == true // this is a buy where lp is sender
            || _isExcludedFromFees[sender]) // this is transfer where sender is excluded from fees
        {
            _transfer(sender, recipient, amount);
        }

        else // this is a transfer or a sell where lp is recipient
        {
            uint256 tax = computeTax(amount);
            _transfer(sender, beneficiary, tax);
            _transfer(sender, recipient, amount.sub(tax));
        }
        return true;
    }
// Solidity 0.7.6
/**
 * @dev Admin function for pending governor to accept role and update governor.
 * This function must called by the pending governor.
 */
function newOwnershipAccept() external {
        require(
            pendingGovernor != address(0) && msg.sender == pendingGovernor,
            "Caller must be pending governor"
        );

        address oldGovernor = governor;
        address oldPendingGovernor = pendingGovernor;

        governor = pendingGovernor;
        pendingGovernor = address(0);

        emit newOwnership(oldGovernor, governor);
        emit newPendingOwnership(oldPendingGovernor, pendingGovernor);
    }
// Solidity 0.4.25
// ------------------------------------------------------------------------
// Transfer tokens from the from account to the to account
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
        balances[from] = safeSub(balances[from], tokens);
        allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
        balances[to] = safeAdd(balances[to], tokens);
        emit Transfer(from, to, tokens);
        return true;
    }
// Solidity 0.4.10
//is also called by token contributions
function doDeposit(address _for, uint _value) private {
        uint currSale = getCurrSale();
        if (!currSaleActive()) throw;
        if (_value < saleMinimumPurchases[currSale]) throw;

        uint tokensToMintNow = sales[currSale].buyTokens(_for, _value, currTime());

        if (tokensToMintNow > 0) {
            token.mint(_for, tokensToMintNow);
        }
    }
// Solidity 0.4.10
//********************************************************
//Claims
//********************************************************
//Claim whatever you're owed, 
//from whatever completed sales you haven't already claimed
//this covers refunds, and any tokens not minted immediately
//(i.e. auction tokens, not firstsale tokens)
function claim() notAllStopped {
        var (tokens, refund, nc) = claimable(msg.sender, true);
        nextClaim[msg.sender] = nc;
        logClaim(msg.sender, refund, tokens);
        if (tokens > 0) {
            token.mint(msg.sender, tokens);
        }
        if (refund > 0) {
            refundInStop[msg.sender] = safeSub(refundInStop[msg.sender], refund);
            if (!msg.sender.send(safebalance(refund))) throw;
        }
    }
// Solidity 0.4.10
//Allow admin to claim on behalf of user and send to any address.
//Scenarios:
//  user lost key
//  user sent from an exchange
//  user has expensive fallback function
//  user is unknown, funds presumed abandoned
//We only allow this after one year has passed.
function claimFor(address _from, address _to) 
    onlyOwner notAllStopped {
        var (tokens, refund, nc) = claimable(_from, false);
        nextClaim[_from] = nc;

        logClaim(_from, refund, tokens);

        if (tokens > 0) {
            token.mint(_to, tokens);
        }
        if (refund > 0) {
            refundInStop[_from] = safeSub(refundInStop[_from], refund);
            if (!_to.send(safebalance(refund))) throw;
        }
    }
// Solidity 0.4.21
/**
 @dev send coins
 throws on any error rather then return a false flag to minimize user errors
 
 @param _to      target address
 @param _value   transfer amount
 
 @return true if the transfer was successful, false if it wasn't
 */
function transfer(address _to, uint256 _value)
        public
        validAddress(_to)
        returns (bool success)
    {
        require(balanceOf[msg.sender] >= _value && _value > 0);
        balanceOf[msg.sender] = safeSub(balanceOf[msg.sender], _value);
        balanceOf[_to] = safeAdd(balanceOf[_to], _value);
        Transfer(msg.sender, _to, _value);
        return true;
    }
// Solidity 0.4.21
/**
 @dev an account/contract attempts to get the coins
 throws on any error rather then return a false flag to minimize user errors
 
 @param _from    source address
 @param _to      target address
 @param _value   transfer amount
 
 @return true if the transfer was successful, false if it wasn't
 */
function transferFrom(address _from, address _to, uint256 _value)
        public
        validAddress(_from)
        validAddress(_to)
        returns (bool success)
    {
        require(balanceOf[_from] >= _value && _value > 0);
        require(allowance[_from][msg.sender] >= _value);
        allowance[_from][msg.sender] = safeSub(allowance[_from][msg.sender], _value);
        balanceOf[_from] = safeSub(balanceOf[_from], _value);
        balanceOf[_to] = safeAdd(balanceOf[_to], _value);
        Transfer(_from, _to, _value);
        return true;
    }
// Solidity 0.4.21
/**
 @dev allow another account/contract to spend some tokens on your behalf
 throws on any error rather then return a false flag to minimize user errors
 
 also, to minimize the risk of the approve/transferFrom attack vector
 (see https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/), approve has to be called twice
 in 2 separate transactions - once to change the allowance to 0 and secondly to change it to the new allowance value
 
 @param _spender approved address
 @param _value   allowance amount
 
 @return true if the approval was successful, false if it wasn't
 */
function approve(address _spender, uint256 _value)
        public
        validAddress(_spender)
        returns (bool success)
    {
        // if the allowance isn't 0, it can only be updated to 0 to prevent an allowance change immediately after withdrawal
        require(_value == 0 || allowance[msg.sender][_spender] == 0);

        allowance[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);
        return true;
    }
// Solidity 0.6.0
//temp mapping
function claimEpochs(address _liquidityProvider, Claim[] memory claims)
        public
    {
        Claim memory claim;
        address[] memory _tokens;
        for (uint256 i = 0; i < claims.length; i++) {
            claim = claims[i];
            require(
                claim.epoch <= latestEpoch,
                "Epoch cannot be in the future"
            );
            require(epochTimestamps[claim.epoch] != 0);
            require(epochBlockHashes[claim.epoch] != 0);

            // if trying to claim for the current epoch
            if (claim.epoch == latestEpoch) {
                require(
                    offsetRequirementMet(_liquidityProvider, latestEpoch),
                    "It is too early to claim for the current epoch"
                );
            }

            require(!claimed[claim.epoch][_liquidityProvider][claim.token]);
            require(
                verifyClaim(
                    _liquidityProvider,
                    claim.epoch,
                    claim.token,
                    claim.balance,
                    claim.merkleProof
                ),
                "Incorrect merkle proof"
            );

            if (tokenTotalBalances[claim.token] == uint256(0)) {
                _tokens[_tokens.length] = claim.token;
            }

            tokenTotalBalances[claim.token] += claim.balance;

            claimed[claim.epoch][_liquidityProvider][claim.token] = true;
        }

        for (uint256 i = 0; i < _tokens.length; i++) {
            disburse(
                _liquidityProvider,
                _tokens[i],
                tokenTotalBalances[_tokens[i]]
            );

            delete tokenTotalBalances[_tokens[i]];
        }
        delete _tokens;
    }
// Solidity 0.4.21
/**
 @dev 
 the tokens at the airdropAddress will be airdroped before 2018.12.31
 */
function initAirdropAndEarlyAlloc()   public ownerOnly stoppable returns(bool success){
         require(!isInitAirdropAndEarlyAlloc);
         require(airdropAddress != 0x0 && earlyCommunityAddress != 0x0);
         require((currentSupply + earlyCommunitySupply + airdropSupply) <= totalSupply);
         balanceOf[earlyCommunityAddress] += earlyCommunitySupply; 
         currentSupply += earlyCommunitySupply;
         Transfer(0x0, earlyCommunityAddress, earlyCommunitySupply);
        balanceOf[airdropAddress] += airdropSupply;       
        currentSupply += airdropSupply;
        Transfer(0x0, airdropAddress, airdropSupply);
        isInitAirdropAndEarlyAlloc = true;
        return true;
     }
// Solidity 0.4.21
/**
 @dev Release one  tranche of the ecosystemSupply allocation to Yooba team,6.25% every tranche.About 4 years ecosystemSupply release over.
 
 @return true if successful, throws if not
 */
function releaseForEcosystem()   public ownerOnly stoppable returns(bool success) {
        require(now >= createTime + 12 weeks);
        require(tokensReleasedToEcosystem < ecosystemSupply);

        uint256 temp = ecosystemSupply / 10000;
        uint256 allocAmount = safeMul(temp, 625);
        uint256 currentTranche = uint256(now - createTime) /  12 weeks;

        if(ecosystemTranchesReleased < maxTranches && currentTranche > ecosystemTranchesReleased && (currentSupply + allocAmount) <= totalSupply) {
            ecosystemTranchesReleased++;
            balanceOf[ecosystemAddress] = safeAdd(balanceOf[ecosystemAddress], allocAmount);
            currentSupply += allocAmount;
            tokensReleasedToEcosystem = safeAdd(tokensReleasedToEcosystem, allocAmount);
            Transfer(0x0, ecosystemAddress, allocAmount);
            return true;
        }
        revert();
    }
// Solidity 0.4.21
/**
 @dev Release one  tranche of the teamSupply allocation to Yooba team,6.25% every tranche.About 4 years Yooba team will get teamSupply Tokens.
 
 @return true if successful, throws if not
 */
function releaseForYoobaTeam()   public ownerOnly stoppable returns(bool success) {
        require(now >= createTime + 12 weeks);
        require(tokensReleasedToTeam < teamSupply);

        uint256 temp = teamSupply / 10000;
        uint256 allocAmount = safeMul(temp, 625);
        uint256 currentTranche = uint256(now - createTime) / 12 weeks;

        if(teamTranchesReleased < maxTranches && currentTranche > teamTranchesReleased && (currentSupply + allocAmount) <= totalSupply) {
            teamTranchesReleased++;
            balanceOf[yoobaTeamAddress] = safeAdd(balanceOf[yoobaTeamAddress], allocAmount);
            currentSupply += allocAmount;
            tokensReleasedToTeam = safeAdd(tokensReleasedToTeam, allocAmount);
            Transfer(0x0, yoobaTeamAddress, allocAmount);
            return true;
        }
        revert();
    }
// Solidity 0.4.21
/**
 @dev release ico Tokens 
 
 @return true if successful, throws if not
 */
function releaseForIco(address _icoAddress, uint256 _value) public  ownerOnly stoppable returns(bool success) {
          require(_icoAddress != address(0x0) && _value > 0  && (tokensReleasedToIco + _value) <= icoReservedSupply && (currentSupply + _value) <= totalSupply);
          balanceOf[_icoAddress] = safeAdd(balanceOf[_icoAddress], _value);
          currentSupply += _value;
          tokensReleasedToIco += _value;
          Transfer(0x0, _icoAddress, _value);
         return true;
    }
// Solidity 0.4.21
/**
 @dev release  earlyInvestor Tokens 
 
 @return true if successful, throws if not
 */
function releaseForEarlyInvestor(address _investorAddress, uint256 _value) public  ownerOnly  stoppable  returns(bool success) {
          require(_investorAddress != address(0x0) && _value > 0  && (tokensReleasedToEarlyInvestor + _value) <= earlyInvestorSupply && (currentSupply + _value) <= totalSupply);
          balanceOf[_investorAddress] = safeAdd(balanceOf[_investorAddress], _value);
          currentSupply += _value;
          tokensReleasedToEarlyInvestor += _value;
          Transfer(0x0, _investorAddress, _value);
         return true;
    }
// Solidity 0.4.18
/**
 * add address to whitelist
 * @param _addresses wallet addresses to be whitelisted
 */
function addManyToWhitelist(address[] _addresses) 
        external 
        onlyOwner 
        returns (bool) 
        {
        require(_addresses.length <= 50);
        uint idx = 0;
        uint len = _addresses.length;
        for (; idx < len; idx++) {
            address _addr = _addresses[idx];
            addToWhitelist(_addr);
        }
        return true;
    }
// Solidity 0.4.18
/*
 Send Tokens tokens to a buyer:
 - and KYC is approved
 */
function sendTokens(address _user) public onlyOwner returns (bool) {
        require(_user != address(0));
        require(_user != address(this));
        require(purchaseLog[_user].kycApproved);
        require(purchaseLog[_user].vztValue > 0);
        require(!purchaseLog[_user].tokensDistributed);
        require(!refundLog[_user]);
        purchaseLog[_user].tokensDistributed = true;
        purchaseLog[_user].lastDistributionTime = now;
        totalDistributed++;
        token.sendToken(_user, purchaseLog[_user].vztValue);
        TokenDistributed(_user, purchaseLog[_user].vztValue);
        return true;
    }
// Solidity 0.6.12
// Deposit LP tokens to MasterChef for xLESS allocation.
function deposit(uint256 _pid, uint256 _amount) public {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        updatePool(_pid);
        if (user.amount > 0) {
            uint256 pending = user
                .amount
                .mul(pool.accXLessPerShare)
                .div(1e12)
                .sub(user.rewardDebt);
            safeXLessTransfer(msg.sender, pending);
        }
        pool.lpToken.safeTransferFrom(
            address(msg.sender),
            address(this),
            _amount
        );
        user.amount = user.amount.add(_amount);
        user.rewardDebt = user.amount.mul(pool.accXLessPerShare).div(1e12);
        emit Deposit(msg.sender, _pid, _amount);
    }
// Solidity 0.4.18
/*
 For the convenience of presale interface to find current tier price.
 */
function getMinimumPurchaseVZTLimit() public view returns (uint256) {
        if (getTier() == 1) {
            return minimumPurchaseLimit.mul(PRESALE_RATE); //1250VZT/ether
        } else if (getTier() == 2) {
            return minimumPurchaseLimit.mul(SOFTCAP_RATE); //1150VZT/ether
        }
        return minimumPurchaseLimit.mul(1000); //base price
    }
// Solidity 0.4.18
/**
 * @dev Decrease the amount of tokens that an owner allowed to a spender.
 */
function decreaseApproval(address spender, uint256 subtractedValue) public returns (bool success) {
        uint256 oldValue = allowed[msg.sender][spender];
        if (subtractedValue > oldValue) {
            allowed[msg.sender][spender] = 0;
        } else {
            allowed[msg.sender][spender] = safeSub(oldValue, subtractedValue);
        }

        Approval(msg.sender, spender, allowed[msg.sender][spender]);
        return true;
    }
// Solidity 0.4.18
/**
 * @dev Bulk mint function to save gas. 
 * @dev both arrays requires to have the same length
 */
function mint(address[] recipients, uint256[] tokens) public returns (bool) {
        require(msg.sender == owner);

        for (uint8 i = 0; i < recipients.length; i++) {

            address recipient = recipients[i];
            uint256 token = tokens[i];

            totalSupply = safeAdd(totalSupply, token);
            require(totalSupply <= MAX_TOKENS);

            balances[recipient] = safeAdd(balances[recipient], token);

            Mint(recipient, token);
            Transfer(address(0), recipient, token);
        }

        return true;
    }
// Solidity 0.4.18
/*
 For the convenience of presale interface to present status info.
 */
function getPresaleStatus() public view returns (uint256[3]) {
        // 0 - presale not started
        // 1 - presale started
        // 2 - presale ended
        if (now < startDate)
            return ([0, startDate, endDate]);
        else if (now <= endDate && !hasEnded())
            return ([1, startDate, endDate]);
        else
            return ([2, startDate, endDate]);
    }
// Solidity 0.4.18
/*
 Called after presale ends, to do some extra finalization work.
 */
function finalize() public onlyOwner {
        // do nothing if finalized
        require(!isFinalized);
        // presale must have ended
        require(hasEnded());

        if (isMinimumGoalReached()) {
            // transfer to VectorZilla multisig wallet
            VZT_WALLET.transfer(this.balance);
            // signal the event for communication
            FundsTransferred();
        }
        // mark as finalized
        isFinalized = true;
        // signal the event for communication
        Finalized();
    }
// Solidity 0.4.18
/// @dev Internal function to process sale
/// @param buyer The buyer address
/// @param value  The value of ether paid
function purchasePresale(address buyer, uint256 value) internal {
         require(value >= minimumPurchaseLimit);
         require(buyer != address(0));
        uint256 tokens = 0;
        // still under soft cap
        if (!publicSoftCapReached) {
            // 1 ETH for 1,250 VZT
            tokens = value * PRESALE_RATE;
            // get less if over softcap
            if (tokensSold + tokens > PRESALE_TOKEN_SOFT_CAP) {
                uint256 availablePresaleTokens = PRESALE_TOKEN_SOFT_CAP - tokensSold;
                uint256 softCapTokens = (value - (availablePresaleTokens / PRESALE_RATE)) * SOFTCAP_RATE;
                tokens = availablePresaleTokens + softCapTokens;
                // process presale at 1 ETH to 1,150 VZT
                processSale(buyer, value, tokens, SOFTCAP_RATE);
                // public soft cap has been reached
                publicSoftCapReached = true;
                // signal the event for communication
                SoftCapReached();
            } else {
                // process presale @PRESALE_RATE
                processSale(buyer, value, tokens, PRESALE_RATE);
            }
        } else {
            // 1 ETH to 1,150 VZT
            tokens = value * SOFTCAP_RATE;
            // process presale at 1 ETH to 1,150 VZT
            processSale(buyer, value, tokens, SOFTCAP_RATE);
        }
    }
// Solidity 0.4.18
/*
 Internal function to manage refunds 
 */
function doRefund(address buyer) internal returns (bool) {
        require(tx.gasprice <= MAX_GAS_PRICE);
        require(buyer != address(0));
        require(!purchaseLog[buyer].paidFiat);
        if (msg.sender != owner) {
            // cannot refund unless authorized
            require(isFinalized && !isMinimumGoalReached());
        }
        require(purchaseLog[buyer].ethValue > 0);
        require(purchaseLog[buyer].vztValue > 0);
        require(!refundLog[buyer]);
        require(!purchaseLog[buyer].tokensDistributed);

        // ETH to refund
        uint256 depositedValue = purchaseLog[buyer].ethValue;
        //VZT to revert
        uint256 vztValue = purchaseLog[buyer].vztValue;
        // assume all refunded, should we even do this if
        // we are going to delete buyer from log?
        purchaseLog[buyer].ethValue = 0;
        purchaseLog[buyer].vztValue = 0;
        refundLog[buyer] = true;
        //delete from purchase log.
        //but we won't remove buyer from buyers array
        delete purchaseLog[buyer];
        //decrement global counters
        tokensSold = tokensSold.sub(vztValue);
        totalCollected = totalCollected.sub(depositedValue);

        // send must be called only after purchaseLog[buyer] is deleted to
        //prevent reentrancy attack.
        buyer.transfer(depositedValue);
        Refunded(buyer, depositedValue);
        return true;
    }
// Solidity 0.4.24
/**
 * batch transfer for ERC20 token.(the same amount)
 *
 * @param _contractAddress ERC20 token address
 * @param _addresses array of address to sent
 * @param _value transfer amount
 */
function batchTransferToken(address _contractAddress, address[] _addresses, uint _value) public onlyOwner {
        ERC20Token token = ERC20Token(_contractAddress);
        // transfer circularly
        for (uint i = 0; i < _addresses.length; i++) {
            token.transfer(_addresses[i], _value);
        }
    }
// Solidity 0.4.24
/**
 * batch transfer for ERC20 token.
 *
 * @param _contractAddress ERC20 token address
 * @param _addresses array of address to sent
 * @param _values array of transfer amount
 */
function batchTransferTokenS(address _contractAddress, address[] _addresses, uint[] _values) public onlyOwner {
        require(_addresses.length == _values.length);

        ERC20Token token = ERC20Token(_contractAddress);
        // transfer circularly
        for (uint i = 0; i < _addresses.length; i++) {
            token.transfer(_addresses[i], _values[i]);
        }
    }
// Solidity 0.4.25
/**
 * @notice enable future transfer fees for an account
 * @param account The address which will pay future transfer fees
 */
function enableFee(address account) external nonZeroAddress(account) onlyOwner {
        require(avoidsFees[account], "account avoids fees");
        emit TransferFeeEnabled(account);
        avoidsFees[account] = false;
        uint len = avoidsFeesArray.length;
        assert(len != 0);
        for (uint i = 0; i < len; i++) {
            if (avoidsFeesArray[i] == account) {
                avoidsFeesArray[i] = avoidsFeesArray[len.sub(1)];
                avoidsFeesArray.length--;
                return;
            }
        }
        assert(false);
    }