function createLiability(
        bytes _demand,
        bytes _offer
    )
        external
        onlyLighthouse
        returns (ILiability liability)
    {
        
        liability = ILiability(liabilityCode.proxy());
        require(Liability(liability).setup(xrt));

        emit NewLiability(liability);

        
        require(address(liability).call(abi.encodePacked(bytes4(0xd9ff764a), _demand))); 
        singletonHash(liability.demandHash());

        require(address(liability).call(abi.encodePacked(bytes4(0xd5056962), _offer))); 
        singletonHash(liability.offerHash());

        
        require(isLighthouse[liability.lighthouse()]);

        
        if (liability.lighthouseFee() > 0)
            xrt.safeTransferFrom(liability.promisor(),
                                 tx.origin,
                                 liability.lighthouseFee());

        
        ERC20 token = ERC20(liability.token());
        if (liability.cost() > 0)
            token.safeTransferFrom(liability.promisee(),
                                   liability,
                                   liability.cost());

        
        if (liability.validator() != 0 && liability.validatorFee() > 0)
            xrt.safeTransferFrom(liability.promisee(),
                                 liability,
                                 liability.validatorFee());
     }