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)
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` 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: SecureHash` Unparsed reference to the natural language contract that this code is supposed to express (usually a hash of the contracts contents).

### Functions

checkLegAmounts | `fun checkLegAmounts(legs: Array<CommonLeg>): Unit`
checkLegDates | `fun checkLegDates(legs: Array<CommonLeg>): Unit`
checkRates | `fun checkRates(legs: Array<CommonLeg>): Boolean`
checkSchedules | `fun checkSchedules(legs: Array<CommonLeg>): Boolean`
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: <ERROR CLASS><LocalDate, Rate>): Unit`
getFloatingLegPaymentsDifferences | `fun getFloatingLegPaymentsDifferences(payments1: Map<LocalDate, Event>, payments2: Map<LocalDate, Event>): List<<ERROR CLASS><LocalDate, <ERROR CLASS><FloatingRatePaymentEvent, FloatingRatePaymentEvent>>>` Compares two schedules of Floating Leg Payments, returns the difference (i.e. omissions in either leg or changes to the values).
verify | `fun verify(tx: TransactionForVerification): Unit` verify() with some examples of what needs to be checked.