<h2>Contracts<aclass="headerlink"href="#contracts"title="Permalink to this headline">¶</a></h2>
<p>The primary goal of this prototype is to implement various kinds of contracts and verify that useful business logic
can be expressed with the data model, developing and refining an API along the way. To that end there are currently
two contracts in the repository:</p>
<olclass="arabic simple">
<li>Cash</li>
<li>Commercial paper</li>
</ol>
<p><codeclass="docutils literal"><spanclass="pre">Cash</span></code> implements the idea of a claim on some quantity of deposits at some institutional party, denominated in some currency,
identified by some <em>deposit reference</em>. A deposit reference is an opaque byte array which is usable by
the issuing party for internal bookkeeping purposes.</p>
<p>Cash states are <em>fungible</em> with each other (can be merged and split arbitrarily) if they use the same currency,
party and deposit reference.</p>
<p><codeclass="docutils literal"><spanclass="pre">CommercialPaper</span></code> implements an asset with a <em>face value</em> denominated in a certain currency, which may be redeemed at
the issuing party after a certain time. Commercial paper states define the face value (e.g. $1000) and the time
at which they may be redeemed. The contract allows the paper to be issued, traded and redeemed. The commercial paper
contract is implemented twice, once in Java and once in a language called Kotlin.</p>
<p>Each contract comes with unit tests.</p>
</div>
<divclass="section"id="kotlin">
<h2>Kotlin<aclass="headerlink"href="#kotlin"title="Permalink to this headline">¶</a></h2>
<p>The prototype is written in a language called <aclass="reference external"href="https://kotlinlang.org/">Kotlin</a>. Kotlin is a language that targets the JVM
and can be thought of as a simpler Scala, with much better Java interop. It is developed by and has commercial support
from JetBrains, the makers of the IntelliJ IDE and other popular developer tools.</p>
<p>As Kotlin is very new, without a doubt you have not encountered it before. Don’t worry: it is designed as a better
Java for industrial use and as such, the syntax was carefully designed to be readable even to people who don’t know
the language, after only a few minutes of introduction.</p>
<p>Due to the seamless Java interop the use of Kotlin to extend the platform is <em>not</em> required and the tutorial shows how
to write contracts in both Kotlin and Java. You can <aclass="reference external"href="https://medium.com/@octskyward/why-kotlin-is-my-next-programming-language-c25c001e26e3">read more about why Kotlin is a potentially strong successor to Java here</a>.</p>
<p>Kotlin programs use the regular Java standard library and ordinary Java frameworks. Frameworks used at this time are:</p>
<ulclass="simple">
<li>JUnit for unit testing</li>
<li>Kryo for serialisation (this is not intended to be permanent)</li>
<ahref="index.html"class="btn btn-neutral"title="Welcome to the R3 prototyping repository!"accesskey="p"><spanclass="fa fa-arrow-circle-left"></span> Previous</a>
Built with <ahref="http://sphinx-doc.org/">Sphinx</a> using a <ahref="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <ahref="https://readthedocs.org">Read the Docs</a>.