lohoz/Smart-Contract-MultiTask-Dataset huggingface dataset:
// Solidity 0.5.11
/**
 * Execute a multi-signature revoke transaction from this wallet using 2 signers: one from msg.sender and the other from ecrecover.
 * Sequence IDs are numbers starting from 1. They are used to prevent replay attacks and may not be repeated.
 *
 * @param hash the certificate's hash that will be revoked on the blockchain
 * @param expireTime the number of seconds since 1970 for which this transaction is valid
 * @param sequenceId the unique sequence id obtainable from getNextSequenceId
 * @param signature second signer's signature
 */
function revokeMultiSig(
        bytes32 hash,
        uint expireTime,
        uint sequenceId,
        bytes memory signature
        ) public onlyCustodian {
            bytes32 operationHash = keccak256(abi.encodePacked("REVOKE", hash, expireTime, sequenceId));
            
            address otherSigner = verifyMultiSig(operationHash, signature, expireTime, sequenceId);
            
            documentStore.revoke(hash);
            
            emit Revoked(msg.sender, otherSigner, operationHash, hash);
        }
// Solidity 0.5.11
/**
 * Execute a multi-signature transfer transaction from this wallet using 2 signers: one from msg.sender and the other from ecrecover.
 * Sequence IDs are numbers starting from 1. They are used to prevent replay attacks and may not be repeated.
 * This transaction transfers the ownership of the certificate store to a new owner.
 *
 * @param newOwner the new owner's address
 * @param expireTime the number of seconds since 1970 for which this transaction is valid
 * @param sequenceId the unique sequence id obtainable from getNextSequenceId
 * @param signature second signer's signature
 */
function transferMultiSig(
        address newOwner,
        uint expireTime,
        uint sequenceId,
        bytes memory signature
        ) public onlyBackup {
            bytes32 operationHash = keccak256(abi.encodePacked("TRANSFER", newOwner, expireTime, sequenceId));
            
            address otherSigner = verifyMultiSig(operationHash, signature, expireTime, sequenceId);
            
            documentStore.transferOwnership(newOwner);
            
            emit Transferred(msg.sender, otherSigner, newOwner);
        }
// Solidity 0.5.11
/**
 * Do common multisig verification for both Issue and Revoke transactions
 *
 * @param operationHash keccak256(prefix, hash, expireTime, sequenceId)
 * @param signature second signer's signature
 * @param expireTime the number of seconds since 1970 for which this transaction is valid
 * @param sequenceId the unique sequence id obtainable from getNextSequenceId
 * returns address that has created the signature
 */
function verifyMultiSig(
        bytes32 operationHash,
        bytes memory signature,
        uint expireTime,
        uint sequenceId
        ) private returns (address) {
    
            address otherSigner = recoverAddressFromSignature(operationHash, signature);
            
            // Verify that the transaction has not expired
            if (expireTime < block.timestamp) {
                // Transaction expired
                revert();
            }
    
            // Try to insert the sequence ID. Will revert if the sequence id was invalid
            tryInsertSequenceId(sequenceId);
        
            if (!isSigner(otherSigner)) {
                // Other signer not on this wallet or operation does not match arguments
                revert();
            }
            if (otherSigner == msg.sender) {
                // Cannot approve own transaction
                revert();
            }
        
            return otherSigner;
        }
// Solidity 0.5.11
/**
 * Gets signer's address using ecrecover
 * @param operationHash see Data Formats
 * @param signature see Data Formats
 * returns address recovered from the signature
 */
function recoverAddressFromSignature(
        bytes32 operationHash,
        bytes memory signature
        ) private pure returns (address) {
            if (signature.length != 65) {
            revert();
            }
        // We need to unpack the signature, which is given as an array of 65 bytes (like eth.sign)
        bytes32 r;
        bytes32 s;
        uint8 v;
        assembly {
            r := mload(add(signature, 32))
            s := mload(add(signature, 64))
            v := and(mload(add(signature, 65)), 255)
        }
        if (v < 27) {
            v += 27; // Ethereum versions are 27 or 28 as opposed to 0 or 1 which is submitted by some signing libs
        }
        return ecrecover(operationHash, v, r, s);
    }
// Solidity 0.5.11
/**
 * Verify that the sequence id has not been used before and inserts it. Throws if the sequence ID was not accepted.
 * We collect a window of up to 10 recent sequence ids, and allow any sequence id that is not in the window and
 * greater than the minimum element in the window.
 * @param sequenceId to insert into array of stored ids
 */
function tryInsertSequenceId(uint sequenceId) private onlyInitiators {
        // Keep a pointer to the lowest value element in the window
        uint lowestValueIndex = 0;
        for (uint i = 0; i < SEQUENCE_ID_WINDOW_SIZE; i++) {
            if (recentSequenceIds[i] == sequenceId) {
                // This sequence ID has been used before. Disallow!
                revert();
            }
            if (recentSequenceIds[i] < recentSequenceIds[lowestValueIndex]) {
                lowestValueIndex = i;
            }
        }
        if (sequenceId < recentSequenceIds[lowestValueIndex]) {
            // The sequence ID being used is lower than the lowest value in the window
            // so we cannot accept it as it may have been used before
            revert();
        }
        if (sequenceId > (recentSequenceIds[lowestValueIndex] + 10000)) {
            // Block sequence IDs which are much higher than the lowest value
            // This prevents people blocking the contract by using very large sequence IDs quickly
            revert();
        }
        recentSequenceIds[lowestValueIndex] = sequenceId;
    }
// Solidity 0.5.11
/**
 * Gets the next available sequence ID for signing when using executeAndConfirm
 * returns the sequenceId one higher than the highest currently stored
 */
function getNextSequenceId() public view returns (uint) {
        uint highestSequenceId = 0;
        for (uint i = 0; i < SEQUENCE_ID_WINDOW_SIZE; i++) {
            if (recentSequenceIds[i] > highestSequenceId) {
                highestSequenceId = recentSequenceIds[i];
            }
        }
    return highestSequenceId + 1;
    }
// Solidity 0.7.4
/// @notice A generelized getter for a price supplied by an oracle contract.
/// @dev The oracle returndata must be formatted as a single uint256.
/// @param _oracle The descriptor of our oracle e.g. ETH/USD-Maker-v1
/// @return The uint256 oracle price
function getPrice(string memory _oracle) external view returns (uint256) {
        address oracleAddr = oracle[_oracle];
        if (oracleAddr == address(0))
            revert("PriceOracleResolver.getPrice: no oracle");
        (bool success, bytes memory returndata) = oracleAddr.staticcall(
            oraclePayload[_oracle]
        );
        if (!success)
            returndata.revertWithError("PriceOracleResolver.getPrice:");
        return abi.decode(returndata, (uint256));
    }
// Solidity 0.8.9
// function setIsExcludedFromMaxWallet(address account, bool value) external onlyOwner {
// 	require(isExcludedFromMaxWallet[account] != value, "Account is already set to this value");
// 	isExcludedFromMaxWallet[account] = value;
// }
// function setIsExcludedFromFees(address account, bool value) external onlyOwner {
// 	require(isExcludedFromFees[account] != value, "Account is already set to this value");
// 	isExcludedFromFees[account] = value;
// }
function getExtraSalesFee(address account) public view returns (uint256) {
		uint256 extraFees = 0;
		uint256 firstTransTime = firstTransactionTimestamp[account];
		uint256 blockTime = block.timestamp;
		if(blockTime < launchedAtTime + 5 minutes){
			extraFees = 15;
		}
		else if(blockTime < firstTransTime + 7 days){
			extraFees = extraBurnFee;
		}
		return extraFees;
	}
// Solidity 0.8.7
/**
 early access sale purchase using merkle trees to verify that a address is whitelisted 
 */
function whitelistPreSale(
        uint256 amount,
        bytes32[] calldata merkleProof
    ) external payable  {
        

        require( presaleActivated , "Early access: not available yet ");
        require(amount > 0 && amount <= maxPerTx, "Purchase: amount prohibited");
        require(purchaseTxs[msg.sender] + amount  <= maxperaddress); // require every address on the whitelist to mint a maximum of their address .
        bytes32 node = keccak256(abi.encodePacked(msg.sender));
        require(
            MerkleProof.verify(merkleProof, merkleRoot, node),
            "MerkleDistributor: Invalid proof."
        );
        
        
      if(amount > 1) {
          
           _bulkpurchase(amount);
       }
      else { 
          _purchase(amount);
          } 
    
       
    }
// Solidity 0.8.7
// during opening of the public sale theres no limit  for minting and owning tokens in transactions.
function _purchase(uint256 amount ) private {
        
      
        require(amount > 0 , "amount cant be zero ");
        require(Idx + amount <= MAX_SUPPLY , "Purchase: Max supply of 2026 reached");
        require(msg.value == amount * mintPrice, "Purchase: Incorrect payment");
        Idx += 1;
        purchaseTxs[msg.sender] += 1;
        _mint(msg.sender,Idx, amount, "");
        emit Purchased(Idx, msg.sender, amount);
    }
// Solidity 0.8.7
// this function is used to bulk purchase Unique nfts.
function _bulkpurchase(uint256 amount ) private {
        require(Idx + amount <= MAX_SUPPLY, "Purchase: Max supply reached ");
        require(msg.value == amount * mintPrice, "Purchase: Incorrect payment XX");
        uint256[] memory ids = new uint256[](amount);
        uint256[] memory values = new uint256[](amount);
        Idx += amount; 
        uint256  iterator =  Idx;

        for(uint i = 0 ; i < amount; i++){

            ids[i] = iterator; // line up Unique NFTs ID in  a array.   

            iterator = iterator-1; 

            values[i] = 1; // for Unique Nfts  Supply of every ID MUST be one .1   to be injected in the _mintBatch function     
        }
        
         purchaseTxs[msg.sender] += amount;
        _mintBatch(msg.sender, ids,values, "");
        
         emit Purchased(Idx, msg.sender, amount);
        
        
    }
// Solidity 0.8.7
// airdrop nft function for owner only to be able to  airdrop Unique nfts 
function airdrop(address payable reciever, uint256 amount ) external onlyOwner() {
       
       require(Idx + amount <= MAX_SUPPLY, "Max supply of 2026 reached");
       require(amount >= 1, "nonzero err");
        
         if(amount == 1)  {
            Idx += 1;
           _mint(reciever, Idx, 1 , "");

       } 
       else {
           
        uint256[] memory ids = new uint256[](amount);
        uint256[] memory values = new uint256[](amount);
        Idx += amount; 
        uint256  iterator =  Idx;

        for(uint i = 0 ; i < amount; i++){

            ids[i] = iterator; // line up Unique NFTs ID in  a array.   
           
            iterator = iterator-1; 

            values[i] = 1; // for Unique Nfts  Supply of every ID MUST be one .1   to be injected in the _mintBatch function     
        }
        
       
        _mintBatch(reciever, ids,values, "");
       }
       
       
   }
// Solidity 0.8.9
/**
 * @dev Override token's minimum stake time.
 */
function editToken(uint256 id, uint16 passList, uint56 maxSupply,
            int64 minStakeTime, string memory ipfsHash)
        public onlyOwner validTokenId(id)
    {
        require(maxSupply >= _tokens[id].totalSupply, 'max must exceed total');
        _tokens[id].passList     = passList;
        _tokens[id].maxSupply    = maxSupply;
        _tokens[id].minStakeTime = minStakeTime;

        _ipfsHash[id] = ipfsHash;
        emit URI(uri(id), id);
    }
// Solidity 0.8.9
/**
 * @dev Create a new token.
 * @param passList uint16 Passes eligible for reward.
 * @param amount uint256 Mint amount tokens to caller.
 * @param minStakeTime int64 Minimum time pass stake required to qualify
 * @param maxSupply uint56 Max mintable supply for this token.
 * @param ipfsHash string Override ipfsHash for newly created token.
 */
function create(uint16 passList, uint256 amount, uint56 maxSupply,
            int64 minStakeTime, string memory ipfsHash)
        public onlyOwner
    {
        require(amount > 0, 'invalid amount');
        require(bytes(ipfsHash).length > 0, 'invalid ipfshash');

        // grab token id
        uint256 tokenId = _tokens.length;

        // add token
        int64 createdAt    = int64(int256(block.timestamp));
        Token memory token = Token(passList, maxSupply, 0, minStakeTime, createdAt);
        _tokens.push(token);

        // override token's ipfsHash
        _ipfsHash[tokenId] = ipfsHash;
        emit URI(uri(tokenId), tokenId);

        // mint a single token
        _mint(msg.sender, tokenId, amount, "");

        // created event
        emit TokenCreated(tokenId, passList, maxSupply, minStakeTime, createdAt);
    }
// Solidity 0.8.9
/**
 * @dev Return list of pass contracts.
 */
function allPassContracts()
        public view
        returns (address[] memory)
    {
        // keep the first empty entry so index lines up with id
        uint256 count = _passes.length;
        address[] memory passes = new address[](count);
        for (uint256 i = 0; i < count; ++i) {
            passes[i] = address(_passes[i]);
        }
        return passes;
    }
// Solidity 0.8.9
/**
 * @dev Query pass for owners balance.
 */
function balanceOfPass(address pass, address owner)
        public
        view
        returns (uint256)
    {
        require(_passIdx[pass] != 0, 'invalid pass address');

        // grab pass
        uint8 passId    = _passIdx[pass];
        IERC721 pass721 = _passes[passId];

        // return pass balance
        return pass721.balanceOf(owner);
    }
// Solidity 0.8.9
/**
 * @dev Stake single pass.
 */
function stakePass(address pass, uint256 tokenId)
        public
    {
        require(_passIdx[pass] != 0, 'invalid pass address');

        address sender = _msgSender();

        // grab pass
        uint8 passId    = _passIdx[pass];
        IERC721 pass721 = _passes[passId];

        // verify ownership
        require(pass721.ownerOf(tokenId) == sender, 'not pass owner');

        // transfer here
        pass721.transferFrom(sender, address(this), tokenId);

        // save staked info
        int64 stakedTS = int64(int256(block.timestamp));
        Pass memory stakedPass = Pass(
            passId,
            uint16(tokenId),
            stakedTS);
        _stakedPasses[sender].push(stakedPass);

        // track skate event
        emit Staked(sender, pass, tokenId, stakedTS);
    }
// Solidity 0.8.9
/**
 * @dev Unstake single pass.
 */
function unstakePass(address pass, uint256 tokenId)
        public
    {
        require(_passIdx[pass] != 0, 'invalid pass address');

        address sender = _msgSender();

        // grab pass
        uint8 passId    = _passIdx[pass];
        IERC721 pass721 = _passes[passId];

        // find pass
        uint256 stakedCount = _stakedPasses[sender].length;
        for (uint256 i = 0; i < stakedCount; ++i) {
            Pass storage stakedPass = _stakedPasses[sender][i];
            if (stakedPass.passId == passId && stakedPass.tokenId == tokenId) {

                // transfer pass back to owner
                pass721.transferFrom(address(this), sender, tokenId);

                // keep array compact
                uint256 lastIndex = stakedCount - 1;
                if (i != lastIndex) {
                    _stakedPasses[sender][i] = _stakedPasses[sender][lastIndex];
                }

                // cleanup
                _stakedPasses[sender].pop();

                // track unskate event
                emit Unstaked(sender, pass, tokenId);

                // no need to continue
                return;
            }
        }

        // invalid pass
        require(false, 'pass not found');
    }
// Solidity 0.8.9
/**
 * @dev Unstake all passes staked in contract.
 */
function unstakeAllPasses()
        public
    {
        address sender = _msgSender();
        require(_stakedPasses[sender].length > 0, 'no passes staked');

        // unstake all passes
        uint256 stakedCount = _stakedPasses[sender].length;
        for (uint256 i = 0; i < stakedCount; ++i) {
            Pass storage stakedPass = _stakedPasses[sender][i];
            IERC721 pass721         = _passes[stakedPass.passId];

            // transfer pass back to owner
            pass721.transferFrom(address(this), sender, stakedPass.tokenId);

            // track unskate event
            emit Unstaked(sender, address(pass721), stakedPass.tokenId);

            // cleanup
            delete _stakedPasses[sender][i];
        }

        // cleanup
        delete _stakedPasses[sender];
    }
// Solidity 0.8.9
/**
 * @dev Claim single token for all passes.
 */
function claim(uint256 tokenId)
        public validTokenId(tokenId)
    {
        address sender = _msgSender();
        require(_stakedPasses[sender].length > 0, 'no passes staked');

        // check claim
        uint256 claimId = _mkClaimId(sender, tokenId);
        require(!_claims[claimId], 'rewards claimed');

        // process all passes
        uint256 rewards = _calculateRewards(sender, tokenId);
        require(rewards > 0, 'no rewards');

        // mark as claimed
        _claims[claimId] = true;

        // mint token for claimee
        _mint(sender, tokenId, rewards, "");

        // record event
        emit RewardsClaimed(sender, tokenId, rewards);
    }
// Solidity 0.8.7
// changed here each value to one for unique nfts.
function _mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; i++) {
            _balances[ids[i]][to] += amounts[i];
        }

        emit TransferBatch(operator, address(0), to, ids, amounts);

        _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
    }
// Solidity 0.8.9
/// Mint tokens when the release stage is whitelist (2).
/// @param qty Number of tokens to mint (max 3)
function whitelistMint(uint256 qty) external payable nonReentrant {
        IGraveyard graveyard = IGraveyard(GRAVEYARD_ADDRESS);
        address sender = _msgSender();
        require(graveyard.releaseStage() == 2, "Whitelist inactive");
        require(qty > 0 && graveyard.isWhitelisted(sender, qty), "Invalid whitelist address/qty");

        graveyard.updateClaimable(sender, 1e18 * 1000 * qty);
        _mintTo(sender, qty);
        graveyard.updateWhitelist(sender, qty);
    }
// Solidity 0.8.9
/// Claim tokens for team/giveaways.
/// @param addresses An array of addresses to mint tokens for
/// @param quantities An array of quantities for each respective address to mint
/// @dev This method does NOT increment an addresses minting total
function ownerClaim(address[] calldata addresses, uint256[] calldata quantities) external onlyOwner nonReentrant {
        require(addresses.length == quantities.length, "Invalid args");
        IGraveyard graveyard = IGraveyard(GRAVEYARD_ADDRESS);
        for (uint256 a = 0;a < addresses.length;a++) {
            graveyard.updateClaimable(addresses[a], 1e18 * 1000 * quantities[a]);
            _mint(addresses[a], quantities[a]);
        }
    }
// Solidity 0.8.9
/// Returns rewards for address for reward actions.
/// Multiplier of 10 * token balance + multiplier if set.
/// @param from The address to calculate reward rate for
function getRewardRate(address from) external view returns (uint256) {
        uint256 balance = balanceOf(from);
        if (_dataAddress == address(0)) return 1e18 * 10 * balance;
        ICryptData data = ICryptData(_dataAddress);
        uint256 rate = 0;
        for (uint256 i = 0;i < balance;i++) {
            rate += data.getRewardRate(tokenOfOwnerByIndex(from, i));
        }
        return rate;
    }
// Solidity 0.6.12
// Stake $HIPPO
function stake(uint256 amount) public updateStakingReward(msg.sender) {
        require(isStart, "not started");
        require(0 < amount, ":stake: Fund Error");
        totalStakedAmount = totalStakedAmount.add(amount);
        staked[msg.sender].stakedHIPPO = staked[msg.sender].stakedHIPPO.add(amount);
        HippoToken.safeTransferFrom(msg.sender, address(this), amount);
        staked[msg.sender].lastBlock = block.number;
        emit Staked(msg.sender, amount, totalStakedAmount);
    }