Contract curve is the locus of all Pareto optimal allocations in a general equilibrium model. The allocations which are Pareto optimal for both consumer A and B can be found on the points where their indifference curves are tangent to each other. This implies that at the points of contract curve the indifference curves of consumer A and B must have same slope or in terms of economics, for Pareto optimal allocations, the marginal rate of substitution for A and B should be equal.
For Pareto optimal allocations:
To be points on contract curves the allocations should also be feasible. Thus, we also require the feasibility condition, which states that the sum of allocation of good i with A and B must be equal to the sum of endowment of good i with both A and B