A contract is discharged when both parties have performed their obligations under the contract. For example, if A agrees to build a house for B for $150,000 the consideration for the promise is indivisible. That means that by only completing part, the contract fails completely. A cannot sue on the basis of quantum meruit because of the express promise to build a complete house for $50,000. It is impossible to imply a promise by B to pay A a reasonable sum for work carried out.