com.r3corda.contracts / InterestRateSwap

# InterestRateSwap

`class InterestRateSwap : Contract`

The Interest Rate Swap class. For a quick overview of what an IRS is, see here - http://www.pimco.co.uk/EN/Education/Pages/InterestRateSwapsBasics1-08.aspx (no endorsement). This contract has 4 significant data classes within it, the "Common", "Calculation", "FixedLeg" and "FloatingLeg". It also has 4 commands, "Agree", "Fix", "Pay" and "Mature". Currently, we are not interested (excuse pun) in valuing the swap, calculating the PVs, DFs and all that good stuff (soon though). This is just a representation of a vanilla Fixed vs Floating (same currency) IRS in the R3 prototype model.

### Types

Calculation | `data class Calculation` The Calculation data class is "mutable" through out the life of the swap, as in, its the only thing that contains data that will changed from state to state (Recall that the design insists that everything is immutable, so we actually copy / update for each transition).
Clauses | `interface Clauses`
Commands | `interface Commands : CommandData`
Common | `data class Common` This Common area contains all the information that is not leg specific.
CommonLeg | `abstract class CommonLeg`
FixedLeg | `class FixedLeg : CommonLeg`
FloatingLeg | `class FloatingLeg : CommonLeg`
State | `data class State : FixableDealState, SchedulableState` The state class contains the 4 major data classes.

### Constructors

<init> | `InterestRateSwap()` The Interest Rate Swap class. For a quick overview of what an IRS is, see here - http://www.pimco.co.uk/EN/Education/Pages/InterestRateSwapsBasics1-08.aspx (no endorsement). This contract has 4 significant data classes within it, the "Common", "Calculation", "FixedLeg" and "FloatingLeg". It also has 4 commands, "Agree", "Fix", "Pay" and "Mature". Currently, we are not interested (excuse pun) in valuing the swap, calculating the PVs, DFs and all that good stuff (soon though). This is just a representation of a vanilla Fixed vs Floating (same currency) IRS in the R3 prototype model.

### Properties

legalContractReference | `val legalContractReference: <ERROR CLASS>` Unparsed reference to the natural language contract that this code is supposed to express (usually a hash of the contracts contents).

### Functions

generateAgreement | `fun generateAgreement(floatingLeg: FloatingLeg, fixedLeg: FixedLeg, calculation: Calculation, common: Common, notary: Party): TransactionBuilder` This generates the agreement state and also the schedules from the initial data. Note: The day count, interest rate calculation etc are not finished yet, but they are demonstrable.
generateFix | `fun generateFix(tx: TransactionBuilder, irs: StateAndRef<State>, fixing: Fix): Unit`
verify | `fun verify(tx: TransactionForContract): Unit` Takes an object that represents a state transition, and ensures the inputs/outputs/commands make sense. Must throw an exception if theres a problem that should prevent state transition. Takes a single object rather than an argument so that additional data can be added without breaking binary compatibility with existing contract code.

### Companion Object Properties

oracleType | `val oracleType: ServiceType`