 It may arise [1] from a primary obligation under a contract, such as a contract of insurance; [2] from a secondary obligation arising out of nonperformance of a contract, such as a right to damages, either liquidated, as under the demurrage clause in a charter party, or unliquidated; [3] from an obligation to pay damages for tort ...