A general, compositional, and component-based contract theory is proposed for modeling and specifying heterogeneous systems, characterized by consisting of parts from different domains, e.g. software, electrical and mechanical.Given a contract consisting of assumptions and a guarantee, clearly separated conditions on a component and its environment are presented where the conditions ensure that the guarantee is fulfilled - a responsibility assigned to the component, given that the environment fulfills the assumptions. To support both causal and acausal modeling, the conditions are applicable regardless if the set of ports of the component is partitioned into inputs and outputs or not, and hence fully support any scenario where components from different domains are to be integrated by solely relying on the information of a contract. An example of such a scenario of industrial relevanceis explicitly considered, namely a scenario in a supply chainwhere the development of a component is outsourced.To facilitate the application of the theory in practice, necessary properties of contracts are also derived to serve as sanity checks of the conditions. Furthermore, based on a graph that represents a structuring of a hierarchy of contracts, sufficient conditions to achieve compositionality are presented.