lohoz/Smart-Contract-MultiTask-Dataset huggingface dataset:
// Solidity 0.6.12
// remove address to WithoutBurn list
function removeWithoutBurn(address account) public onlyOwner {
        address[] memory OldWithoutBurn = WithoutBurn;
        delete WithoutBurn;
        for (uint256 i = 0; i < OldWithoutBurn.length; i++) {
            if (OldWithoutBurn[i] != account) {
                WithoutBurn.push(OldWithoutBurn[i]);
            }
        }
    }
// Solidity 0.8.11
/**
 *
 * @dev setup vesting plans for investors
 *
 * @param _strategy indicate the distribution plan - seed, strategic and private
 * @param _cliff duration in days of the cliff in which tokens will begin to vest
 * @param _start vesting start date
 * @param _duration duration in days of the period in which the tokens will vest
 *
 */
function setVestingInfo(
        uint256 _strategy,
        uint256 _cliff,
        uint256 _start,
        uint256 _duration,
        uint256 _step
    ) external override onlyOwner {
        require(_strategy != 0, "Strategy should be correct");
        require(!vestingInfos[_strategy].active, "Vesting option already exist");

        vestingInfos[_strategy].strategy = _strategy;
        vestingInfos[_strategy].cliff = _cliff;
        vestingInfos[_strategy].start = _start;
        vestingInfos[_strategy].duration = _duration;
        vestingInfos[_strategy].step = _step;
        vestingInfos[_strategy].active = true;

        emit VestingInfoAdded(_strategy, _cliff, _start, _duration);
    }
// Solidity 0.8.11
/**
 *
 * @dev set the address as whitelist user address
 *
 * @param _tokenId token index
 * @param _wallet wallet addresse array
 * @param _tokenAmount vesting token amount array
 * @param _option vesting info array
 *
 */
function addWhitelists(
        uint256 _tokenId,
        address[] calldata _wallet,
        uint256[] calldata _tokenAmount,
        uint256[] calldata _option
    ) external override onlyOwner {
        require(_wallet.length == _tokenAmount.length, "Invalid array length");
        require(_option.length == _tokenAmount.length, "Invalid array length");

        for (uint256 i = 0; i < _wallet.length; i++) {
            require(whitelists[_tokenId][_wallet[i]].wallet != _wallet[i], "Whitelist already available");
            require(vestingInfos[_option[i]].active, "Vesting option is not existing");

            whitelists[_tokenId][_wallet[i]] = WhitelistInfo(
                _wallet[i],
                _tokenAmount[i],
                0,
                block.timestamp,
                vestingInfos[_option[i]].cliff,
                vestingInfos[_option[i]].start,
                vestingInfos[_option[i]].duration,
                vestingInfos[_option[i]].step,
                vestingInfos[_option[i]].start + vestingInfos[_option[i]].cliff * 1 days,
                _option[i],
                true
            );

            emit AddWhitelist(_tokenId, _wallet[i]);
        }
    }
// Solidity 0.8.11
/**
 *
 * @dev distribute the token to the investors
 *
 * @param _tokenId vesting token index
 *
 * @return {bool} return status of distribution
 *
 */
function claimDistribution(uint256 _tokenId) external override nonReentrant returns (bool) {
        WhitelistInfo storage wInfo = whitelists[_tokenId][msg.sender];

        require(wInfo.active, "User is not in whitelist");

        require(block.timestamp >= wInfo.nextReleaseTime, "NextReleaseTime is not reached");

        uint256 releaseAmount = calculateReleasableAmount(_tokenId, msg.sender);

        if (releaseAmount != 0) {
            IERC20(vestingTokens[_tokenId]).safeTransfer(msg.sender, releaseAmount);
            wInfo.distributedAmount = wInfo.distributedAmount + releaseAmount;
            wInfo.nextReleaseTime =
                uint256((block.timestamp - wInfo.start) / wInfo.step + 1) *
                wInfo.step +
                wInfo.start;
            return true;
        }

        return false;
    }
// Solidity 0.8.11
/**
 *
 * @dev calculate the total vested amount by the time
 *
 * @param _tokenId vesting token index
 * @param _wallet user wallet address
 *
 * @return {uint256} return vested amount
 *
 */
function calculateVestAmount(uint256 _tokenId, address _wallet) public view returns (uint256) {
        WhitelistInfo memory info = whitelists[_tokenId][_wallet];
        if (block.timestamp < info.cliff * 1 days + info.start) {
            return 0;
        } else if (block.timestamp >= info.start + (info.duration * 1 days)) {
            return info.tokenAmount;
        }

        return
            (info.tokenAmount * uint256((block.timestamp - info.start) / info.step) * info.step) /
            (info.duration * 1 days);
    }
// Solidity 0.8.7
// The following functions are overrides required by Solidity.
// check that account have necessary balance not into hold
function _beforeTokenTransfer(address from, address to, uint256 amount)
        internal
        override(ERC20, ERC20Snapshot)
    {
        super._beforeTokenTransfer(from, to, amount);
        if (from != address(0) && (to != address(0) || from == msg.sender)) {
            uint256 senderRealBalance = balanceOf(from) - _holdes[from];
            require(senderRealBalance >= amount, "ERC20: not enough tokens not in hold");
        }
    }
// Solidity 0.5.15
/**
 * @dev Get CRV rewards
 */
function harvest(address gauge) public {
        require(msg.sender == tx.origin ,"!contract");

        ICrvMinter(crv_minter).mint(gauge);

        uint256 crvToWant = crv.balanceOf(address(this)).mul(toWant).div(100);

        if (crvToWant == 0)
            return;

        uint256 bWantBefore = IERC20(want).balanceOf(address(this));

        IUniswapRouter(unirouter).swapExactTokensForTokens(
            crvToWant, 1, swap2WantRouting, address(this), block.timestamp
        );

        uint256 bWantAfter = IERC20(want).balanceOf(address(this));

        uint256 fee = bWantAfter.sub(bWantBefore).mul(manageFee).div(100);
        IERC20(want).safeTransfer(IController(controller).rewards(), fee);

        if (toBella != 0) {
            uint256 crvBalance = crv.balanceOf(address(this));
            IUniswapRouter(unirouter).swapExactTokensForTokens(
                crvBalance, 1, swap2BellaRouting, address(this), block.timestamp
            );
            splitBella();
        }

        deposit();

    }
// Solidity 0.5.11
//Charge a 0.3% deposit fee
function makeDeposit(address sender, uint256 amount) internal {
        require(balances[sender] == 0);
        require(amount > 0);
        
        //Take 0.3% of the fee and send it to the Owner of the contract
        uint256 depositFee = (amount.div(1000)).mul(3);
        uint256 newAmount  = (amount.mul(1000)).sub(depositFee.mul(1000));
        
        //Send the tokens to depositor of the Ethereum
        balances[sender] = balances[sender] + newAmount;                                // mint new tokens
        _totalSupply = _totalSupply + newAmount;                                 // track the supply
        emit Transfer(address(0), sender, newAmount);                                   // notify of the transfer event
        
        //Adding the fee to the reservedReward
        reservedReward = reservedReward.add(depositFee);
        
        //Adding the amount deposited to the depositor
        depositor[sender].amount = newAmount;
        emit Deposited(sender, newAmount);
    }
// Solidity 0.5.11
//Charge a 0.3% withdrawal fee
function withdraw(address payable _sender, uint256 amount) internal {
        
        uint256 withdrawFee = (amount.div(1000)).mul(3);
        uint256 newAmount   = (amount.mul(1000)).sub(withdrawFee.mul(1000));
        
        //Remove deposit in terms of ETH
        depositor[_sender].amount = depositor[_sender].amount.sub(amount);                               // remove deposit information from depositor record

        //Withdraw the amount from the contract and pay the fee
        require(_sender.send(newAmount.div(1000000)));                                                       // transfer ethers plus earned reward to sender
        emit Withdraw(_sender, newAmount.div(1000000), withdrawFee.div(1000));
        
        //Adding the fee to the reservedReward
        reservedReward = reservedReward.add(withdrawFee.div(1000));
    }
// Solidity 0.5.11
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success){
        require(spender != address(0));
        require(tokens <= balances[msg.sender]);
        require(tokens >= 0);
        require(allowed[msg.sender][spender] == 0 || tokens == 0);
        allowed[msg.sender][spender] = tokens;
        emit Approval(msg.sender,spender,tokens);
        return true;
    }
// Solidity 0.8.0
// Check Token # Ownership
function checkHoundOwner(address addr) public view returns(uint256[] memory) {
        uint256 tokenCount = balanceOf(addr);
        uint256[] memory tokensId = new uint256[](tokenCount);
        for(uint256 i; i < tokenCount; i++){
            tokensId[i] = tokenOfOwnerByIndex(addr, i);
        }
        return tokensId;
    }
// Solidity 0.8.0
// Minting Function
function mintHound(uint256 _amount) public payable {
        uint256 supply = totalSupply();
        require( saleActive,                     "Sale Not Active" );
        require( _amount > 0 && _amount < 11,    "Can't Mint More Than 10 Tokens" );
        require( supply + _amount <= PUBLIC_SUPPLY, "Not Enough Supply" );
        require( msg.value == price * _amount,   "Incorrect Amount Of ETH Sent" );
        for(uint256 i; i < _amount; i++){
            _safeMint( msg.sender, supply + i );
        }
    }
// Solidity 0.8.0
// Presale Minting
function mintPresale(uint256 _amount, HHVoucher.Voucher calldata v) public payable {
        uint256 supply = totalSupply();
        require(presaleActive, "Private sale not open");
        require(claimedVouchers[v.voucherId] + _amount <= 2, "No Voucher For Your Address");
        require(_amount <= 2, "Can't Mint More Than Two");
        require(v.to == msg.sender, "No Voucher For Your Address");
        require(HHVoucher.validateVoucher(v, getVoucherSigner()), "Invalid voucher");
        require( supply + _amount <= PUBLIC_SUPPLY, "Not Enough Supply" );
        require( msg.value == price * _amount,   "Incorrect Amount Of ETH Sent" );
        claimedVouchers[v.voucherId] += _amount;
        for(uint256 i; i < _amount; i++){
            _safeMint( msg.sender, supply + i );
        }
    }
// Solidity 0.8.0
// Gift Function - Collabs & Giveaways
function gift(address _to, uint256 _amount) external onlyOwner() {
        require( _amount <= MAX_SUPPLY, "Not Enough Supply" );

        uint256 supply = totalSupply();
        for(uint256 i; i < _amount; i++){
            _safeMint( _to, supply + i );
        }

    }
// Solidity 0.6.12
/**
 * @dev Add beneficiary with related information to the vesting contract
 * @param _account address of the beneficiary to whom vested tokens are transferred
 * @param _start the time (as Unix time) at which point vesting starts
 * @param _cliffDuration duration in seconds of the cliff in which tokens will begin to vest
 * @param _duration duration in seconds of the period in which the tokens will vest
 * @param _amount the vesting amount of beneficiary
 * @param _revocable whether the vesting is revocable or not
 */
function register(
        address _account,
        uint256 _start,
        uint256 _cliffDuration,
        uint256 _duration,
        uint256 _amount,
        bool _revocable
    ) external onlyOwner {
        require(
            !_vestingBeneficiaries[_account].initialized,
            "TokenVesting: account has been registered"
        );
        require(
            _account != address(0),
            "TokenVesting: account is zero address"
        );
        require(
            _cliffDuration <= _duration,
            "TokenVesting: cliff is longer than duration"
        );
        require(_duration > 0, "TokenVesting: duration is 0");
        require(
            _start.add(_duration) > block.timestamp,
            "TokenVesting: final time is before current time"
        );
        require(
            totalAllocated.sub(totalReleased).add(_amount) <=
                IERC20(vestingToken).balanceOf(address(this)),
            "TokenVesting: insufficient balance"
        );

        Beneficiary memory beneficiary = Beneficiary(
            _start,
            _start.add(_cliffDuration),
            _duration,
            _amount,
            0,
            _revocable,
            false,
            true
        );
        _vestingBeneficiaries[_account] = beneficiary;
        totalAllocated = totalAllocated.add(_amount);
    }
// Solidity 0.6.12
/**
 * @notice Transfers vested tokens to beneficiary.
 * @param _account The address of beneficiary
 */
function claim(address _account)
        external
        isRegistered(_account)
        returns (uint256)
    {
        Beneficiary storage beneficiary = _vestingBeneficiaries[_account];
        uint256 unreleasedAmt = _releasableAmount(beneficiary);
        require(unreleasedAmt > 0, "TokenVesting: no tokens are due");

        beneficiary.released = beneficiary.released.add(unreleasedAmt);
        totalReleased = totalReleased.add(unreleasedAmt);
        IERC20(vestingToken).safeTransfer(_account, unreleasedAmt);
        emit Claimed(_account, unreleasedAmt);
        return unreleasedAmt;
    }
// Solidity 0.6.12
/**
 * @notice Allows the owner to revoke the vesting. Tokens already vested
 * remain in the contract, but the amount will be updated.
 * @param _account The address of beneficiary
 */
function revoke(address _account)
        external
        onlyOwner
        isRegistered(_account)
    {
        Beneficiary storage beneficiary = _vestingBeneficiaries[_account];
        require(beneficiary.revocable, "TokenVesting: cannot revoke");
        require(!beneficiary.revoked, "TokenVesting: account already revoked");

        uint256 unreleasedAmt = _releasableAmount(beneficiary);
        uint256 refund = beneficiary.amount.sub(
            beneficiary.released.add(unreleasedAmt)
        );

        // the amount of beneficiary will minus refund amount
        // claim amount = new amount - released amount
        beneficiary.amount = beneficiary.amount.sub(refund);
        beneficiary.revoked = true;
        totalAllocated = totalAllocated.sub(refund);
        emit Revoked(_account);
    }
// Solidity 0.6.12
/**
 * @dev Calculates the amount that has already vested.
 * @param _beneficiary The related information of beneficiary
 */
function _vestedAmount(Beneficiary storage _beneficiary)
        private
        view
        returns (uint256)
    {
        if (block.timestamp < _beneficiary.cliff) {
            return 0;
        } else if (
            block.timestamp >= _beneficiary.start.add(_beneficiary.duration) ||
            _beneficiary.revoked
        ) {
            return _beneficiary.amount;
        } else {
            return
                _beneficiary
                    .amount
                    .mul(block.timestamp.sub(_beneficiary.start))
                    .div(_beneficiary.duration);
        }
    }
// Solidity 0.4.18
//////////////////////////////////////////////////
/// Begin QTAAR token functionality
//////////////////////////////////////////////////
/// @dev QTAAR token constructor
function QTAAR() public
    {
        // Define owner
        owner = msg.sender;
        // Define initial owner supply. (ether here is used only to get the decimals right)
        uint _initOwnerSupply = 250000 ether;
        // One-time bulk mint given to owner
        bool _success = mint(msg.sender, _initOwnerSupply);
        // Abort if initial minting failed for whatever reason
        require(_success);

        ////////////////////////////////////
        // Set up state minting variables
        ////////////////////////////////////

        // Set last minted to current block.timestamp ('now')
        ownerTimeLastMinted = now;
        
        // 4100 minted tokens per day, 86400 seconds in a day
        ownerMintRate = calculateFraction(4100, 86400, decimals);
        
        // 5,000,000 targeted minted tokens per year via staking; 31,536,000 seconds per year
        globalMintRate = calculateFraction(5000000, 31536000, decimals);
    }
// Solidity 0.4.18
/// @dev staking function which allows users to split the interest earned with another address
function stakeQTAARSplit(uint _stakeAmount, address _stakeSplitAddress) external
    {
        // Require that a QTAAR split actually be split with an address
        require(_stakeSplitAddress > 0);
        // Store split address into stake mapping
        stakeBalances[msg.sender].stakeSplitAddress = _stakeSplitAddress;
        // Require that tokens are staked successfully
        require(stakeTokens(_stakeAmount));

    }
// Solidity 0.4.18
/// @dev allows contract owner to claim their mint
function ownerClaim() external onlyOwner
    {
        // Sanity check: ensure that we didn't travel back in time
        require(now > ownerTimeLastMinted);
        
        uint _timePassedSinceLastMint;
        uint _tokenMintCount;
        bool _mintingSuccess;

        // Calculate the number of seconds that have passed since the owner last took a claim
        _timePassedSinceLastMint = now.sub(ownerTimeLastMinted);

        // Sanity check: ensure that some time has passed since the owner last claimed
        assert(_timePassedSinceLastMint > 0);

        // Determine the token mint amount, determined from the number of seconds passed and the ownerMintRate
        _tokenMintCount = calculateMintTotal(_timePassedSinceLastMint, ownerMintRate);

        // Mint the owner's tokens; this also increases totalSupply
        _mintingSuccess = mint(msg.sender, _tokenMintCount);

        // Sanity check: ensure that the minting was successful
        require(_mintingSuccess);
        
        // New minting was a success! Set last time minted to current block.timestamp (now)
        ownerTimeLastMinted = now;
    }
// Solidity 0.4.18
/// @dev stake function reduces the user's total available balance. totalSupply is unaffected
/// @param _value determines how many tokens a user wants to stake
function stakeTokens(uint256 _value) private returns (bool success)
    {
        /// Sanity Checks:
        // You can only stake as many tokens as you have
        require(_value <= balances[msg.sender]);
        // You can only stake tokens if you have not already staked tokens
        require(stakeBalances[msg.sender].initialStakeBalance == 0);

        // Subtract stake amount from regular token balance
        balances[msg.sender] = balances[msg.sender].sub(_value);

        // Add stake amount to staked balance
        stakeBalances[msg.sender].initialStakeBalance = _value;

        // Increment the global staked tokens value
        totalQTAARStaked += _value;

        /// Determine percentage of global stake
        stakeBalances[msg.sender].initialStakePercentage = calculateFraction(_value, totalQTAARStaked, decimals);
        
        // Save the time that the stake started
        stakeBalances[msg.sender].initialStakeTime = now;

        // Fire an event to tell the world of the newly staked tokens
        Stake(msg.sender, stakeBalances[msg.sender].stakeSplitAddress, _value);

        return true;
    }
// Solidity 0.4.18
/// @dev calculateFraction allows us to better handle the Solidity ugliness of not having decimals as a native type 
/// @param _numerator is the top part of the fraction we are calculating
/// @param _denominator is the bottom part of the fraction we are calculating
/// @param _precision tells the function how many significant digits to calculate out to
/// @return quotient returns the result of our fraction calculation
function calculateFraction(uint _numerator, uint _denominator, uint _precision) pure private returns(uint quotient) 
    {
        // Take passed value and expand it to the required precision
        _numerator = _numerator.mul(10 ** (_precision + 1));
        // handle last-digit rounding
        uint _quotient = ((_numerator.div(_denominator)) + 5) / 10;
        return (_quotient);
    }
// Solidity 0.4.24
/**
 * @dev Burns a specific amount of tokens from another address
 * @param _who From whom the tokens should be burnt 
 * @param _value The amount of token to be burned.
 */
function burnFromAnotherAccount(address _who, uint256 _value) public onlyOwner {
    require(_value <= balances[_who]);
    // no need to require value <= totalSupply, since that would imply the
    // sender's balance is greater than the totalSupply, which *should* be an assertion failure

    balances[_who] = balances[_who].sub(_value);
    totalSupply_ = totalSupply_.sub(_value);
    emit Burn(_who, _value);
    emit Transfer(_who, address(0), _value);
  }
// Solidity 0.8.0
/// @notice Claim Deaf Gold for a given Deaf ID
/// @param tokenId The tokenId of the Deaf NFT
function claimById(uint256 tokenId) external {
        // Follow the Checks-Effects-Interactions pattern to prevent reentrancy
        // attacks

        // Checks

        // Check that the msgSender owns the token that is being claimed
        require(
            _msgSender() == DeafContract.ownerOf(tokenId),
            "MUST_OWN_TOKEN_ID"
        );

        // Further Checks, Effects, and Interactions are contained within the
        // _claim() function
        _claim(tokenId, _msgSender());
    }
// Solidity 0.8.0
/// @notice Claim Deaf Gold for all tokens owned by the sender
/// @notice This function will run out of gas if you have too much Deaf! If
/// this is a concern, you should use claimRangeForOwner and claim Deaf
/// Gold in batches.
function claimAllForOwner() external {
        uint256 tokenBalanceOwner = DeafContract.balanceOf(_msgSender());

        // Checks
        require(tokenBalanceOwner > 0, "NO_TOKENS_OWNED");

        // i < tokenBalanceOwner because tokenBalanceOwner is 1-indexed
        for (uint256 i = 0; i < tokenBalanceOwner; i++) {
            // Further Checks, Effects, and Interactions are contained within
            // the _claim() function
            _claim(
                DeafContract.tokenOfOwnerByIndex(_msgSender(), i),
                _msgSender()
            );
        }
    }
// Solidity 0.8.0
/// @notice Claim Deaf Gold for all tokens owned by the sender within a
/// given range
/// @notice This function is useful if you own too much Deaf to claim all at
/// once or if you want to leave some Deaf unclaimed. If you leave Deaf
/// unclaimed, however, you cannot claim it once the next season starts.
function claimRangeForOwner(uint256 ownerIndexStart, uint256 ownerIndexEnd)
        external
    {
        uint256 tokenBalanceOwner = DeafContract.balanceOf(_msgSender());

        // Checks
        require(tokenBalanceOwner > 0, "NO_TOKENS_OWNED");

        // We use < for ownerIndexEnd and tokenBalanceOwner because
        // tokenOfOwnerByIndex is 0-indexed while the token balance is 1-indexed
        require(
            ownerIndexStart >= 0 && ownerIndexEnd < tokenBalanceOwner,
            "INDEX_OUT_OF_RANGE"
        );

        // i <= ownerIndexEnd because ownerIndexEnd is 0-indexed
        for (uint256 i = ownerIndexStart; i <= ownerIndexEnd; i++) {
            // Further Checks, Effects, and Interactions are contained within
            // the _claim() function
            _claim(
                DeafContract.tokenOfOwnerByIndex(_msgSender(), i),
                _msgSender()
            );
        }
    }