functions or send Ether)
        
        
        
        
        
        
        
        
        
        

        Auction storage auction = tokenIdToAuction[_tokenId];

        
        require(auction.endTime < block.timestamp);
        require(auction.live); 

        
        auction.live = false;
        AuctionEnded(_tokenId, auction.highestBidder, auction.highestBid);

        
        address owner = pixelIndexToOwner[_tokenId];
        
        uint amount = auction.highestBid * 9 / 10;
        pendingReturns[owner] += amount;
        authorityBalance += (auction.highestBid - amount);
        
        _transfer(owner, auction.highestBidder, _tokenId);

       
    }

    
    event AuctionStarted(uint256 _tokenId);
    event HighestBidIncreased(uint256 _tokenId, address bidder, uint amount);
    event AuctionEnded(uint256 _tokenId, address winner, uint amount);


    
    
    function getAuction(uint256 _tokenId)
        external
        view
        returns
    (
        address highestBidder,
        uint highestBid,
        uint endTime,
        bool live
    ) {
        Auction storage auction = tokenIdToAuction[_tokenId];
        return (
            auction.highestBidder,
            auction.highestBid,
            auction.endTime,
            auction.live
        );
    }

    
    
    function getHighestBid(uint256 _tokenId)
        external
        view
        returns (uint256)
    {
        Auction storage auction = tokenIdToAuction[_tokenId];
        return auction.highestBid;
    }
}





contract PixelCore is PixelAuction {

    
    address public newContractAddress;

    
    function PixelCore() public {
        
        authorityAddress = msg.sender;
    }

    
    
    
    
    
    
    function setNewAddress(address _v2Address) external onlyAuthority {
        newContractAddress = _v2Address;
        ContractUpgrade(_v2Address);
    }

    
    function withdrawBalance() external onlyAuthority returns (bool) {
        uint amount = authorityBalance;
        if (amount > 0) {
            authorityBalance = 0;
            if (!authorityAddress.send(amount)) {
                authorityBalance = amount;
                return false;
            }
        }