contract ArtworkCore is ArtworkMinting {

    // Set in case the core contract is broken and an upgrade is required
    address public newContractAddress;

    /// @notice Creates the main Pixelicu smart contract instance.
    function ArtworkCore() public {
        // Starts paused.
        paused = true;

        // the creator of the contract is the initial CEO
        ceoAddress = msg.sender;

        // the creator of the contract is also the initial COO
        cooAddress = msg.sender;

        // start with the mythical artwork 0 - so we don't have generation-0 parent issues
        // we'll do this manually 
    }

    /// @dev Used to mark the smart contract as upgraded, in case there is a serious
    ///  breaking bug. This method does nothing but keep track of the new contract and
    ///  emit a message indicating that the new address is set. It's up to clients of this
    ///  contract to update to the new contract address in that case. (This contract will
    ///  be paused indefinitely if such an upgrade takes place.)
    /// @param _v2Address new address
    function setNewAddress(address _v2Address) external onlyCEO whenPaused {
        // See README.md for updgrade plan
        newContractAddress = _v2Address;
        ContractUpgrade(_v2Address);
    }

    /// @notice No tipping!
    /// @dev Reject all Ether from being sent here, unless it's from one of the
    ///  two auction contracts. (Hopefully, we can prevent user accidents.)
    function() external payable {
          require(
            msg.sender == address(saleAuction) ||
            msg.sender == address(couplingAuction)
        );
    }

    /// @notice Returns all the relevant information about a specific artwork.
    /// @param _id The ID of the artwork of interest.
    function getArtwork(uint256 _id)
        external
        view
        returns (
        uint256 birthTime,
        address creatorId,
        bytes artworkContent
    ) {
        Artwork storage art = artworks[_id];
        birthTime = uint256(art.birthTime);
        creatorId = art.creatorId;
        artworkContent = art.artworkContent;
    }

    /// @dev Override unpause so it requires all external contract addresses
    ///  to be set before contract can be unpaused. Also, we can't have
    ///  newContractAddress set either, because then the contract was upgraded.
    /// @notice This is public rather than external so we can call super.unpause
    ///  without using an expensive CALL.
    function unpause() public payable onlyCEO whenPaused {
        require(saleAuction != address(0));
        require(couplingAuction != address(0));
        require(newContractAddress == address(0));

        // Actually unpause the contract.
        super.unpause();
    }
    
   

    // @dev Allows the CFO to capture the balance available to the contract.
    function withdrawBalance() external onlyCFO {
        uint256 balance = this.balance;
        // Subtract all the currently pregnant artworks we have, plus 1 of margin.
        cfoAddress.transfer(balance);
    }
}
/// @title Pixelicu: Collectible artworks on the Ethereum blockchain.
/// @dev The main Pixelicu contract, keeps track of artworks
function ArtworkCore() public {
    // Starts paused.
    paused = true;

    // the creator of the contract is the initial CEO
    ceoAddress = msg.sender;

    // the creator of the contract is also the initial COO
    cooAddress = msg.sender;

    // start with the mythical artwork 0 - so we don't have generation-0 parent issues
    // we'll do this manually 
}

/// @notice Creates the main Pixelicu smart contract instance.