Tech white paper: update example from Sofus

This commit is contained in:
Mike Hearn 2016-11-28 14:22:11 +00:00
parent 536b79a5f2
commit 6c8996fb5e
2 changed files with 9 additions and 6 deletions

View File

@ -11,7 +11,8 @@
breaklines,%
autogobble,%
frame=lines,%
framesep=2\fboxsep%
framesep=2\fboxsep,%
fontsize=\footnotesize%
}
\usepackage{color}
\usepackage{epigraph}
@ -1184,13 +1185,15 @@ experimental \emph{universal contract} that builds on the language extension fea
language. To avoid linguistic confusion it refers to the combined code/data bundle as an `arrangement' rather
than a contract. A European FX call option expressed in this language looks like this:
\newpage
\begin{kotlincode}
val european_fx_option = arrange {
actions {
acmeCorp.may {
"exercise".anytime {
acmeCorp may {
"exercise" anytime {
actions {
(acmeCorp or highStreetBank).may {
(acmeCorp or highStreetBank) may {
"execute".givenThat(after("2017-09-01")) {
highStreetBank.owes(acmeCorp, 1.M, EUR)
acmeCorp.owes(highStreetBank, 1200.K, USD)
@ -1199,7 +1202,7 @@ than a contract. A European FX call option expressed in this language looks like
}
}
}
highStreetBank.may {
highStreetBank may {
"expire".givenThat(after("2017-09-01")) {
zero
}

View File

@ -158,7 +158,7 @@ class ActionBuilder(val actors: Set<Party>) {
}
}
fun String.anytime(init: ContractBuilder.() -> Unit): Action {
infix fun String.anytime(init: ContractBuilder.() -> Unit): Action {
val b = ContractBuilder()
b.init()
val a = Action(this, const(true), actors, b.final())