lohoz/Smart-Contract-MultiTask-Dataset huggingface dataset:
// Solidity 0.5.9
/// @notice Burn token`id` from `from`.
/// @param from address whose token is to be burnt.
/// @param id token which will be burnt.
function burnFrom(address from, uint256 id) external {
        require(from != address(0), "Invalid sender address");
        (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);
        require(
            msg.sender == from ||
            _metaTransactionContracts[msg.sender] ||
            (operatorEnabled && _operators[id] == msg.sender) ||
            _superOperators[msg.sender] ||
            _operatorsForAll[from][msg.sender],
            "not authorized to burn"
        );
        _burn(from, owner, id);
    }
// Solidity 0.6.12
//deposit a curve token
function deposit(uint256 _amount, address _to) external nonReentrant {
        require(!isShutdown, "shutdown");

        //dont need to call checkpoint since _mint() will

        if (_amount > 0) {
            _mint(_to, _amount);
            IERC20(curveToken).safeTransferFrom(msg.sender, address(this), _amount);
            IConvexDeposits(convexBooster).deposit(convexPoolId, _amount, true);
        }

        emit Deposited(msg.sender, _to, _amount, true);
    }
// Solidity 0.6.12
//stake a convex token
function stake(uint256 _amount, address _to) external nonReentrant {
        require(!isShutdown, "shutdown");

        //dont need to call checkpoint since _mint() will

        if (_amount > 0) {
            _mint(_to, _amount);
            IERC20(convexToken).safeTransferFrom(msg.sender, address(this), _amount);
            IRewardStaking(convexPool).stake(_amount);
        }

        emit Deposited(msg.sender, _to, _amount, false);
    }
// Solidity 0.6.12
//withdraw to convex deposit token
function withdraw(uint256 _amount) external nonReentrant {

        //dont need to call checkpoint since _burn() will

        if (_amount > 0) {
            _burn(msg.sender, _amount);
            IRewardStaking(convexPool).withdraw(_amount, false);
            IERC20(convexToken).safeTransfer(msg.sender, _amount);
        }

        emit Withdrawn(msg.sender, _amount, false);
    }
// Solidity 0.6.12
//withdraw to underlying curve lp token
function withdrawAndUnwrap(uint256 _amount) external nonReentrant {
        
        //dont need to call checkpoint since _burn() will

        if (_amount > 0) {
            _burn(msg.sender, _amount);
            IRewardStaking(convexPool).withdrawAndUnwrap(_amount, false);
            IERC20(curveToken).safeTransfer(msg.sender, _amount);
        }

        //events
        emit Withdrawn(msg.sender, _amount, true);
    }
// Solidity 0.8.7
/**
 * @notice Reserves to various addresses
 * @dev Can be locked
 * @param amount of tokens to be reserved
 * @param to address to receive reserved tokens
 */
function reserve(uint256 amount, address to) public lockable onlyOwner {
        require(reserved + amount <= MAX_RESERVED,  "Exceeds maximum number of reserved tokens");
        require(totalSupply + amount <= MAX_SUPPLY, "Insufficient supply");

        for (uint256 i = 0; i < amount; i++) {
            _safeMint(to, totalSupply);
            totalSupply += 1;
        }

        reserved += amount;
    }
// Solidity 0.8.7
/**
 * @notice Mint a Fren using a signature
 * @param amount of Fren to mint
 * @param signature created by signer account
 */
function mint(uint256 amount, bytes memory signature) public payable nonReentrant {
        require(signer == ECDSA.recover(
            ECDSA.toEthSignedMessageHash(keccak256(abi.encodePacked(_msgSender()))),
            signature
        ), "Invalid signature");

        require(totalSupply + amount <= MAX_SUPPLY,             "Insufficient supply");
        require(msg.value == MINT_PRICE * amount,               "Invalid Ether amount sent");
        require(minted[_msgSender()] + amount <= maxPerAddress, "Insufficient mints available");

        for (uint256 i = 0; i < amount; i++) {
            _safeMint(_msgSender(), totalSupply);
            totalSupply += 1;
        }

        minted[_msgSender()] += amount;
    }
// Solidity 0.6.11
/// @notice Creates a withdrawal request that will be finalized after delay time
/// @param _receiver address that will receive the token
/// @param _amount amount of tokens for the request
function requestWithdrawal(
        address _receiver,
        uint256 _amount
    )
        public
        onlyOwner()
        returns (bool)
    {
        require(_amount > 0, "withdrawal amount has to be bigger than 0");

        uint256 newAmount = withdrawal.amount.add(_amount);

        require(
            newAmount <= ctsi.balanceOf(address(this)),
            "Not enough tokens in the contract for this Withdrawal request"
        );
        withdrawal.receiver = _receiver;
        withdrawal.amount = newAmount;
        withdrawal.timestamp = block.timestamp;

        emit WithdrawRequested(_receiver, newAmount, block.timestamp);

        return true;
    }
// Solidity 0.6.11
/// @notice Finalizes withdraw and transfer the tokens to receiver
function finalizeWithdraw() public onlyOwner returns (bool) {
        uint256 amount = withdrawal.amount;
        require(
            withdrawal.timestamp.add(delay) <= block.timestamp,
            "Withdrawal is not old enough to be finalized"
        );
        require(amount > 0, "There are no active withdrawal requests");

        withdrawal.amount = 0;
        ctsi.transfer(withdrawal.receiver, amount);

        emit WithdrawFinalized(withdrawal.receiver, amount);
        return true;
    }
// Solidity 0.4.21
/// @dev set Wild card token.
function makeWildCardToken(uint256 tokenId) public payable {

        require(msg.value == killerPriceConversionFee);		
		//Start New Code--for making wild card for each category
		uint256 index = cardTokenToPosition[tokenId];
	    //Card storage card = cards[index];
	    string storage cardCategory=cards[index].category;
	    uint256 totalCards = totalSupply();
        uint256 i=0;
          for (i = 0; i  <= totalCards-1; i++) {
            //check for the same category
            //StringUtils
            if (keccak256(cards[i].category)==keccak256(cardCategory)){
               cards[i].Iswildcard=0;
            }
          }
		cards[index].Iswildcard=1;
		//End New Code--
		
		//msg.sender.transfer(killerPriceConversionFee);
		//address(this).transfer(killerPriceConversionFee);
		//emit NewWildToken(wildcardTokenId);
	}
// Solidity 0.4.21
//get the selling price of card based on slab.
function nextPriceOf(uint256 _tokenId) public view returns (uint256 price){
    uint256 sellingPrice=cardTokenToPrice[_tokenId];
     // Update prices
    if (sellingPrice < firstStepLimit) {
      // first stage
      sellingPrice = Helper.div(Helper.mul(sellingPrice, 300), 93);
    } else if (sellingPrice < secondStepLimit) {
      // second stage
      sellingPrice= Helper.div(Helper.mul(sellingPrice, 200), 93);
    } else if (sellingPrice < thirdStepLimit) {
      // second stage
      sellingPrice = Helper.div(Helper.mul(sellingPrice, 120), 93);
    } else {
      // third stage
      sellingPrice = Helper.div(Helper.mul(sellingPrice, 115), 93);
    }
    return sellingPrice;
}
// Solidity 0.7.6
/// @notice Updates a 256 bit word with a 32 bit representation of a block number at a particular index
/// @param _existingUpkeepBlockNumbers The 256 word
/// @param _podIndex The index within that word (0 to 7)
/// @param _value The block number value to be inserted
function _updateLastBlockNumberForPodIndex(uint256 _existingUpkeepBlockNumbers, uint8 _podIndex, uint32 _value) internal pure returns (uint256) { 

        uint256 mask =  (type(uint32).max | uint256(0)) << (_podIndex * 32); // get a mask of all 1's at the pod index    
        uint256 updateBits =  (uint256(0) | _value) << (_podIndex * 32); // position value at index with 0's in every other position

        /* 
        (updateBits | ~mask) 
            negation of the mask is 0's at the location of the block number, 1's everywhere else
            OR'ing it with updateBits will give 1's everywhere else, block number intact
        
        (_existingUpkeepBlockNumbers | mask)
            OR'ing the exstingUpkeepBlockNumbers with mask will give maintain other blocknumber, put all 1's at podIndex
        
            finally AND'ing the two halves will filter through 1's if they are supposed to be there
        */
        return (updateBits | ~mask) & (_existingUpkeepBlockNumbers | mask); 
    }
// Solidity 0.7.6
/// @notice Checks if Pods require upkeep. Call in a static manner every block by the Chainlink Upkeep network.
/// @param checkData Not used in this implementation.
/// @return upkeepNeeded as true if performUpkeep() needs to be called, false otherwise. performData returned empty. 
function checkUpkeep(bytes calldata checkData) override external view returns (bool upkeepNeeded, bytes memory performData) {
        
        if(paused()) return (false, performData);   

        address[] memory pods = podsRegistry.getAddresses();
        uint256 _upkeepBlockInterval = upkeepBlockInterval;
        uint256 podsLength = pods.length;

        for(uint256 podWord = 0; podWord <= podsLength / 8; podWord++){

            uint256 _lastUpkeep = lastUpkeepBlockNumber[podWord]; // this performs the SLOAD
            for(uint256 i = 0; i + (podWord * 8) < podsLength; i++){
                
                uint32 podLastUpkeepBlockNumber = _readLastBlockNumberForPodIndex(_lastUpkeep, uint8(i));
                if(block.number > podLastUpkeepBlockNumber + _upkeepBlockInterval){
                    return (true, "");
                }
            }
        }       
        return (false, "");    
    }
// Solidity 0.7.6
/// @notice Performs upkeep on the pods contract and updates lastUpkeepBlockNumbers
/// @param performData Not used in this implementation.
function performUpkeep(bytes calldata performData) override external whenNotPaused{
    
        address[] memory pods = podsRegistry.getAddresses();
        uint256 podsLength = pods.length;
        uint256 _batchLimit = upkeepBatchLimit;
        uint256 batchesPerformed = 0;

        for(uint8 podWord = 0; podWord <= podsLength / 8; podWord++){ // give word index
            
            uint256 _updateBlockNumber = lastUpkeepBlockNumber[podWord]; // this performs the SLOAD

            for(uint8 i = 0; i + (podWord * 8) < podsLength; i++){ // pod index within word
                
                if(batchesPerformed >= _batchLimit) {
                    break;
                }
                // get the 32 bit block number from the 256 bit word
                uint32 podLastUpkeepBlockNumber = _readLastBlockNumberForPodIndex(_updateBlockNumber, i);
                if(block.number > podLastUpkeepBlockNumber + upkeepBlockInterval) {
                    IPod(pods[i + (podWord * 8)]).drop();
                    batchesPerformed++;
                    // updated pod's most recent upkeep block number and store update to that 256 bit word
                    _updateBlockNumber = _updateLastBlockNumberForPodIndex(_updateBlockNumber, i, uint32(block.number));                   
                }
            }         
            lastUpkeepBlockNumber[podWord] = _updateBlockNumber; // update the entire 256 bit word at once
        }
    }
// Solidity 0.6.12
// INTERNAL ACTIONS
function _claimAndSellRewards() internal returns (uint256) {
        uint256 stkAaveBalance = balanceOfStkAave();
        CooldownStatus cooldownStatus;
        if (stkAaveBalance > 0) {
            cooldownStatus = _checkCooldown(); // don't check status if we have no stkAave
        }

        // If it's the claim period claim
        if (stkAaveBalance > 0 && cooldownStatus == CooldownStatus.Claim) {
            // redeem AAVE from stkAave
            stkAave.claimRewards(address(this), type(uint256).max);
            stkAave.redeem(address(this), stkAaveBalance);
        }

        // claim stkAave from lending and borrowing, this will reset the cooldown
        incentivesController.claimRewards(
            getAaveAssets(),
            type(uint256).max,
            address(this)
        );

        stkAaveBalance = balanceOfStkAave();

        // request start of cooldown period, if there's no cooldown in progress
        if (
            cooldownStkAave &&
            stkAaveBalance > 0 &&
            cooldownStatus == CooldownStatus.None
        ) {
            stkAave.cooldown();
        }

        // Always keep 1 wei to get around cooldown clear
        if (sellStkAave && stkAaveBalance >= minRewardToSell.add(1)) {
            uint256 minAAVEOut =
                stkAaveBalance.mul(MAX_BPS.sub(maxStkAavePriceImpactBps)).div(
                    MAX_BPS
                );
            _sellSTKAAVEToAAVE(stkAaveBalance.sub(1), minAAVEOut);
        }

        // sell AAVE for want
        uint256 aaveBalance = balanceOfAave();
        if (aaveBalance >= minRewardToSell) {
            _sellAAVEForWant(aaveBalance, 0);
        }
    }
// Solidity 0.6.12
// Flashloan callback function
function callFunction(
        address sender,
        Account.Info memory account,
        bytes memory data
    ) public override {
        (bool deficit, uint256 amount) = abi.decode(data, (bool, uint256));
        require(msg.sender == FlashLoanLib.SOLO);
        require(sender == address(this));

        FlashLoanLib.loanLogic(deficit, amount, address(want));
    }
// Solidity 0.6.12
// conversions
function tokenToWant(address token, uint256 amount)
        internal
        view
        returns (uint256)
    {
        if (amount == 0 || address(want) == token) {
            return amount;
        }

        // KISS: just use a v2 router for quotes which aren't used in critical logic
        IUni router =
            swapRouter == SwapRouter.SushiV2 ? SUSHI_V2_ROUTER : UNI_V2_ROUTER;
        uint256[] memory amounts =
            router.getAmountsOut(
                amount,
                getTokenOutPathV2(token, address(want))
            );

        return amounts[amounts.length - 1];
    }
// Solidity 0.8.0
//Only Owner Mint Function
function privatemint(uint256 _mintAmount) public onlyOwner {
    uint256 supply = totalSupply();
    require(!paused, "the contract is paused");
    require(_mintAmount > 0, "need to mint at least 1 NFT");
    require(supply + _mintAmount <= maxSupply, "max NFT limit exceeded");
    require(privateAmountMinted + _mintAmount <= Santas_Private, "Mint amount more than private reserves");
    for (uint8 i = 1; i <= _mintAmount; i++) {
        privateAmountMinted++;
        _safeMint(msg.sender, supply + i);
    }
  }
// Solidity 0.8.0
//Only Owner Gift Function
function privategift(address _to, uint256 _mintAmount) public onlyOwner {
    uint256 supply = totalSupply();
    require(!paused, "the contract is paused");
    require(_mintAmount > 0, "need to mint at least 1 NFT");
    require(supply + _mintAmount <= maxSupply, "max NFT limit exceeded");
    require(privateAmountMinted + _mintAmount <= Santas_Private, "Mint amount more than private reserves");
    for (uint8 i = 1; i <= _mintAmount; i++) {
        privateAmountMinted++;
        _safeMint(_to, supply + i);
    }
  }
// Solidity 0.4.25
/**
 * ERC 20 Standard Token interface transfer function
 */
function transfer(address _to, uint256 _value) public returns (bool success) {
        //Default assumes totalSupply can't be over max (2^256 - 1).
        //If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
        //Replace the if with this one instead.
        if (balances[msg.sender] >= _value && balances[_to].add(_value) > balances[_to]) {
            balances[msg.sender] = balances[msg.sender].sub(_value);
            balances[_to] = balances[_to].add(_value);
            emit Transfer(msg.sender, _to, _value);
            return true;
        } else {
            return false;
        }
    }
// Solidity 0.4.23
//function createANewCert(address _publicKey, uint256 _amount) external payable onlyCEO{
function depositCertificateSale(address _publicKey, uint256 _amount) external payable onlyCEO{
        require(msg.sender != address(0));
        require(_amount > 0);
        require(msg.value == _amount);
        require(_publicKey != address(0));
        require(totalSupplyOfKeys < KEY_CREATION_LIMIT);
        require(totalReclaimedKeys < KEY_CREATION_LIMIT);
 
        require(!allThePublicKeys[_publicKey]);

        allThePublicKeys[_publicKey]=true;
        totalSupplyOfKeys ++;

        balanceOf[msg.sender] = balanceOf[msg.sender].add(_amount);
        
        emit DepositCertificateSaleEvent(msg.sender, _publicKey, _amount);
    }
// Solidity 0.4.23
/**
 * Payout a certificate. 
 * 
 */
function payoutACert(bytes32 _msgHash, uint8 _v, bytes32 _r, bytes32 _s) external nonReentrant{
        require(msg.sender != address(0));
        require(address(this).balance > 0);
        require(totalSupplyOfKeys > 0);
        require(totalReclaimedKeys < KEY_CREATION_LIMIT);
         
        address _recoveredAddress = ecrecover(_msgHash, _v, _r, _s);
        require(allThePublicKeys[_recoveredAddress]);
    
        allThePublicKeys[_recoveredAddress]=false;

        uint256 _validKeys = totalSupplyOfKeys.sub(totalReclaimedKeys);
        uint256 _payoutValue = address(this).balance.div(_validKeys);

        msg.sender.transfer(_payoutValue);
        emit CertPayedOutEvent(msg.sender, _recoveredAddress, _payoutValue);
        
        totalReclaimedKeys ++;
    }
// Solidity 0.4.23
//
// debug only. remove in Live deploy.
// do this operation on the Dapp side.
function calculatePayout() view external returns(
        uint256 _etherValue
        ){
        uint256 _validKeys = totalSupplyOfKeys.sub(totalReclaimedKeys);
        // Last key has been paid out.
        if(_validKeys == 0){
            _etherValue = 0;
        }else{
            _etherValue = address(this).balance.div(_validKeys);
        }
    }
// Solidity 0.4.24
// implementation of low level token purchase function
function buyTokens(address beneficiary, uint256 weiAmount) internal {
		require(beneficiary != 0x0);
		require(validPurchase(weiAmount));

		// calculate token amount to be sent
		uint256 tokens = calcBonus(weiAmount.mul(rate));
		
		if(remain.sub(tokens) <= 0){
			reached = true;

			uint256 real = remain;

			remain = 0;

			uint256 refund = weiAmount - real.mul(100).div(110).div(rate);

			beneficiary.transfer(refund);

			transferToken(beneficiary, real);

			forwardFunds(weiAmount.sub(refund));

			emit BuyTokens(beneficiary, weiAmount.sub(refund), real, now);
		} else{

			remain = remain.sub(tokens);

			transferToken(beneficiary, tokens);

			forwardFunds(weiAmount);

			emit BuyTokens(beneficiary, weiAmount, tokens, now);
		}

	}
// Solidity 0.8.10
/**
 * Restores the signer of the signed message and checks if it was signed by the trusted signer and also
 * contains the parameters.
 */
function _verifySignature(
        address wallet,
        uint256 maxAmount,
        uint256 timestamp,
        bytes memory signature
    ) private view returns (bool) {
        bytes32 sigR;
        bytes32 sigS;
        uint8 sigV;
        (sigV, sigR, sigS) = _splitSignature(signature);
        bytes32 message = keccak256(abi.encodePacked(wallet, maxAmount, timestamp));
        return presaleSigner == ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", message)), sigV, sigR, sigS);
    }
// Solidity 0.8.10
// ------------------
// Owner functions
// ------------------
function initialize(
        address _old_contract_address,
        uint256 _maxOmm
    )  external onlyOwner {
        if(address(_omm_contract) != address(0)) revert ContractAlreadyInitialized();
        if(_old_contract_address == address(0)) revert EmptyAddress();
        if(_maxOmm == 0) revert MaxOmmIsZero();
        _omm_contract = OldMasterMemes(_old_contract_address);
        bool originalContractSaleIsActive = _omm_contract.saleIsActive();
        if(originalContractSaleIsActive) revert SaleOfOriginalContractActive();
        maxOmm = _maxOmm;
        saleIsActive = false;
        communitySaleIsActive = false;
    }
// Solidity 0.5.11
// ------------------------------------------------------------------------
// Buy one coin
// ------------------------------------------------------------------------
function buyOne() public payable returns (bool success) {
        uint price = getPrice();
        uint fee = price / 10;
        require(msg.value == (price + fee), 'Wrong amount');
        balances[address(this)] = safeSub(balances[address(this)], 1);
        balances[msg.sender] = safeAdd(balances[msg.sender], 1);
        emit Transfer(address(this), msg.sender, 1);
        address(uint160(owner)).transfer(fee);
        return true;
    }
// Solidity 0.5.11
// ------------------------------------------------------------------------
// Sell one coin
// ------------------------------------------------------------------------
function sellOne() public returns (bool success) {
        uint price = getPrice() - 0.0001 ether;
        uint fee = price / 10;
        balances[msg.sender] = safeSub(balances[msg.sender], 1);
        balances[address(this)] = safeAdd(balances[address(this)], 1);
        emit Transfer(msg.sender, address(this), 1);
        msg.sender.transfer(price - fee);
        address(uint160(owner)).transfer(fee);
        return true;
    }
// Solidity 0.5.14
/**
 * @dev To register the User
 * @param _referrerID id of user/referrer who is already in matrix
 * @param _mrs _mrs[0] - message hash _mrs[1] - r of signature _mrs[2] - s of signature 
 * @param _v  v of signature
 */
function regUser(uint _referrerID, bytes32[3] calldata _mrs, uint8 _v) external payable {
        require(lockStatus == false, "Contract Locked");
        require(users[msg.sender].isExist == false, "User exist");
        require(_referrerID > 0 && _referrerID <= currentId, "Incorrect referrer Id");
        require(hashConfirmation[_mrs[0]] == false, "Hash Exits");
        require(msg.value == LEVEL_PRICE[1], "Incorrect Value");
        
        if(users[userList[_referrerID]].referral.length >= referrer1Limit) _referrerID = users[findFreeReferrer(userList[_referrerID])].id;

        UserStruct memory userStruct;
        currentId++;
        
        userStruct = UserStruct({
            isExist: true,
            id: currentId,
            referrerID: _referrerID,
            currentLevel: 1,
            totalEarningEth:0,
            referral: new address[](0)
        });

        users[msg.sender] = userStruct;
        userList[currentId] = msg.sender;
        users[msg.sender].levelExpired[1] = now.add(PERIOD_LENGTH);
        users[userList[_referrerID]].referral.push(msg.sender);
        createdDate[msg.sender] = now;
        loopCheck[msg.sender] = 0;

        payForRegister(1, msg.sender, ((LEVEL_PRICE[1].mul(adminFee)).div(10**20)), _mrs, _v);
        hashConfirmation[_mrs[0]] = true;

        emit regLevelEvent(msg.sender, userList[_referrerID], now);
    }