lohoz/Smart-Contract-MultiTask-Dataset huggingface dataset:
// Solidity 0.6.2
//  users convert LpToken crosschain conflux
function tokenConvert(uint256 _pid, address _to) public {
      PoolInfo storage pool = poolInfo[_pid];
      require(pool.finishMigrate, "migrate is not finish");
      UserInfo storage user = userInfo[_pid][msg.sender];
      uint256 _amount = user.amount;
      require(_amount > 0, "user amount is zero");
      updatePool(_pid);
      uint256 pending = _amount.mul(pool.accTokenPerShare).div(1e12).sub(user.rewardDebt);
      safeTokenTransfer(msg.sender, pending);
      user.amount = 0;
      user.rewardDebt = 0;
      pool.lpToken.safeTransfer(_to, _amount);

      pool.lockCrosschainAmount = pool.lockCrosschainAmount.add(_amount);
      _depositMigratePoolAddr(_pid, pool.accTokenPerShare, _amount);
      emit TokenConvert(msg.sender, _pid, _to, _amount);

    }
// Solidity 0.6.2
// after migrate, mint LpToken's Yad to address
function _transferMigratePoolAddr(uint256 _pid, uint256 _poolAccTokenPerShare) internal
    {
        address migratePoolAddr = migratePoolAddrs[_pid];
        require(migratePoolAddr != address(0), "address invaid");

        UserInfo storage user = userInfo[_pid][migratePoolAddr];
        if(user.amount > 0){
          uint256 pending = user.amount.mul(_poolAccTokenPerShare).div(1e12).sub(user.rewardDebt);
          safeTokenTransfer(migratePoolAddr, pending);

          user.rewardDebt = user.amount.mul(_poolAccTokenPerShare).div(1e12);
        }
    }
// Solidity 0.7.6
// function unstake(uint _pool_number) public {
//     require(_pool_number>0 && _pool_number<=pool_count,'invalid pool number');
//     require(block.timestamp >= window_end_date+pools[_pool_number].pool_Duration,'not time to unstake yet');
//     require(!pools[_pool_number].isUnstaked[msg.sender],'already unstaked');
//     pools[_pool_number].isUnstaked[msg.sender] = true;
//     require(A5T_USDC_Pair.transfer(msg.sender, pools[_pool_number].stake_amount[msg.sender]),'transfer Token Error');
//     emit unstakeEvent(msg.sender, pools[_pool_number].stake_amount[msg.sender],_pool_number);
// }
// function claimReward(uint _pool_number) public{
//     require(_pool_number>0 && _pool_number<=pool_count,'invalid pool number');
//     require(block.timestamp >= window_end_date+pools[_pool_number].pool_Duration,'not time to unstake yet');
//     require(pools[_pool_number].stake_amount[msg.sender] > 0,'nothing to unstake');
//     require(!pools[_pool_number].isClaimed[msg.sender],'already claimed');
//     pools[_pool_number].isClaimed[msg.sender] = true;
//     require(A5T.transfer(msg.sender, pools[_pool_number].stake_amount[msg.sender].mul(pools[_pool_number].total_A5T_Reward).div(pools[_pool_number].TVL)),'transfer Token Error');
//     emit rewardEvent(msg.sender, pools[_pool_number].stake_amount[msg.sender].mul(pools[_pool_number].total_A5T_Reward).div(pools[_pool_number].TVL),_pool_number);
// }
function claimAndUnstake(uint _pool_number) public{
        require(_pool_number>0 && _pool_number<=pool_count,'invalid pool number');
        require(block.timestamp >= window_end_date+pools[_pool_number].pool_Duration,'not time to unstake yet');
        require(pools[_pool_number].stake_amount[msg.sender] > 0,'nothing to unstake');
        require(!pools[_pool_number].isClaimed[msg.sender],'already claimed');
        
        pools[_pool_number].isClaimed[msg.sender] = true;
        
        require(A5T_USDC_Pair.transfer(msg.sender, pools[_pool_number].stake_amount[msg.sender]),'transfer Token Error');
        
        emit unstakeEvent(msg.sender, pools[_pool_number].stake_amount[msg.sender],_pool_number);
        
        require(A5T.transfer(msg.sender, pools[_pool_number].stake_amount[msg.sender].mul(pools[_pool_number].total_A5T_Reward).div(pools[_pool_number].TVL)),'transfer Token Error');
        
        emit rewardEvent(msg.sender, pools[_pool_number].stake_amount[msg.sender].mul(pools[_pool_number].total_A5T_Reward).div(pools[_pool_number].TVL),_pool_number);
    }
// Solidity 0.8.5
/**
 * @dev Change token owner details mappings
 */
function _updateTokenOwners(
        address from,
        address to,
        uint256 tokenId
    ) internal {
        uint256 currentIndex = ownerTokenList[to].length;
        ownerTokenList[to].push(tokenId);
        ownedTokensDetails[to][tokenId] = NFTDetails(
            tokenId,
            currentIndex,
            block.timestamp,
            0
        );

        NFTDetails storage details = ownedTokensDetails[from][tokenId];
        details.endTime = block.timestamp;

        uint256[] storage fromList = ownerTokenList[from];
        fromList[details.index] = fromList[fromList.length - 1];
        fromList.pop();
    }
// Solidity 0.8.5
/**
 * @dev Whitelist mint tokens to a specific address
 * @param to address to mint token for
 * @param proof to be validated
 */
function mintWhitelistTo(address to, bytes32[] memory proof)
        public
        payable
        nonReentrant
    {
        require(whitelistMintingStarted, NOT_STARTED);
        require(
            block.timestamp - whitelistMintingStartTime <=
                maxWhitelistMintingTime,
            CANT_MINT
        );
        require(
            numberOfMintedTokensFor[msg.sender] == 0 ||
                (numberOfMintedTokensFor[msg.sender] == 1 &&
                    claimedFreeMintedTokensFor[msg.sender] > 0),
            CANT_MINT
        );
        hasValidProof(proof, merkleRoot);

        addressRoles[msg.sender] = ROLE_Rare;

        _internalMint(to, 1, true);
    }
// Solidity 0.8.9
// Governable
function addMoves(uint256[] memory _moves, bool _append) external onlyGovernor {
    if (!_append) {
      delete moves;
      delete nextMove;
    }
    for (uint256 i = 0; i < _moves.length; i++) {
      moves.push(_moves[i]);
    }
    board = IChess(fiveOutOfNine).board();
  }
// Solidity 0.8.7
/**
 * @dev remove minter. Only owner can call.
 */
function removeMinter(address minter) external onlyOwner {
        require(minters[minter], "Not minter");
        minters[minter] = false;
        for (uint256 i = 0; i < mintersList.length; i++) {
            if (mintersList[i] == minter) {
                mintersList[i] = mintersList[mintersList.length - 1];
                mintersList.pop();
            }
        }
        emit MinterRemoved(minter);
    }
// Solidity 0.4.19
/**
 * This is an especial Admin-only function to make massive tokens assignments
 */
function batch(address[] data,uint256[] amount) onlyAdmin public { //It takes an arrays of addresses and amount
        
        require(data.length == amount.length);
        uint256 length = data.length;
        address target;
        uint256 value;

        for (uint i=0; i<length; i++) { //It moves over the array
            target = data[i]; //Take an address
            value = amount[i]; //Amount
            transfer(target,value);
        }
    }
// Solidity 0.5.1
//Setting the variables
function setMembershipFee(uint newMrate, uint newTime) public onlyAdmin{
		require(newMrate > 0, "new rate must be positive");
		require(newTime > 0, "new membership time must be positive");
		mRate = newMrate * 10 ** uint256(15); //The amount is in finney
		membershiptime = newTime * 86400; //The amount is in days
	}
// Solidity 0.6.12
/**
 * @notice Delegates batch from the account
 * @dev Use `hashDelegatedBatch` to create sender message payload.
 *
 * `GatewayRecipient` context api:
 * `_getContextAccount` will return `account` arg
 * `_getContextSender` will return recovered address from `senderSignature` arg
 *
 * @param account account address
 * @param nonce next account nonce
 * @param to array of batch recipients contracts
 * @param data array of batch data
 * @param senderSignature sender signature
 */
function delegateBatch(
    address account,
    uint256 nonce,
    address[] memory to,
    bytes[] memory data,
    bytes memory senderSignature
  )
    public
  {
    require(
      nonce > accountNonce[account],
      "Gateway: nonce is lower than current account nonce"
    );

    address sender = _hashPrimaryTypedData(
      _hashTypedData(
        account,
        nonce,
        to,
        data
      )
    ).recoverAddress(senderSignature);

    accountNonce[account] = nonce;

    _sendBatch(
      account,
      sender,
      to,
      data
    );
  }
// Solidity 0.6.12
/**
 * @notice Delegates multiple batches
 * @dev It will revert when all batches fail
 * @param batches array of batches
 * @param revertOnFailure reverts on any error
 */
function delegateBatches(
    bytes[] memory batches,
    bool revertOnFailure
  )
    public
  {
    require(
      batches.length > 0,
      "Gateway: cannot delegate empty batches"
    );

    bool anySucceeded;

    for (uint256 i = 0; i < batches.length; i++) {
      // solhint-disable-next-line avoid-low-level-calls
      (bool succeeded,) = address(this).call(batches[i]);

      if (revertOnFailure) {
        require(
          succeeded,
          "Gateway: batch reverted"
        );
      } else if (succeeded && !anySucceeded) {
        anySucceeded = true;
      }

      emit BatchDelegated(
        msg.sender,
        batches[i],
        succeeded
      );
    }

    if (!anySucceeded) {
      revert("Gateway: all batches reverted");
    }
  }
// Solidity 0.6.12
// private functions (pure)
function _hashTypedData(
    address account,
    uint256 nonce,
    address[] memory to,
    bytes[] memory data
  )
    private
    pure
    returns (bytes32)
  {
    bytes32[] memory dataHashes = new bytes32[](data.length);

    for (uint256 i = 0; i < data.length; i++) {
      dataHashes[i] = keccak256(data[i]);
    }

    return keccak256(abi.encode(
      DELEGATED_BATCH_TYPE_HASH,
      account,
      nonce,
      keccak256(abi.encodePacked(to)),
      keccak256(abi.encodePacked(dataHashes))
    ));
  }
// Solidity 0.8.7
/** @dev Locks tokens to bridge. External bot initiates unlock on other blockchain.
 * @param amount -- Amount of BabyDoge to lock.
 */
function lock(IERC20 token, uint256 amount) external onlySokuTokens(token) Pausable {
        address sender = msg.sender;
        require(_tokenConfig[token].exists == true, "Bridge: access denied.");
        require(token.balanceOf(sender) >= amount, "Bridge: Account has insufficient balance.");
        TokenConfig storage config = _tokenConfig[token];
        require(amount <= config.maximumTransferAmount, "Bridge: Please reduce the amount of tokens.");

        if (block.timestamp >= _dailyTransferNextTimestamp) {
            resetTransferCounter(token);
        }

        config.dailyLockTotal = config.dailyLockTotal + amount;

        if(config.dailyLockTotal > config.dailyTransferLimit) {
            revert("Bridge: Daily transfer limit reached.");
        }

        require(token.transferFrom(sender, address(this), amount), "Bridge: Transfer failed.");

        emit BridgeTransfer(
            address(token),
            sender,
            address(this),
            amount,
            block.timestamp,
            nonce
        );
        
        nonce++;
    }
// Solidity 0.8.7
// Verificar limite transacao
function release(IERC20 token, address to, uint256 amount, uint256 otherChainNonce) 
    external OnlyUnlocker() onlySokuTokens(token) Pausable {
        require(!_processedNonces[otherChainNonce], "Bridge: Transaction processed.");
        require(to!= address(0), "Bridge: access denied.");
        TokenConfig storage config = _tokenConfig[token];
        require(amount <= config.maximumTransferAmount, "Bridge: Transfer blocked.");
        _processedNonces[otherChainNonce] = true;

        _balances[token][to] = _balances[token][to] + amount; 
    }
// Solidity 0.5.10
//  Make sure only the individuals with the permissions can call the minting function
function mint(address _to, uint256 _amount) whenNotPaused onlyMinters notBlacklisted(msg.sender) notBlacklisted(_to) public returns (bool) {
        require(_to != address(0));
        require(_amount > 0);

        uint256 mintingAllowedAmount = minterAllowed[msg.sender];
        require(_amount <= mintingAllowedAmount);

        totalSupply_ = totalSupply_.add(_amount);
        balances[_to] = balances[_to].add(_amount);
        minterAllowed[msg.sender] = mintingAllowedAmount.sub(_amount);
        emit Mint(msg.sender, _to, _amount);
        emit Transfer(address(0x0), _to, _amount);
        return true;
    }
// Solidity 0.5.10
/**
 * @dev transfer token for a specified address
 * @param _to The address to transfer to.
 * @param _value The amount to be transferred.
 * These two functions allow the token to be transacted from one address to another
 * @return bool success
 */
function transfer(address _to, uint256 _value) whenNotPaused notBlacklisted(msg.sender) notBlacklisted(_to) public returns (bool) {
        require(_to != address(0));
        require(_value <= balances[msg.sender]);

        balances[msg.sender] = balances[msg.sender].sub(_value);
        balances[_to] = balances[_to].add(_value);
        emit Transfer(msg.sender, _to, _value);
        return true;
    }
// Solidity 0.5.10
/**
 * @dev allows a minter to burn some of its own tokens
 * Validates that caller is a minter and that sender is not blacklisted
 * amount is less than or equal to the minter's account balance
 * @param _amount uint256 the amount of tokens to be burned
 */
function burn(uint256 _amount) whenNotPaused onlyMinters notBlacklisted(msg.sender) public {
        uint256 balance = balances[msg.sender];
        require(_amount > 0);
        require(balance >= _amount);
//  This burn should be called when individuals want to cash out the ERC20 token for real dollars
//  Thus, we can retire the supply after the correct value of money or real services is provided
        totalSupply_ = totalSupply_.sub(_amount);
        balances[msg.sender] = balance.sub(_amount);
        emit Burn(msg.sender, _amount);
        emit Transfer(msg.sender, address(0), _amount);
    }
// Solidity 0.4.19
// @dev TLN constructor just parametrizes the MiniMeIrrevocableVestedToken constructor
function TLN(address _tokenFactory) public
            MiniMeToken(
                _tokenFactory,
                0x0,                     // no parent token
                0,                       // no snapshot block number from parent
                TLN_TOKEN_NAME,          // Token name
                TLN_TOKEN_DECIMALS,      // Decimals
                TLN_TOKEN_SYMBOL,        // Symbol
                true                     // Enable transfers
            ) {}
// Solidity 0.4.19
// ------------------------------------------------------------------------
// 100,000,000,000 FWD Tokens per 1 ETH
// ------------------------------------------------------------------------
function () public payable 
    {
        require(now >= startDate && now <= endDate);
        uint tokens;
        if (now <= bonusEnds) {
            tokens = msg.value * 150000000000;
        } else {
            tokens = msg.value * 100000000000;
        }
        balances[msg.sender] = safeAdd(balances[msg.sender], tokens);
        _totalSupply = safeAdd(_totalSupply, tokens);
        Transfer(address(0), msg.sender, tokens);
        owner.transfer(msg.value);
    }
// Solidity 0.1.6
/// @dev Converts an unsigned integert to its string representation.
/// @param v The number to be converted.
function uintToBytes(uint v) constant returns (bytes32 ret) {
        if (v == 0) {
            ret = '0';
        }
        else {
            while (v > 0) {
                ret = bytes32(uint(ret) / (2 ** 8));
                ret |= bytes32(((v % 10) + 48) * 2 ** (8 * 31));
                v /= 10;
            }
        }
        return ret;
    }
// Solidity 0.1.6
/// @dev Converts a numeric string to it's unsigned integer representation.
/// @param v The string to be converted.
function bytesToUInt(bytes32 v) constant returns (uint ret) {
        if (v == 0x0) {
            throw;
        }

        uint digit;

        for (uint i = 0; i < 32; i++) {
            digit = uint((uint(v) / (2 ** (8 * (31 - i)))) & 0xff);
            if (digit == 0) {
                break;
            }
            else if (digit < 48 || digit > 57) {
                throw;
            }
            ret *= 10;
            ret += (digit - 48);
        }
        return ret;
    }
// Solidity 0.1.6
/// @dev Low level method for removing funds from an account.  Protects against underflow.
/// @param self The Bank instance to operate on.
/// @param accountAddress The address of the account the funds should be deducted from.
/// @param value The amount that should be deducted from the account.
function deductFunds(Bank storage self, address accountAddress, uint value) public {
                /*
                 *  Helper function that should be used for any reduction of
                 *  account funds.  It has error checking to prevent
                 *  underflowing the account balance which would be REALLY bad.
                 */
                if (value > self.accountBalances[accountAddress]) {
                        // Prevent Underflow.
                        throw;
                }
                self.accountBalances[accountAddress] -= value;
        }
// Solidity 0.1.6
/// @dev Safe function for withdrawing funds.  Returns boolean for whether the deposit was successful as well as sending the amount in ether to the account address.
/// @param self The Bank instance to operate on.
/// @param accountAddress The address of the account the funds should be withdrawn from.
/// @param value The amount that should be withdrawn from the account.
function withdraw(Bank storage self, address accountAddress, uint value) public returns (bool) {
                /*
                 *  Public API for withdrawing funds.
                 */
                if (self.accountBalances[accountAddress] >= value) {
                        deductFunds(self, accountAddress, value);
                        if (!accountAddress.send(value)) {
                                // Potentially sending money to a contract that
                                // has a fallback function.  So instead, try
                                // tranferring the funds with the call api.
                                if (!accountAddress.call.value(value)()) {
                                        // Revert the entire transaction.  No
                                        // need to destroy the funds.
                                        throw;
                                }
                        }
                        return true;
                }
                return false;
        }
// Solidity 0.1.6
/// @dev Retrieve the node id of the next node in the tree.
/// @param index The index that the node is part of.
/// @param id The id for the node to be looked up.
function getPreviousNode(Index storage index, bytes32 id) constant returns (bytes32) {
            Node storage currentNode = index.nodes[id];

            if (currentNode.id == 0x0) {
                // Unknown node, just return 0x0;
                return 0x0;
            }

            Node memory child;

            if (currentNode.left != 0x0) {
                // Trace left to latest child in left tree.
                child = index.nodes[currentNode.left];

                while (child.right != 0) {
                    child = index.nodes[child.right];
                }
                return child.id;
            }

            if (currentNode.parent != 0x0) {
                // Now we trace back up through parent relationships, looking
                // for a link where the child is the right child of it's
                // parent.
                Node storage parent = index.nodes[currentNode.parent];
                child = currentNode;

                while (true) {
                    if (parent.right == child.id) {
                        return parent.id;
                    }

                    if (parent.parent == 0x0) {
                        break;
                    }
                    child = parent;
                    parent = index.nodes[parent.parent];
                }
            }

            // This is the first node, and has no previous node.
            return 0x0;
        }
// Solidity 0.1.6
/// @dev Retrieve the node id of the previous node in the tree.
/// @param index The index that the node is part of.
/// @param id The id for the node to be looked up.
function getNextNode(Index storage index, bytes32 id) constant returns (bytes32) {
            Node storage currentNode = index.nodes[id];

            if (currentNode.id == 0x0) {
                // Unknown node, just return 0x0;
                return 0x0;
            }

            Node memory child;

            if (currentNode.right != 0x0) {
                // Trace right to earliest child in right tree.
                child = index.nodes[currentNode.right];

                while (child.left != 0) {
                    child = index.nodes[child.left];
                }
                return child.id;
            }

            if (currentNode.parent != 0x0) {
                // if the node is the left child of it's parent, then the
                // parent is the next one.
                Node storage parent = index.nodes[currentNode.parent];
                child = currentNode;

                while (true) {
                    if (parent.left == child.id) {
                        return parent.id;
                    }

                    if (parent.parent == 0x0) {
                        break;
                    }
                    child = parent;
                    parent = index.nodes[parent.parent];
                }

                // Now we need to trace all the way up checking to see if any parent is the 
            }

            // This is the final node.
            return 0x0;
        }
// Solidity 0.1.6
/// @dev Returns the first generation id that fully contains the block window provided.
/// @param self The pool to operate on.
/// @param leftBound The left bound for the block window (inclusive)
/// @param rightBound The right bound for the block window (inclusive)
function getGenerationForWindow(Pool storage self, uint leftBound, uint rightBound) constant returns (uint) {
            // TODO: tests
                var left = GroveLib.query(self.generationStart, "<=", int(leftBound));

                if (left != 0x0) {
                    Generation memory leftCandidate = self.generations[StringLib.bytesToUInt(left)];
                    if (leftCandidate.startAt <= leftBound && (leftCandidate.endAt >= rightBound || leftCandidate.endAt == 0)) {
                        return leftCandidate.id;
                    }
                }

                var right = GroveLib.query(self.generationEnd, ">=", int(rightBound));
                if (right != 0x0) {
                    Generation memory rightCandidate = self.generations[StringLib.bytesToUInt(right)];
                    if (rightCandidate.startAt <= leftBound && (rightCandidate.endAt >= rightBound || rightCandidate.endAt == 0)) {
                        return rightCandidate.id;
                    }
                }

                return 0;
        }
// Solidity 0.1.6
/// @dev Returns the first generation that is currently active.
/// @param self The pool to operate on.
function getCurrentGenerationId(Pool storage self) constant returns (uint) {
            // TODO: tests
                var next = GroveLib.query(self.generationEnd, ">", int(block.number));
                if (next != 0x0) {
                    return StringLib.bytesToUInt(next);
                }

                next = GroveLib.query(self.generationStart, "<=", int(block.number));
                if (next != 0x0) {
                    return StringLib.bytesToUInt(next);
                }
                return 0;
        }