function ratifyOrder(SpentItem[] calldata offer, ReceivedItem[] calldata consideration, bytes calldata context, bytes32[] calldata, uint256 contractNonce)
	external
	checkStage(Enums.Stage.ratify, Enums.Stage.generate)
	onlySeaport(msg.sender)
	returns (bytes4)
{
	Helpers.processNonce(nonce, contractNonce);
	Helpers.verifyCreate(delegateToken, offer[0].identifier, transientState.receivers, consideration[0], context);
	return this.ratifyOrder.selector;
}
function processNonce(CreateOffererStructs.Nonce storage nonce, uint256 contractNonce) internal {
	if (nonce.value != contractNonce) revert CreateOffererErrors.InvalidContractNonce(nonce.value, contractNonce);
	unchecked {
		++nonce.value;
	} // Infeasible this will overflow if starting point is zero
}
library CreateOffererStructs {
    /// @notice Used to track the stage and lock status
    struct Stage {
        CreateOffererEnums.Stage flag;
        CreateOffererEnums.Lock lock;
    }

    /// @notice Used to keep track of the seaport contract nonce of CreateOfferer
    struct Nonce {
        uint256 value;
    }
{
	// Do a low-level call to get success status and any return data.
	(bool success, bytes memory returnData) = _callGenerateOrder(
		orderParameters,
		context,
		originalOfferItems,
		originalConsiderationItems
	);

	{
		// Increment contract nonce and use it to derive order hash.
		// Note: nonce will be incremented even for skipped orders, and
		// even if generateOrder's return data doesn't meet constraints.
		uint256 contractNonce = (
			_contractNonces[orderParameters.offerer]++
		);

		// Derive order hash from contract nonce and offerer address.
		orderHash = bytes32(
			contractNonce ^
				(uint256(uint160(orderParameters.offerer)) << 96)
		);
	}
// Increment contract nonce and use it to derive order hash.
// Note: nonce will be incremented even for skipped orders, and
// even if generateOrder's return data doesn't meet constraints.
uint256 contractNonce = (
	_contractNonces[orderParameters.offerer]++
);
 return _revertOrReturnEmpty(revertOnInvalid, orderHash);
function _revertOrReturnEmpty(
	bool revertOnInvalid,
	bytes32 contractOrderHash
)
	internal
	pure
	returns (
		bytes32 orderHash,
		uint256 numerator,
		uint256 denominator,
		OrderToExecute memory emptyOrder
	)
{
	// If invalid input should not revert...
	if (!revertOnInvalid) {
		// Return the contract order hash and zero values for the numerator
		// and denominator.
		return (contractOrderHash, 0, 0, emptyOrder);
	}

	// Otherwise, revert.
	revert InvalidContractOrder(contractOrderHash);
}
    function _fulfillAvailableAdvancedOrders(
        AdvancedOrder[] memory advancedOrders,
        CriteriaResolver[] memory criteriaResolvers,
        FulfillmentComponent[][] memory offerFulfillments,
        FulfillmentComponent[][] memory considerationFulfillments,
        bytes32 fulfillerConduitKey,
        address recipient,
        uint256 maximumFulfilled
    ) internal returns (bool[] memory, /* availableOrders */ Execution[] memory /* executions */ ) {
        // Validate orders, apply amounts, & determine if they use conduits.
        (bytes32[] memory orderHashes, bool containsNonOpen) = _validateOrdersAndPrepareToFulfill(
            advancedOrders,
            criteriaResolvers,
            false, // Signifies that invalid orders should NOT revert.
            maximumFulfilled,
            recipient
        );
// Validate it, update status, and determine fraction to fill.
(bytes32 orderHash, uint256 numerator, uint256 denominator) =
_validateOrderAndUpdateStatus(advancedOrder, revertOnInvalid);
  // If the order is a contract order, return the generated order.
	if (orderParameters.orderType == OrderType.CONTRACT) {
		// Ensure that the numerator and denominator are both equal to 1.
		assembly {
			// (1 ^ nd =/= 0) => (nd =/= 1) => (n =/= 1) || (d =/= 1)
			// It's important that the values are 120-bit masked before
			// multiplication is applied. Otherwise, the last implication
			// above is not correct (mod 2^256).
			invalidFraction := xor(mul(numerator, denominator), 1)
		}

		// Revert if the supplied numerator and denominator are not valid.
		if (invalidFraction) {
			_revertBadFraction();
		}

		// Return the generated order based on the order params and the
		// provided extra data. If revertOnInvalid is true, the function
		// will revert if the input is invalid.
		return _getGeneratedOrder(orderParameters, advancedOrder.extraData, revertOnInvalid);
	}
 if (nonce.value != contractNonce) revert CreateOffererErrors.InvalidContractNonce(nonce.value, contractNonce);
if (
ContractOffererInterface(offerer).ratifyOrder(
orderToExecute.spentItems,
orderToExecute.receivedItems,
advancedOrder.extraData,
orderHashes,
uint256(orderHash) ^ (uint256(uint160(offerer)) << 96)
) != ContractOffererInterface.ratifyOrder.selector
)
