Within four years: 1.An action upon any contract, obligation or liability founded upon an instrument in writing, except as provided in Section 336a of this code; provided, that the time within which any action for a money judgment for the balance due upon an obligation for the payment of which a deed of trust or mortgage with power of sale upon real property or any interest therein was given as security, following the exercise of the power of sale in such deed of trust or mortgage, may be brought shall not extend beyond three months after the time of sale under such deed of trust or mortgage.
2.An action to recover (1) upon a book account whether consisting of one or more entries; (2) upon an account stated based upon an account in writing, but the acknowledgment of the account stated need not be in writing; (3) a balance due upon a mutual, open and current account, the items of which are in writing; provided, however, that where an account stated is based upon an account of one item, the time shall begin to run from the date of said item, and where an account stated is based upon an account of more than one item, the time shall begin to run from the date of the last item.
3.An action based upon the rescission of a contract in writing. The time begins to run from the date upon which the facts that entitle the aggrieved party to rescind occurred. Where the ground for rescission is fraud or mistake, the time does not begin to run until the discovery by the aggrieved party of the facts constituting the fraud or mistake. Where the ground for rescission is misrepresentation under Section 359 of the Insurance Code, the time does not begin to run until the representation becomes false.