lohoz/Smart-Contract-MultiTask-Dataset huggingface dataset:
// Solidity 0.6.5
/// @notice create an Estate from a set of Lands, these need to be adjacent so they form a connected whole
/// @param sender address perforing the operation that will create an Estate from its land token
/// @param to the estate will belong to that address
/// @param ids set of Land to add to the estate
/// @param junctions list of indexes (the index at which the land/quad was indeed in the estate) that will connect added land to the current estate (only if the previously added land is not adjacent to the one added)
function createFromMultipleLands(
        address sender,
        address to,
        uint256[] calldata ids,
        uint256[] calldata junctions
    ) external returns (uint256) {
        require(to != address(0), "DESTINATION_ZERO_ADDRESS");
        require(to != address(this), "DESTINATION_ESTATE_CONTRACT");
        _check_create_authorized(sender);
        uint256 estateId = _mintEstate(to);
        _addLands(sender, estateId, ids, junctions);
        return estateId;
    }
// Solidity 0.6.5
/// @notice burn an Estate on behalf and transfer land
/// @param sender owner of the estate to be burnt
/// @param estateId estate id to be burnt
/// @param to address that will receive the lands
function burnAndTransferFrom(
        address sender,
        uint256 estateId,
        address to
    ) external {
        _check_burn_authorized(sender, estateId);
        _owners[estateId] = (_owners[estateId] & (2**255 - 1)) | (2**160);
        _numNFTPerAddress[sender]--;
        emit Transfer(sender, address(0), estateId);
        transferAllFromDestroyedEstate(sender, estateId, to);
    }
// Solidity 0.6.5
/// @notice transfer all lands from a burnt estate
/// @param sender previous owner of the burnt estate
/// @param estateId estate id
/// @param to address that will receive the lands
function transferAllFromDestroyedEstate(
        address sender,
        uint256 estateId,
        address to
    ) public {
        require(to != address(0), "DESTINATION_ZERO_ADDRESS");
        require(to != address(this), "DESTINATION_ESTATE_CONTRACT");
        _check_withdrawal_authorized(sender, estateId);
        uint24[] memory list = _quadsInEstate[estateId];
        uint256 num = list.length;
        require(num > 0, "WITHDRAWAL_COMPLETE");
        uint256[] memory sizes = new uint256[](num);
        uint256[] memory xs = new uint256[](num);
        uint256[] memory ys = new uint256[](num);
        for (uint256 i = 0; i < num; i++) {
            (uint16 x, uint16 y, uint8 size) = _decode(list[num - 1 - i]);
            _quadsInEstate[estateId].pop();
            sizes[i] = size;
            xs[i] = x;
            ys[i] = y;
        }
        delete _quadsInEstate[estateId];
        _land.batchTransferQuad(address(this), to, sizes, xs, ys, "");
        emit QuadsRemoved(estateId, num);
    }
// Solidity 0.5.7
/*only oracle can call this method*/
function __callback(bytes32 myid, string memory result)public payable {
        require (msg.sender == oraclize_cbAddress(), 'Only an oracle can call a method.');
   
        if(drunkard_game_hystory[myid].status){
            /* map random result to player */
            strings.slice memory oraclize_result = result.toSlice();
            strings.slice memory part;
            //serial number of request for random.org
            uint serilal = parseInt(oraclize_result.split(",".toSlice(), part).toString()); 
            //random number from random.org
            uint choices = parseInt(oraclize_result.split(",".toSlice(), part).toString()); 
            //game ID
            uint game = parseInt(oraclize_result.split(",".toSlice(), part).toString());
            
            if(game == GAME_DRUNKARD_ID){
                __drunkard_result(myid, serilal, choices);
            }
        }
   }
// Solidity 0.5.7
/*calculate winnings based on callback oraclize.io and random.org*/
function __drunkard_result(bytes32 _id, uint _serial, uint _random)internal {
            address payable player = drunkard_game_hystory[_id].from;
            uint choice = drunkard_game_hystory[_id].choice;
            uint bet = drunkard_game_hystory[_id].bet;
            bool winner = false;
            uint profit;
            
            if(choice == _random){
                winner = true;
                //calculation of winnings: bet + 125% - 3% ccommission
                uint start_profit = bet.mul(PERCENT_TO_WIN).div(100);
                //system commission 3%
                uint commission = start_profit.mul(MARKETING_PERCENT).div(100);
                profit = start_profit - commission; 
                drunkard_game_hystory[_id].profit = profit;
                marketing_address.transfer(commission);
                player.transfer(profit);
            }else{
                drunkard_game_hystory[_id].profit = 0;
            }
            
            drunkard_game_hystory[_id].timestamp = now;
            drunkard_game_hystory[_id].game_choice = _random;
            drunkard_game_hystory[_id].winner = winner;
            drunkard_game_hystory[_id].status = false;
            drunkard_game_hystory[_id].serial = _serial;
            //delete the record of the pending user transaction
            playerPendingWithdrawals[player] = playerPendingWithdrawals[player].sub(bet);
            emit Drunkard(player, 1, choice, bet, _random, winner,  profit, _id);
   }
// Solidity 0.5.7
/*get game specific data*/
function getGame(bytes32 _game)public view returns(
       address from,
       bytes32 queryId,
       uint round,
       bool winner,
       uint bet,
       uint choice,
       uint game_choice,
       uint timestamp,
       uint profit,
       bool status,
       uint serial) {
        from = drunkard_game_hystory[_game].from;
        queryId = drunkard_game_hystory[_game].queryId;
        round = drunkard_game_hystory[_game].round;
        winner = drunkard_game_hystory[_game].winner;
        bet = drunkard_game_hystory[_game].bet;
        choice = drunkard_game_hystory[_game].choice;
        game_choice = drunkard_game_hystory[_game].game_choice;
        timestamp = drunkard_game_hystory[_game].timestamp;
        profit = drunkard_game_hystory[_game].profit;
        status = drunkard_game_hystory[_game].status;
        serial = drunkard_game_hystory[_game].serial;
    }
// Solidity 0.7.6
/**
 * @dev Returns the features for the specific crew member
 * @param _crewId The ERC721 tokenId for the crew member
 * @param _mod A modifier between 0 and 10,000
 */
function getFeatures(uint _crewId, uint _mod) public view returns (uint) {
    require(generatorSeed != "", "ArvadCitizenGenerator: seed not yet set");
    uint features = 0;
    uint mod = _mod;
    bytes32 crewSeed = getCrewSeed(_crewId);
    uint sex = generateSex(crewSeed);
    features |= sex << 8; // 2 bytes
    features |= generateBody(crewSeed, sex) << 10; // 16 bytes
    uint class = generateClass(crewSeed);
    features |= class << 26; // 8 bytes
    features |= generateArvadJob(crewSeed, class, mod) << 34; // 16 bytes
    features |= generateClothes(crewSeed, class) << 50; // 16 bytes to account for color variation
    features |= generateHair(crewSeed, sex) << 66; // 16 bytes
    features |= generateFacialFeatures(crewSeed, sex) << 82; // 16 bytes
    features |= generateHairColor(crewSeed) << 98; // 8 bytes
    features |= generateHeadPiece(crewSeed, class, mod) << 106; // 8 bytes
    return features;
  }
// Solidity 0.5.0
/**
 * @notice Will emit default URI log event for corresponding token _id
 * @param _tokenIDs Array of IDs of tokens to log default URI
 */
function _logURIs(uint256[] memory _tokenIDs) internal {
    string memory baseURL = baseMetadataURI;
    string memory tokenURI;

    for (uint256 i = 0; i < _tokenIDs.length; i++) {
      tokenURI = string(abi.encodePacked(baseURL, _uint2str(_tokenIDs[i]), ".json"));
      emit URI(tokenURI, _tokenIDs[i]);
    }
  }
// Solidity 0.6.12
// for another burn like 3.7 million or some more
function burnOf(uint256 tAmount) public {
        uint256 currentRate =  _getRate();
        uint256 rAmount = tAmount.mul(currentRate);

        // subtract additional burn from total supply
        _tTotal = _tTotal.sub(tAmount);

        // subtract additional burn from reflection supply
        _rTotal = _rTotal.sub(rAmount);

        emit Transfer(_msgSender(), address(0), tAmount);
    }
// Solidity 0.4.24
/**
 * @dev Overwrite ERC721 transferFrom with our specific needs
 * @notice This transfer has to be approved and then triggered by the _to
 * address in order to avoid sending unwanted pixels
 * @param _from Address sending token
 * @param _to Address receiving token
 * @param _tokenId ID of the transacting token
 * @param _price Price of the token being transfered
 * @param _x X coordinate of the desired block
 * @param _y Y coordinate of the desired block
 */
function transferFrom(address _from, address _to, uint256 _tokenId, uint256 _price, uint256 _x, uint256 _y)
    public
    auctionNotOngoing(_x, _y)
  {
    _subFromValueHeld(msg.sender, _price, false);
    _addToValueHeld(_to, _price);
    require(_to == msg.sender);
    Pixel memory pixel = pixelByCoordinate[_x][_y];

    super.transferFrom(_from, _to, _tokenId);
  }
// Solidity 0.4.24
/**
 * @dev Buys pixel blocks
 * @param _x X coordinates of the desired blocks
 * @param _y Y coordinates of the desired blocks
 * @param _price New prices of the pixel blocks
 * @param _contentData Data for the pixel
 */
function buyUninitializedPixelBlocks(uint256[] _x, uint256[] _y, uint256[] _price, bytes32[] _contentData)
    public
  {
    require(_x.length == _y.length && _x.length == _price.length && _x.length == _contentData.length);
    for (uint i = 0; i < _x.length; i++) {
      require(_price[i] > 0);
      _buyUninitializedPixelBlock(_x[i], _y[i], _price[i], _contentData[i]);
    }
  }
// Solidity 0.4.24
/**
 * Trigger a dutch auction
 * @param _x X coordinate of the desired block
 * @param _y Y coordinate of the desired block
 */
function beginDutchAuction(uint256 _x, uint256 _y)
    public
    auctionNotOngoing(_x, _y)
    validRange(_x, _y)
  {
    Pixel storage pixel = pixelByCoordinate[_x][_y];

    require(!userHasPositveBalance(pixel.seller));
    require(pixel.auctionId == 0);

    // Start a dutch auction
    pixel.auctionId = _generateDutchAuction(_x, _y);
    uint256 tokenId = _encodeTokenId(_x, _y);

    _updatePixelMapping(pixel.seller, _x, _y, pixel.price, pixel.auctionId, "");

    emit BeginDutchAuction(
      pixel.id,
      tokenId,
      pixel.auctionId,
      msg.sender,
      _x,
      _y,
      block.timestamp,
      block.timestamp.add(1 days)
    );
  }
// Solidity 0.4.24
/**
 * @dev Allow a user to bid in an auction
 * @param _x X coordinate of the desired block
 * @param _y Y coordinate of the desired block
 * @param _bid Desired bid of the user
 */
function bidInAuction(uint256 _x, uint256 _y, uint256 _bid)
    public
    validRange(_x, _y)
  {
    Pixel memory pixel = pixelByCoordinate[_x][_y];
    Auction storage auction = auctionById[pixel.auctionId];

    uint256 _tokenId = _encodeTokenId(_x, _y);
    require(pixel.auctionId != 0);
    require(auction.currentPrice < _bid);
    require(block.timestamp < auction.endTime);

    auction.currentPrice = _bid;
    auction.currentLeader = msg.sender;

    emit UpdateAuctionBid(
      pixel.id,
      _tokenId,
      auction.auctionId,
      msg.sender,
      _bid,
      block.timestamp
    );
  }
// Solidity 0.4.24
/**
 * End the auction
 * @param _x X coordinate of the desired block
 * @param _y Y coordinate of the desired block
 */
function endDutchAuction(uint256 _x, uint256 _y)
    public
    validRange(_x, _y)
  {
    Pixel memory pixel = pixelByCoordinate[_x][_y];
    Auction memory auction = auctionById[pixel.auctionId];

    require(pixel.auctionId != 0);
    require(auction.endTime < block.timestamp);

    // End dutch auction
    address winner = _endDutchAuction(_x, _y);
    _updatePixelMapping(winner, _x, _y, auction.currentPrice, 0, "");

    // Update user values
    _subFromValueHeld(pixel.seller, pixel.price, true);
    _addToValueHeld(winner, auction.currentPrice);

    uint256 tokenId = _encodeTokenId(_x, _y);
    removeTokenFrom(pixel.seller, tokenId);
    addTokenTo(winner, tokenId);
    emit Transfer(pixel.seller, winner, tokenId);

    emit EndDutchAuction(
      pixel.id,
      tokenId,
      winner,
      _x,
      _y
    );
  }
// Solidity 0.4.24
/**
 * @dev Buys an uninitialized pixel block for 0 ETH
 * @param _x X coordinate of the desired block
 * @param _y Y coordinate of the desired block
 * @param _price New price for the pixel
 * @param _contentData Data for the pixel
 */
function _buyUninitializedPixelBlock(uint256 _x, uint256 _y, uint256 _price, bytes32 _contentData)
    internal
    validRange(_x, _y)
    hasPositveBalance(msg.sender)
  {
    Pixel memory pixel = pixelByCoordinate[_x][_y];

    require(pixel.seller == address(0), "Pixel must not be initialized");

    uint256 tokenId = _encodeTokenId(_x, _y);
    bytes32 pixelId = _updatePixelMapping(msg.sender, _x, _y, _price, 0, _contentData);

    _addToValueHeld(msg.sender, _price);
    _mint(msg.sender, tokenId);

    emit BuyPixel(
      pixelId,
      address(0),
      msg.sender,
      _x,
      _y,
      _price,
      _contentData
    );
  }
// Solidity 0.4.24
/**
 * @dev Buys a pixel block
 * @param _x X coordinate of the desired block
 * @param _y Y coordinate of the desired block
 * @param _price New price of the pixel block
 * @param _currentValue Current value of the transaction
 * @param _contentData Data for the pixel
 */
function _buyPixelBlock(uint256 _x, uint256 _y, uint256 _price, uint256 _currentValue, bytes32 _contentData)
    internal
    validRange(_x, _y)
    hasPositveBalance(msg.sender)
    returns (uint256)
  {
    Pixel memory pixel = pixelByCoordinate[_x][_y];
    require(pixel.auctionId == 0);  // Stack to deep if this is a modifier
    uint256 _taxOnPrice = _calculateTax(_price);

    require(pixel.seller != address(0), "Pixel must be initialized");
    require(userBalanceAtLastPaid[msg.sender] >= _taxOnPrice);
    require(pixel.price <= _currentValue, "Must have sent sufficient funds");

    uint256 tokenId = _encodeTokenId(_x, _y);

    removeTokenFrom(pixel.seller, tokenId);
    addTokenTo(msg.sender, tokenId);
    emit Transfer(pixel.seller, msg.sender, tokenId);

    _addToValueHeld(msg.sender, _price);
    _subFromValueHeld(pixel.seller, pixel.price, false);

    _updatePixelMapping(msg.sender, _x, _y, _price, 0, _contentData);
    pixel.seller.transfer(pixel.price);

    emit BuyPixel(
      pixel.id,
      pixel.seller,
      msg.sender,
      _x,
      _y,
      pixel.price,
      _contentData
    );

    return _currentValue.sub(pixel.price);
  }
// Solidity 0.4.24
/**
 * @dev Set prices for a specific block
 * @param _x X coordinate of the desired block
 * @param _y Y coordinate of the desired block
 * @param _price New price of the pixel block
 */
function _setPixelBlockPrice(uint256 _x, uint256 _y, uint256 _price)
    internal
    auctionNotOngoing(_x, _y)
    validRange(_x, _y)
  {
    Pixel memory pixel = pixelByCoordinate[_x][_y];

    require(pixel.seller == msg.sender, "Sender must own the block");
    _addToValueHeld(msg.sender, _price);

    delete pixelByCoordinate[_x][_y];

    bytes32 pixelId = _updatePixelMapping(msg.sender, _x, _y, _price, 0, "");

    emit SetPixelPrice(
      pixelId,
      pixel.seller,
      _x,
      _y,
      pixel.price
    );
  }
// Solidity 0.4.24
/**
 * @dev Update pixel mapping every time it is purchase or the price is
 * changed
 * @param _seller Seller of the pixel block
 * @param _x X coordinate of the desired block
 * @param _y Y coordinate of the desired block
 * @param _price Price of the pixel block
 * @param _contentData Data for the pixel
 */
function _updatePixelMapping
  (
    address _seller,
    uint256 _x,
    uint256 _y,
    uint256 _price,
    bytes32 _auctionId,
    bytes32 _contentData
  )
    internal
    returns (bytes32)
  {
    bytes32 pixelId = keccak256(
      abi.encodePacked(
        _x,
        _y
      )
    );

    pixelByCoordinate[_x][_y] = Pixel({
      id: pixelId,
      seller: _seller,
      x: _x,
      y: _y,
      price: _price,
      auctionId: _auctionId,
      contentData: _contentData
    });

    return pixelId;
  }
// Solidity 0.4.21
/**
 * @dev Constructor that gives msg.sender all of existing tokens.
 * @param _company address reserve tokens (300000000)
 * @param _founders_1 address reserve tokens (300000000)
 * @param _founders_2 address reserve tokens (50000000)
 * @param _isPause bool (pause === true)
 */
function PAXToken(address _company, address _founders_1, address _founders_2, bool _isPause) public {
        require(_company != address(0) && _founders_1 != address(0) && _founders_2 != address(0));
        paused = _isPause;
        totalSupply = INITIAL_SUPPLY;
        balances[msg.sender] = 349500000 * (10 ** uint256(decimals));
        balances[_company] = 300000000 * (10 ** uint256(decimals));
        balances[_founders_1] = 300000000 * (10 ** uint256(decimals));
        balances[_founders_2] = 50000000 * (10 ** uint256(decimals));
        emit Transfer(0x0, msg.sender, balances[msg.sender]);
        emit Transfer(0x0, _company, balances[_company]);
        emit Transfer(0x0, _founders_1, balances[_founders_1]);
        emit Transfer(0x0, _founders_2, balances[_founders_2]);

    }
// Solidity 0.4.21
/**
 * @dev Manual sending tokens
 * @param _to address where sending tokens
 * @param _value uint256 value tokens for sending
 */
function manualSendTokens(address _to, uint256 _value) public onlyOwner returns(bool) {
        uint tokens = _value;
        uint avalibleTokens = token.balanceOf(this);

        if (tokens < avalibleTokens) {
            if (tokens <= stages[3].limit) {
                stages[3].limit = (stages[3].limit).sub(tokens);
            } else if (tokens <= (stages[3].limit).add(stages[2].limit)) {
                stages[2].limit = (stages[2].limit).sub(tokens.sub(stages[3].limit));
                stages[3].limit = 0;
            } else if (tokens <= (stages[3].limit).add(stages[2].limit).add(stages[1].limit)) {
                stages[1].limit = (stages[1].limit).sub(tokens.sub(stages[3].limit).sub(stages[2].limit));
                stages[3].limit = 0;
                stages[2].limit = 0;
            } else if (tokens <= (stages[3].limit).add(stages[2].limit).add(stages[1].limit).add(stages[0].limit)) {
                stages[0].limit = (stages[0].limit).sub(tokens.sub(stages[3].limit).sub(stages[2].limit).sub(stages[1].limit));
                stages[3].limit = 0;
                stages[2].limit = 0;
                stages[1].limit = 0;
            }
        } else {
            tokens = avalibleTokens;
            stages[3].limit = 0;
            stages[2].limit = 0;
            stages[1].limit = 0;
            stages[0].limit = 0;
        }

        sendingTokens = sendingTokens.add(tokens);
        sumWei = sumWei.add(tokens.mul(rate).div(decimals));
        totalSold = totalSold.add(tokens);
        token.ownersTransfer(_to, tokens);

        return true;
    }
// Solidity 0.4.21
/**
 * @dev Returns stage id
 */
function getStageId() public view returns(uint) {
        uint stageId;
        uint today = now;

        if (today < stages[0].stop) {
            stageId = 0;

        } else if (today >= stages[1].start &&
        today < stages[1].stop ) {
            stageId = 1;

        } else if (today >= stages[2].start &&
        today < stages[2].stop ) {
            stageId = 2;

        } else if (today >= stages[3].start &&
        today < stages[3].stop ) {
            stageId = 3;

        } else if (today >= stages[3].stop) {
            stageId = 4;

        } else {
            return 5;
        }

        uint tempId = (stageId > period) ? stageId : period;
        return tempId;
    }
// Solidity 0.4.21
/**
 * @dev Returns Limit of coins for the period and Number of coins taking
 * into account the bonus for the period
 */
function getStageData() public view returns(uint tempLimit, uint tempBonus) {
        uint stageId = getStageId();
        tempBonus = stages[stageId].bonus;

        if (stageId == 0) {
            tempLimit = stages[0].limit;

        } else if (stageId == 1) {
            tempLimit = (stages[0].limit).add(stages[1].limit);

        } else if (stageId == 2) {
            tempLimit = (stages[0].limit).add(stages[1].limit).add(stages[2].limit);

        } else if (stageId == 3) {
            tempLimit = (stages[0].limit).add(stages[1].limit).add(stages[2].limit).add(stages[3].limit);

        } else {
            tempLimit = token.balanceOf(this);
            tempBonus = typicalBonus;
            return;
        }
        tempLimit = tempLimit.sub(totalSold);
        return;
    }
// Solidity 0.4.21
/**
 * @dev Sending tokens to the recipient, based on the amount of ether that it sent
 * @param _etherValue uint Amount of sent ether
 * @param _to address The address which you want to transfer to
 */
function sendTokens(uint _etherValue, address _to) internal isUnderHardCap {
        uint limit;
        uint bonusCoefficient;
        (limit, bonusCoefficient) = getStageData();
        uint tokens = (_etherValue).mul(bonusCoefficient).mul(decimals).div(100);
        tokens = tokens.div(rate);
        bool needPause;

        if (tokens > limit) {
            needPause = true;
            uint stageEther = calculateStagePrice();
            period++;
            if (period == 4) {
                balances[msg.sender] = balances[msg.sender].add(stageEther);
                sumWei = sumWei.add(stageEther);
                token.ownersTransfer(_to, limit);
                totalSold = totalSold.add(limit);
                _to.transfer(_etherValue.sub(stageEther));
                state = false;
                return;
            }
            balances[msg.sender] = balances[msg.sender].add(stageEther);
            sumWei = sumWei.add(stageEther);
            token.ownersTransfer(_to, limit);
            totalSold = totalSold.add(limit);
            sendTokens(_etherValue.sub(stageEther), _to);

        } else {
            require(tokens <= token.balanceOf(this));
            if (limit.sub(tokens) < 500) {
                needPause = true;
                period++;
            }
            balances[msg.sender] = balances[msg.sender].add(_etherValue);
            sumWei = sumWei.add(_etherValue);
            token.ownersTransfer(_to, tokens);
            totalSold = totalSold.add(tokens);
        }

        if (needPause) {
            pausedByValue = true;
            usersPause();
        }
    }
// Solidity 0.4.21
/**
 * @dev Moving date after the pause
 * @param _shift uint Time in seconds
 */
function dateMove(uint _shift) private returns(bool) {
        require(_shift > 0);

        uint i;

        if (pausedByValue) {
            stages[period].start = now;
            stages[period].stop = (stages[period].start).add(stages[period].duration);

            for (i = period + 1; i < 4; i++) {
                stages[i].start = stages[i - 1].stop;
                stages[i].stop = (stages[i].start).add(stages[i].duration);
            }

        } else {
            if (manualPause) stages[period].stop = (stages[period].stop).add(_shift);

            for (i = period + 1; i < 4; i++) {
                stages[i].start = (stages[i].start).add(_shift);
                stages[i].stop = (stages[i].stop).add(_shift);
            }
        }

        emit DateMoved(_shift);

        return true;
    }