►
From YouTube: Tutorial Part 2: Programming Smart Contracts with Zoe
Description
No description was provided for this meeting.
If this is YOUR meeting, an easy way to fix this is to add a description to your video, wherever mtngs.io found it (probably YouTube).
A
How
to
reallocate
that
among
the
participants
where
Zoe
checks
that
every
proposed
allocation
must
meet
the
constraints
of
offer
safety,
so
I
know
that
was
very
abstract.
Let's
go
through
some
concrete
code
here,
so
this
is
the
concrete
code
for
the
the
atomic
swap
contract,
which
is
sort
of
the
the
simplest
meaningful
contract.
C
B
D
B
B
A
So
the
so
a
key
part
of
our
computational
framework
is
what
we
call
object:
capabilities
which
is
a
different
way
of
handling
permissions
in
a
computer
system
and
the
the
core
idea
of
object
capabilities
is:
is
all
rights
are
bearer
rights
and
the
the
and
that
the
issue
of
who
somebody
is
and
knowledge
of
identity
is
really
secondary.
You
give
the
example
of
a
car
key
being
the
right
to
drive
my
car
and
the
car
doesn't
know
who's
driving
it.
So
if
I
need
you
to
go,
you
know
borrow
my
car
and
drive
it
somewhere.
A
Then
you
need
to
on
the
in
in
doing
that
favor.
For
me,
you
need
to
put
the
car
into
valet
parking
temporarily.
You
can
do,
we
can
do
it.
You
can
just
I
can
hand
the
key
to
you.
You
can
hand
the
key
to
the
valet.
Nobody
helps
to
tell
the
car
Kevin
McCabe
is
now
authorized
to
drive
my
car,
the
valet
is
now
authorized
to
drive
my
car,
the
car
doesn't
check
identity,
but
the
key
itself
is
the
ability
to
drive
and
by
having
that
ability.
A
A
And
then
you
know
you
can
pass
it
to
someone
else,
but
but
bringing
it
and
applying
it
to
the
car
is
different
than
passing
it
to
someone
else.
When
you
want
to
use
it,
you
give
it
to
the
car
so
in
a
similar
way,
when
you
want
to,
because
the
contract
creates
invites
for
participating
in
the
contract.
A
Somebody
who
holds
an
invite
can
pass
the
invite
to
somebody
else
who
can
claim
it
once
they
claim
that
they
have
exclusive
access
to
the
invite
they
can
check
what
the
invite
means.
So
they
know
what
it
is.
They
would
be
joining,
so
it
solves
the
authenticity
problem.
What
is
this
contract
and
what
does
it
mean
to
join
it
and
they
go
back
to
Zoe,
which
is
the
mutually
trusted
agent
that
they
start?
Basically,
one
mutually
trusted
agent
that
you
have
to
come
to
trust
by
something.
A
So
in
you
know,
initialization
of
the
world
means,
but
once
you
trust
that
Bob
can
accept
an
invite
from
Alice
without
Bob.
Trusting
Alice
Bob
can
then
go
to
Zoe
to
check
the
authenticity
of
the
invite
and
Bob
can
go
to
Zoe
to
make
use
of
the
invite
which
is
like
going
to
the
car
to
make
use
of
the
car.
A
A
So,
let's
take
that,
through
from
the
perspective
of
the
contract
first
and
then
we'll
take
it
through
from
the
perspective
of
the
two
participants
and
this
contract
is
the
atomic
swap
contract
which
is
sort
of
the
simplest
meaningful
contract,
and
it
does
just
what
you
would
expect,
which
is
B.
It
has
three
participants,
so
it
makes
two
invites
and
the
the
their
their
invites
to
be
counterparties
in
a
slob
in
a
mutually
acceptable
swap
of
assets.
A
A
So
the
actual
function
is
the
code
that
begins
zcf
and
then
this
equal,
greater
than
arrow
z,
cf,
is
a
parameter
to
the
contract.
Zcf
in
this
case
stands
for
zoe
contract
facet,
and
that
means
it's
the
interface
to
Zoe
that
Zoe
that
Zoe
provides
to
an
individual
contract
when
it
starts
the
contract.
It's
basically
saying
to
Zoe
use
this
zcf
object
to
talk
to
me
as
a
contract
which
I've
started,
which
I
have
started
up
with
in
my
framework.
A
So
that's
what
these
zcf
is
and
then
the
rest
of
this
between
the
Curly's
is
the
body
of
the
function
is
the
is
what
the
contract
does
when
it
starts
off
and
what
the
contract
and
then
the
the
rest
of
this
over
here
is
more
boilerplate.
The
Harden
is
to
basically
our
workaround
for
a
Miss
feature
of
JavaScript.
A
That
just
makes
the
objects
have
a
tamper-proof
surface,
as
they
should
have
had
any
in
a
normally,
but
this
is
what
we
have
to
do
to
protect
ourselves
in
JavaScript,
and
then
this
export
wants
to
make
contract
is
just
a
way
to
make
the
cake
this
function
available,
so
that
you
can
ask
Zoe
to
to
to
use
the
function
to
create
the
contract.
So
Zoe
calls
the
function,
passing
a
Zoe
contract
facet
and
then
the
function
does
the
part
between
the
Curly's
and
the
important
part.
A
Often
in
cottony
code
expressed
this
way,
you
read
from
bottom
to
top.
You
read
from
the
part
of
the
code
that
does
something,
and
that
kind
will
will
refer
to
various
names
that
are
defined,
define
in
this
skunk
they're
defined
in
the
naming
environment
such
that
this
piece
of
code
can
use
those
names.
So
then
you
look
up
here
to
say
to
say:
okay,
well,
what's
the
definition
of
the
name
being
used
down
here
so
that
this
code
down
here
does?
Is
that
returns
back
to
Zoe
a
record?
That's
the
open!
A
Curly
closed
curling,
a
record
of
two
properties,
and
in
this
case
it's
it
just
uses.
The
mandatory
property
called
invite
and
it
skips
the
optional
property
called
public
API,
and
so
we
won't
worry
about
public
API
until
we
see
a
contract
that
uses
it.
So
in
this
invite
the
interaction
between
the
contract
and
Zoe
is
that
the
contract
has
to
return
a
first
invite,
so
that,
when
you
ask
Zoe
when
what's
they
Alice
asks
Zoe
to
create
a
contract.
A
Providing
this
piece
of
code
that
we're
seeing
here
to
presence
there
Alice
is
asking
Zoe
create
an
atomic
swap
contract.
Zoe
will
return
back
to
Alice.
Well,
rizzoli
will
close
our
Zoe
will
call
this
function.
This
function
will
return
back
to
Zoe.
This
first
invite
made
by
calling
this
function,
and
then
Zoe
returns.
That
back
to
Alice,
saying
this
is
the
invite
created
by
the
contract
that
you
asked
me
to
start
so.
Alice
asked
Zoe
to
start
a
contract
name
at
the
Tomic
swap,
which
is
this
code.
Zoe
starts
the
contract.
A
The
contract
execute
creates
a
first
invite.
We
should
return
to
Zoe,
which
Zoe
then
returns
back
to
Alice,
and
now,
let's
take
a
look
at
what
this
first
invite
is
so
over.
Here
we
see
a
function
called
the
open,
paren,
close
paren
means
that
may
in
make
a
first
offer.
Invite
must
be
the
name
of
the
function.
It's
a
function
with
no
parameters,
so
there's
nothing
between
the
parentheses
or
we're
calling
it
as
they
say,
and
by
the
way
I
know.
A
I
know
I
already
asked
about
JavaScript
and
not
many
hands
went
up,
I,
don't
know
how
much
premium
experience
you
guys
do
have,
but
I'm
kind
of
assuming
you're
like
a
Pascal
or
C,
or
something
it's
just
sort
of
what
most
programming
languages
have
in
common.
But
if
I'm,
using
terms
that
are
unfamiliar
like
you
know,
function
calling
function
parameters
all
of
that
body
executes.
A
A
Great,
so
this
whole
notion
of
functions,
calling
functions
and
returning
things
to
the
function
that
called
them,
and
all
that
all
that's,
not
that's
great
okay,
so
make
first
offer
invite
this
here
is
just
the
name.
The
actual
function
is
this
part
and
what
the
function
does
is
it
calls
this
helper
function
called
invite
and
offer.
So
this
is
part
of
the
Zoe
framework.
A
We're
going
to
see
this
one
a
lot
and
the
reason
it's
called
invite
and
offer
is
the
contract
is
asking
Zoe
to
is
basically
saying
to
Zoe
I
want
to
invite
someone
to
make
an
offer
so
three
for
me
an
invitation
that
I
can
give
to
them
such
that
they
can
make
an
offer
which
I
will
react
to.
So
that's
why
it's
invite
and
offer
it
says
what
it
is
that
I'm
inviting
them
to
do,
and
this
is
the
main
contract.
A
A
A
A
It
doesn't
mean
that
what
this
description
says
is
accurate
when
Zoe
is
verifying
the
authenticity
of
is
this
is
the
description
according
to
the
contract,
as
opposed
to
according
to
anybody
else,
so
if
Alice
makes
thus
invite,
makes
an
invite
and
gives
it
to
Bob
and
Bob
validates
that
this
is
a
valid
invite
with
Zoey,
even
though
Alice
receipt
Bob
received
it
from
Alice
that
Bob
doesn't
trust.
Bob
no
now
knows
that
this
description
is
according
to
the
contract
which
fraud
can
see
not
according
to
Alice,
and
even
though
Alice
created
the
contract.
A
The
fact
that
Alice
got
the
contract
running
on
Zoey
means
that
Bob
can
see
the
contract
and
Zoey
is
the
one
assuring
Bob
that
this
is
really
the
contract
that
will
rock
and
and
and
therefore
that
that
when
Zoey
says-
and
this
is
really
the
destruction
by
by
the
contract,
Bob
can
have
some
sense
of
what
that
means.
So
so,
let's
say
that
Alice
creates
the
atomic
flawed
contract
and
Alice
gets
this
first.
Invite,
which
is
the
the
invite
made
by
this
call
to
invite
an
offer.
A
So
that's
the
that's
what
we
closed,
so
that's
the
first
offer
and
now
expected
means
that
that's
where
the
contract
is
expressing,
what
the
shape
is
of
the
offer
that
alice
is
invited
to
make.
So
when
Alice
uses
that
invitation
to
make
the
first
offer
that
first
offer
she
must
be
giving
some
amount
of
an
asset,
so
just
whatever
she's
giving
she
needs
to
label
it
as
the
asset.
That's
just
the
name
that
she
needs
to
label
it.
B
A
A
And
then
inside
the
body
of
the
function,
you
have
a
return
statement.
So
that's
one
one
of
JavaScript's
syntaxes
for
functions
where
you
have
the
signal
that
you're
using
that
syntax
is
that
after
the
arrow,
there
is
an
open
curve,
and
that
means
that
this
is
a
set
of
statements
and
one
of
the
must
be
a
return
statement
now.
A
So
let's
say
it
said:
open
paren,
close
paren,
arrow
3,
that's
a
valid
JavaScript
function
and
it
means
the
same
thing
as
open.
Paren,
close
paren,
arrow,
open,
curly
returned
three
semicolon
close
curly.
Those
two
are
just
different
syntaxes
for
the
same
and
the
short
head
only
works
when
all
of
this
is
just
an
expression
to
be
returned,
so
invite
awful
we're
calling
that
as
a
function
and
invite
offers
return
value
is
the
invite
and
therefore
make
first
offer
invite
it's
return
value.
Is
that
same
invite?
A
But
it
it
but
at
that,
but
by
that
time
it
may
have
made
other
invites
or
it
may
delay
making
the
other
invites
until
it
reacts
to
the
first
end,
but
and
in
this
case
the
terms
of
the
contract
in
terms
of
how
much
Alice
is
offering
and
what
trace
she's
asking
for
exchange
in
exchange.
Those
terms
are
are
derived
from
the
offer
that
Alice
makes
so
because
they're
derived
from
the
offer
that
Alice
makes.
A
The
invite
for
Bob
won't
be
created
until
Alice
makes
that
first
offer,
because
the
contract
itself
doesn't
have
enough
information
to
make,
because
the
second
offer
is
the
offer
to
be
a
counterpart
desire.
The
second
invite
is
an
invitation
to
make
an
offer
as
the
counterparty
and
the
contract
doesn't
have
enough
information
to
invite
Bob
to
be
the
counterparty
until
Alice
actually
makes
the
offer
as
the
first
target.
A
So
when
when
Alice
actually
makes
the
offer,
then
this
offer
hook
is
called
by
Zoey
that
to
notify
the
contract
that
the
first
offer
has
been
made
and
enable
the
contract
to
react
to
that
first
offer,
and
so
when,
when
Alice,
as
the
first
party
makes
that
first
offer,
the
contract
will
in
turn,
call
make
matching
invite
this
other
function
up
here.
Where
the
function
itself
is
this
code,
then
this
code
I'm
sorry
this
code,
it's
the
close
Crowley
matching
is
I.
A
Let
my
editor
do
that
for
me,
that's
hard
to
do
it
visually,
but
anything's.
So
the
these
are
these
offer
HUD
functions
or
always
function
of
one
parameter,
and
the
parameter
is
something
we
call
an
offer
handle
and
it's
a
capability,
it's
again
sort
of
like
a
car
key.
But
it's
it's
there's
nothing
exclusive
about
it's
not
intended
to
be
something
that
you
pass
around
as
it
as
a
tradable
right.
It's
just
it's.
A
So
it
does
that
by
vfc
zoe
contract
facet.
That
was
the
thing
the
variable
that
the
contract
got
up
there
when
Zoe
started.
The
contract
Zoe
gave,
gave
the
contract
zcf
Zoe
contract
facet
as
the
way
in
which
it
tells
the
contract.
Here's
how
you
talk
back
to
me
in
a
way
that's
specialized
to
mind,
having
created
you,
so
this
is
the
sort
of
the
special
relationship
between
Zoe
and
this
specific
contract.
Is
this
zcf
object,
so
the
contract
says
get
offer?
It's
asking
Zoe.
A
Give
me
a
description
of
the
offer
that's
named
by
this
first
offer
handle,
so
you
can
think
of
the
handle
as
a
way
of
naming
things.
It's
a
way
of
talking
about
a
particular
thing,
but
it's,
but
unlike
a
name
like
you
know
like
on
like
heaven,
it's
not
a
string
that
anybody
can
write
down.
It's
unfortunate
that
sense,
it's
more
like
the
car
key
is,
you
can
have
the
name.
If
somebody
gives
it
to
you,
you
can't
have
it
if
nobody
gives
the
tea.
A
So
this
is
naming
the
offer,
which
was
the
offer
that
came
from
the
first
party
this
this
piece
of
code
made
the
invite
to
make
the
first
offer
Alice
made
the
first
offer
saying
names.
The
first
offer
it
was
provided
to
the
hook,
which
is
the
hook
down
here,
which
is
this
function,
so
this
variable
is
names
the
first
party's
offer
and
then
that
the
offer
structure
that
has
a
field
in
it
called
proposal.
A
That's
the
important
field
which
that
shows
what
the
what
specifically
the
first
part
he
had
offered,
and
that
has
again
a
want
field
and
a
give
field.
So
this
whole
thing
over
here
this
is
to
notice
that's
to
the
left
of
an
assignment.
That's
a
pattern
match
in
JavaScript,
I,
don't
know,
I,
don't
know
Python
well
enough
to
know
if
it
has
similar
pattern
matches,
but.
B
A
So
with
this
thing
is
so
normally
when
you
say
constant
something
over
here
equals
then
what's
over
here,
you
know
Const
two
equals
three
on
the
right
side
of
the
equals
is
an
expression
that
evaluates
to
the
to
a
value
on
the
left
side.
We
typically
just
see
a
name
like
foo,
but
really
what
you
can
write
on
that
left
side
is
any
pattern
and
the
name
is
just
the
simplest
pattern
and
the
pattern
is
matched
against
the
value
of
the
expression
on
the
right.
So
you
say:
Khonsu
equals
three.
A
The
three
expression
evaluates
to
the
number
three
and
we're
going
to
call
whatever
the
value
is
on
the
right,
we're
going
to
call
that
the
specimen
and
then
the
pattern
on
the
left
is
match
against
the
specimen
and
when
the
pattern
is
just
a
name,
then
the
way
the
name
is
matched
against
the
specimen.
Is
it
says,
no
matter
what
the
specimen
is
the
match
is
successful
and
I
will
simply
become
the
name
that
we're
going
to
use
to
refer
to
that
specimen
from
here
on.
A
Within
this
naming,
scope
within
this
piece
of
code
so
counts
through
equals.
Three,
the
value
of
the
value
three
is
now
named
foo
because
that's
what
the
pattern
did
on
matching
and
then
for
the
rest
of
the
code,
the
value
we
can
refer
to
the
value
food
by
using
the
name
three
so
over
here
we
have
a
more
complex
pattern
and
notice
that
this
pattern
is
used
being
exact,
the
record
syntax,
it's
using
exactly
the
same
kind
of
syntax.
A
These
star
down
here,
which
is
open,
currently
closed,
curly
and
property
names
within
the
curly,
is
giving
the
names
of
the
properties
of
the
record
but
over
here,
because
writing
it
in
a
pattern
position.
What
that
means
is
I'm
going
to
match
under
the
assumption
that
the
specimen
is
a
record.
So
when
we
ask
the
Zoe
get
the
awful
it
returns
to
us
an
offer
description,
which
should
be
a
record
that
fits
this
pattern
and
that
record
might
have
multiple
fields,
but
the
field
I'm
interested
in
his
proposal.
A
So
in
fact,
this
get
the
get
offer
record
returned
by
this
piece
of
code
has
several
fields
describing
the
author,
but
the
only
one
we
care
about
here-
and
this
is
very
technical.
This
is
the
interesting
one
is:
what
is
the
proposal
that
the
first
party
made
so
so
what
so?
The
specimen
so
far
has
been
the
author
record
as
a
whole.
A
This
field
proposal:
now
we
have
a
sub
specimen,
which
is
whatever
the
value
was
of
the
field
proposal
in
that
record.
So
this
pattern
match
has
extracted
part
of
the
overall
specimen
to
get
the
portion
of
it,
which
is
now
the
specimen
for
the
remaining
match
and
that's
whatever
the
contents
of
the
field
proposal
was
in
the
offer
description,
so
that
record
in
turn
matched
against
this
pattern.
A
So
this
pattern
says
whatever
fields:
that
record
has
what
I'm
interested
in
is
a
field
named
want
and
a
field
named
give
now.
This
could
have
been
written
as
what
:
want,
and
then
it
would
be
Seton
we'd
be
seeing
exactly
the
same.
Syntax
we
saw
over
here.
Javascript
has
another
piece
of
syntactic
shorthand,
which
is
any
time
that
you
would
have
said
what
:
one
where
the
name
of
the
property
and
the
name
of
the
variable
that
you're
binding
it
to
is
the
same
name.
A
You
can
just
use
the
name
directly
without
a
cola,
so
you
see
that
just
think
what
:
want
so
we're
gonna
match
the
property
named,
want
and
we're
going
to
buy
that
in
the
scope
to
a
variable
name,
and
likewise
forgive
so
it
so
altogether.
What
this
thing
does
now
speaking
about
it
is
a
high-level,
as
it
says,
in
order
to
invite
Bob
to
make
a
count,
a
counterparty
offer
to
make
a
matching
offer.
A
A
A
This
description
that
you
can
go
back
to
Zoe
and
check
the
author
test
and
it
meant
a
field
called
asset
that
whose
value
is
the
amount
that
the
first
party
proposes
to
give,
and
at
this
point
we
know
that
Zoe
is
holding
all
of
those
assets
in
escrow,
because
until
zoe
has
successfully
escrow
those
assets,
the
first
parties
offer
is
not
visible.
The
first
party
has
not
joined
the
contract
until
those
assets
are
placed
into
escrow
and
the
important
thing
about
that.
A
That's
a
huge
deal
in
this
whole
cryptocurrency
space
that
we're
in
because
the
system
of
property
in
which
those
assets
are
placed
into
escrow
might
be
a
completely
other
blockchain
elsewhere
that
in
which
it
takes
some
other
some
amount
of
time
and,
however
long
it
takes
and
how
ever
complex
the
cryptography
is
for
the
contract
running
on
one
blockchain
to
interact
with
the
system
of
property
running
on
the
other.
Watching
at
this
level.
A
Zoe
is
the
thing
triggering
all
of
that
interaction
to
bring
about
the
escrowing
of
the
property
on
the
other
blockchain
in
a
way
that
can
be
adequately
trusted
on
this
block,
and
only
once
that
escrowing
is
safe,
does
Alice
the
is
Alice's
offer
recognised
as
an
offer
to
participate
in
the
contract.
So
at
this
point
we
know
that
those
assets
have
been
successfully.
A
Provided
by
the
first
party
and
we're
also
telling
Bob,
this
is
the
price
that
the
first
party
wants
once
in
exchange
for
that,
and
then
this
invite.
That
is
just
a
description
that
has
the
same
role
as
this
description,
so
that
when
Bob
going
back
to
Zoe,
says
well,
okay,
what
is
the
invite
desk?
Well,
first
of
all,
what's
that
what
contract
amount
participating
and
oh,
this
is
the
contract.
This
is
the
text
of
the
contract,
I'm
participating
in.
What's
the
invite
desk?
Oh
it's
this
string!
A
Well,
you
can
just
take
a
look
at
the
text
of
the
contract
and
see
this
is
the
only
place
in
the
contract
that
it
makes
an
invitation
using
this
string.
So
therefore,
Bob
can
know
as
a
shirt
behind
Zoey,
even
though
he
got
the
invitation
from
Alice.
Bob
can
know
that
he's
getting
an
invite
that
was
made
by
this
contract
at
this
position.
What.
A
Then
it
would
be
visible
looking
at
the
code
in
order
in
order
for
Bob
to
know
that
it's
that
it's
this
invite
desk
from
this
contract.
You
would
have
to
look
at
all
the
places
where
an
invite
can
be
made
within
the
company,
and
that's
that
can
be
obscured
me.
There's
an
adversarial
issue
that
I
want
to
come
back
to.
A
So
the
way
you
minimize
that
is,
you
always
create,
create
an
invite
by
calling
invite
and
offer
by
name.
So
you
never
call
that
function
by
another
name,
and
then
you
always
include
this
thing
using
a
literal
string
over
here,
so
that
you
can
find
it
by
looking
for
the
text.
You
never
do.
It
use
a
computed
expression
over
there
and
you
never
used
the
same
name
in
two
different
places.
A
Unless
you
really
meant
to
do
that,
when
you
make
a-
and
in
that
case
you
would
try
to
make
it
clear
to
the
reader
to
be
aware
that
so
that's
the
non-adversarial
case
where
the
contract
is
written
to
minimize
the
difficulty
that
bob
has
in
looking
at
the
invite,
on
the
one
hand,
looking
at
the
text
of
the
contract,
on
the
other
hand
and
trying
to
say
okay,
given
that
this
invite
was
made
by
this
contract.
What
is
this
invite
inviting
me
to
do
and
what
does
it
mean
to
participate
in
this
contract?
A
Now,
there's
an
adversarial
case
which
is
in
general,
with
secure
program
I
mean
you
have
to
worry
about
the
adversarial
case,
but
especially
with
contracts.
This
is
the
equivalent
of
fine
print,
which
is
if
Alice
wrote
this
contract
Alice
might
have
an
interest
in
writing
a
contract
that
Bob
reads
thinking.
He
knows
what
it
means
where
Alice
has
really
missed,
written
it
too,
to
mislead
Bob
to
lead
Bob
to
derive
a
meaning.
That
is
not
what
Alice
actually
wrote
so
the
adversarial
code.
A
Understanding
problem
is
very
very
hard
and
it's
hard
to
an
extent
that
the
entire
smart
contract
ecosystem,
including
us,
has
not
done
much
to
prepare
for.
We
have
it
on
our
plates.
We're
aware
of
that
problem.
We're
going
to
we're
going
to
we're
working
our
way
towards
doing
more
things
to
help
with
the
adversarial
code,
understanding
problem,
but
here's
the
really
cool
thing
about
Zelly,
which
is
even
if
bob
misunderstands
the
contract
when
bob
for
violates
the
offer
zowie
guarantees
offer
safety.
A
So
the
worst
case
for
Bob's
point
of
view
is
he
just
gets
his
his
I'm
sorry,
he
got
that
the
other
way
around
his
give
Bob
the
asset
in
exchange
for
the
price
or
not
give
Bob
the
asset,
in
which
case
the
contract
has
to
refund
the
price.
Zoey
does
not
let
this
contract
on
misbehavior
engage
in
any
other
outcome,
so
really
really
cool
that.
B
A
That's
correct:
that's
correct,
okay!
There's
this
whole
other
thing:
okay,
which
which
is
actually
perfect,
segue,
because
it's
and
that
natural
next
thing
to
talk
about,
which
is
what
the
exit
rules
are.
Where
are
the
exit
conditions
for
leaving
the
contract
and
I?
Don't
get
the
assets?
I'm?
Sorry,
I!
A
In
both
cases,
it's
part
of
the
meaning
of
the
contract
that
the
contract
closes
at
an
agreed
time,
but
the
what
you
typically
have
is
a
contract
like
a
ton
of
swap
because
the
the
the
default
since
this
contract
didn't
say
anything
about
about
the
exit
conditions.
The
default
is
that
the
exit
condition
is
on
demand,
and
what
that
means
is
that
either
Alice
or
Bob
at
anytime,
before
this
contract
closes,
can
request
to
leave
and
once
they
request
to
leave
their
request.
They
don't
necessarily
leave
with
the
contract,
not
closed.
A
But
we
have
we
have
this
term
this
technique.
We
use
the
term
prompt
in
a
technical
manner.
Prompt
might
be
a
delay
in
several
seconds
or
several
minutes,
depending
on
the
nature
of
the
underlying
blockchain.
But
what
prompt
means
is
that
it's
guaranteed
to
eventually
happen
with
none
of
the
other
participants
having
to
take
any
further
action.
A
So
once
Alice
or
Bob
asks
to
leave.
We
now
know
that,
let's
say
Alice
asked
to
leave.
We
now
know
that
Alice
will
leave
promptly
and
that
the
assets
that
Alice
will
have
on
exit
will
either
be
what
she
wanted
work.
She
will
get
back
the
what
she
had
proposed
to
get
what
had
been
placed
in
escrow,
and
so
if,
if
her
request
to
exit
happen
is
processed
first,
then
she'll
get
the
refund.
A
If
her
request,
if
the,
if
the,
if
the
contract
was
about
to
close,
if
there
was
a
closing
action
that
was
kind
of
already
in
the
air,
then
completing
the
clothes
might
happen.
First,
in
which
case
Alice
would
have
exited
the
contract
after
closing
anyway,
but
Alice's
request
to
exit
in
in
racing
with
the
action
that
will
close
the
contract
guarantees
that
alice
is
going
to
get
out
soon.
A
A
So
this
contract
is
on
demand,
since
it
didn't
say
so
in
the
happy
case
as
we
call
it,
which
is
where
everybody
just
kind
of
does
what
they're
expected
to
do.
None
of
the
exceptional
conditions
happen.
Nobody
moves
on
satisfy,
oh
say:
I
want
to
say
another
thing
about
this
on
demand.
The
other
thing
that's
really
nice
about
on
demand
as
opposed
to
a
timeout
is
a
timeout
would
have
to
be
negotiated
ahead
of
time.
Alice
and
Bob
would
have
to
figure
out
ahead
of
time.
A
How
long
do
they
want
to
wait,
whereas
on
demand
means
that
Alice
or
Bob
can
just
leave
their
assets
in
escrow
as
long
as
they
want
until
they
want
them
back,
then
they
can
decide
why
they
can
decide
that
they
want
them
back
for
reasons
that
only
happened
after
they
were
put
in
escrow
and
there's
no
default
timeout.
They
do
on
demand.
These
assets
can
sit
here
for
five
years
and
they're
still
there.
A
That's
right
so
in
that
sense
it's
very
different
than
the
parking
one
one
of
the
contrasts.
We
keep
coming
back
to
to
remind
ourselves
of
many
many
different
forms
of
property
as
tokens
to
do
as
represent
areas
rights
as
reference
Banting.
Some
ability
to
do
something
is
a
membership
card
versus
a
contract
concert
ticket
mm-hmm
a
membership
card.
A
As
long
as
you
hold
it,
you
can
continue
to
make
use
of
your
rights
as
a
member
without
using
up
your
membership
card,
whereas
a
concert
ticket
when
you
enter
the
concert,
you
hand
over
the
concert
ticket
and
it's
used
up.
So
the
invite
is
like
the
concert
ticket
in
that
regard.
Is
you
use
it
when
making
an
offer?
And
at
that
point
the
invite
is
used
up
it's
gone,
and
that
was
that
was
an
excellent
question.
A
There's
a
very
common
pattern
which
is
which
the
atomic
swap
is
kind
of
all
about.
That
comes
up
enough,
that
we
went
ahead
and
created
lis
shorthand,
for
that
particular
pattern,
which
is
these
two
offers
should
be
matching
authors,
so,
if
so,
just
reallocate
among
them,
so
that
what
one
proposed
to
give
it
should
be.
What
the
other
one
wants,
and
what
the
other
proposed
to
give
should
be
what
the
first
one
once
so
just
reallocate
by
swapping
the
assets.
And
then,
if
that
works.
A
A
The
the
swap
will
will
simply
cause
again
both
of
these
parties
to
leave
without
doing
the
reallocation
and
without
doing
the
reallocation
means.
That
means
that
they're,
that
they're,
leaving
with
the
current
allocation
and
the
current
allocation,
is
the
allocation
that
corresponds
directly
to
what
they
put
in
escrow,
what
they
propose
to
give
becomes
their
initial
allocation.
A
This
point
this
contract
is
done
so
so
I
want
to
I
want
to
distinguish.
There's,
there's
two
different
notions
of
this
contract
that
we're
often
sloppy
with
when
we
talk-
and
in
fact
I
was
sloppy
with,
which
is
the
code
versus
the
instance.
So
it's
this
contract
instance
that
is
now
done
or
what
I
mean
by
the
code
versus
the
instance
is
this
function
over
here.
This
function
over
here
that
began
with
zcf
arrow.
That
function
is
a
piece
of
code
that
function
can
be
called
many
times.
A
So
when
you
ask
the
zowie
to
install
code,
that's
about
the
code,
and
you
do
that
once
for
a
piece
of
code
and
the
result
is
an
installation
of
the
code
and
then,
when
you
ask
as
OE,
to
make
an
instance
of
the
contract,
that's
when
Zoey
calls
this
function.
So
it's
it's
the
activity
that
results
from
calling
this
phone
it's
that
activity,
which
is
the
instance,
so
this
instance
is
only
about
making
one
swap
and
when
that
swap
either
succeeds
or
fails,
or
somebody
cancels
their
participation
and
leaves
when
any
of
those
things
happen.
D
A
D
A
A
A
A
So
what
so?
The
market
price
for
giving
the
market
price
is
what
you
can
buy
for
twenty
a
that
market
price
is
five
B.
So
if
this
contract
is
honest,
if
it
is
the
auto
swap
market
maker
that
it
claims
to
be
then
now
lost
coming
to
it.
With
that
author
leaves
getting
getting
five
B,
even
though
she
only
said
she
wanted
one
day.
A
So
we're
making
an
assumption
here,
which
is,
is
the
proper
term
of
getting
good
we're
making
this
assumption
that,
if
you
say
you
want
end
of
something,
it's
always
acceptable
to
give
you
more
than
n
that
you
can't.
We
can't
violate
what
you
want
by
giving
you
more
more
of
what
you
asked
for,
and
we
obviously
we
know
that
there
are
situations
where
that's
not
true,
but
that's
all
that
Zoe
guarantees.
So
this
is
again
this
principle
like
getting
the
market
price,
where
it's
not
that
Zoe
is
taking
care
of
all
of
the
risk.
A
Is
that
we're
partitioning
the
risk
we're
saying
zone?
We
takes
care
of
the
offer
safety
and
then
everything
beyond
offer
safety
that
you're
counting
on
you
have
to
understand
the
contract,
and
if
and
if
you
misunderstood
the
contract,
then
those
additional
parts
of
offers
safety
might
be
violated.
Well.
B
A
Yes,
exactly
exactly,
and
in
fact,
the
right
contract
to
use
to
make
that
point
really
well.
Is
our
public
auction
contract
we'll
see
if
that's
more
tractable
in
terms
of
code
much
tractable?
So
this
is
a
second
price
auction
now
in
order
to
in
order
to
participate
in
a
second
price
auction
order
to
make
an
awful
you
have
to
escrow
enough
to
cover
the
entirety
of
your
bid
so
so
offer
safe
need
only
guarantees
you,
the
the
safety
that
you
would
expect
from
a
first
price
auction.
A
So
you
can
get
more
of
what
you
wanted
and
you
can
get
some
of
what
you
did
refunded
and
both
of
those
have
no
limit.
If
the
allocations
work
out,
you
can
actually
get
more
refunded
than
you
put
in
of
what
you
proposed
again
and
you
can
get
as
well
as
getting
more
of
what
you
wanted
and
you
can
get
all
of
those
at
the
same
time,
because
as
long
as
it
satisfies
offer
safety,
it
satisfies
the
conditions
that
Zoe
is
enforcing.
A
It
might
give
the
good
to
somebody
other
than
the
top
bidder,
the
steller
who
placed
the
bid
for
sale
in
the
auction,
the
amount
that
the
seller
said
they
wanted
is
used
as
the
reserve
price,
which
is
just
another
way
to
say,
limit
price.
So
Zoe
again
can't
violate
the
sellers
reserve
price
because
the
seller
will
be
refunded,
whatever
good
they
placed
in
escrow,
with
the
auction
to
sell
to
the
top
bidder.
Well,
either
get
the
good
back
or
they
get
their
reserve
price.
A
No
other
reallocation
will
be
acceptable,
but
they
might
not
get
anything
higher
than
the
reserve
price
and
the
the
dishonest
auctioneer
can
arrange
a
artificial
participant
that
gets
all
of
the
surplus.
So
there's
a
variety
of
ways
in
a
second-price
auction
that
you
can
be
cheated,
but
the
the
offer
safety
is
still
a
tremendous
limit
on
the
risk
limit
on
the
hazard
of
what
you
have
to
worry
about.
If
you
misunderstood
the
contract.
A
So
let's
talk
about
a
continuous
double
auction
which
we
certainly
intend
to
build.
We
haven't
built
that
yet,
but
it's
perfectly
compatible
with
Zelly
and
it's
rather
beautifully
expressed
within
Zelly,
except
that
it
needs
one
further
bit
of
expressiveness
that
we
haven't
talked
about,
which
is
the
multiples
so
right
now
in
Zoey
and
offer
is
atomic.
A
If
I
say,
I
want
to
buy
10
shares
of
IBM
for
$1,000,
then
the
the
auction
that
I
said
that
to
can
either
give
me
mine,
you
know
I
have
to
be
$1,000
$1,000
places
ESCO
it.
If
it's
not
going
to
give
me
all
10
shares,
it
has
to
give
me
a
thousand
back.
One
thing
it
cannot
do
under
the
current
Zoey
is
give
me
five
shares
of
IBM
for
five
hundred
dollars
and
give
me
the
other
$500
back
so
there's
so
there's
an
atomistic.
A
It
has
to
do
it
all
or
nothing
of
the
entirety
of
the
offer
and
if
you
try
to
run
a
continuous
double-double
auction,
where
the
matching
of
the
overlap
has
to
honor
that
term
of
arbitrary
atomicity
you
have
a
mess,
becomes
really
hard
to
write
a
double
auction.
That
does
that,
so
what
you
want
and
which
we
don't
have.
This
is
the
reason
why
we
asked
him
doing
some
prototypes.
Why
we
didn't
actually
put
in
double
auction
production.
C
C
So
the
fact
that
I
mean
it's
possible
for
me
to
have,
if
you're,
forcing
exact
matching,
then
I
can
have
bids
which
are
higher
than
offers,
which
is
still
in
the
other
book,
which
is
like
you're
saying
this,
but
in
a
way
I
mean
people
can
kind
of
figure
it
out
and
they
can
look
and
see
where
to
see
where
the
bids
and
offers
are
and
well.
They
can
have
another
piece
of
code
on
top
of
that
which
takes
care
of
that
for
them
so
that
it
doesn't
have
to
be
accounted
for
in
the
contract.
B
The
other,
the
other
thing
you
you
can
remember
is
that
there
would
be
forms
of
double
options
that
could
could
accept
combinatoric.
Yes,.
A
A
So
so
the
combinatorics
we
can
support
right
now,
the
divisibility
we
do
not
yet
support
and
the
cognate
Oryx
is
still
and
all
or
nothing
so,
an
individual
oft
where
here
might
be
left
in
this
give
record.
There
might
be
multiple
fields
like
this
within
the
want
record.
There
might
be
multiple
fields
like
this
and
Zoe
still
enforces
offer
safety
where
either
the
entirety
of
the
give
is
satisfied
or
the
entirety
of
the
wanted,
satisfied
and
the
entirety
of
begin
give
has
to
be
put
into
escrow
on
the
front.
A
C
A
B
A
A
The
the
next
one
is
after
deadline,
where
there's
simply
a
deadline
and
and
whatever
the
situation
is
as
of
the
deadline,
everybody
sure
not
everybody,
that
player
is
leaves
the
contract
after
that
deadline
with
their
current
allocation.
So
the
covered
call
option
is
the
example
of
that
which
is
the
whoever
wrote
the
cover
call
option.
They
either
get
their
money
or
they
get
what
they
put
into
escrow
back
exactly
when
the
contract
expires.
A
One
of
the
things
that
we
anticipate
doing
we
expect
to
do,
but
we
have
not
done,
is
to
mix
the
concept
of
after
deadline
and
on
demand,
which
is
after
the
deadline.
You're,
not
you're,
not
forced
out
it's
that
after
the
deadline,
you
now
have
the
right
to
leave
on
demand,
but
we
don't.
We
don't
yet
support
that,
but
I
said
I
think
that
will
be
useful
and
then
the
final
one
is
waved
and
waved
means
I
have
given
up
zowie
enforced
assurance
about
when
I
will
get
out.
A
I
still
have
the
assurance
that
whenever
it
is
that
I
get
out,
I
get
out,
honoring
offer
safety,
but
I
might
never
get
out.
If
I
waves,
my
exit
conditions
and
I
enter
into
a
malicious
contract.
It
might
just
stay
stuck
forever
and
that's
what
I
agreed
to
so.
In
that
case,
the
adversarial
code.
Understanding
problem
is
that
I
need
to
understand
under
what
conditions
the
contract
says.
B
There
you
know
this
is
thinking
out
loud,
but
there
might
be
a
reason
to
have
on-demand
contracts
that
can
only
be
executed,
our
on-demand
exits
that
can
be
executed
as
long
as
you're
not
causing
some
externality
condition.
That
is
you
check
a
condition,
and
you
say
if
this
condition
doesn't
hold,
then
you
can
exit
on
demand
if
this
condition
currently
holds,
then
you
can't.
A
Right
so
that
would
be
a
perfect
example
where
you
say
waived,
because
so
me
is
not
in
a
position
to
know
to
understand
those
those
conditions
and
therefore
there
is
no.
There
is
no
exit
safety.
What
we
call
payout
liveness
there
is
no
section
for
that
kind
of
contract.
There
is
no
such
thing
that
Zoey
can
enforce,
but
we
could
say
is
that
the
after
deadline
is
something
ridiculous.
A
Like
after
a
year,
you
get
your
assets
back
where
we're
expecting
the
contract
to
close
within
a
few
minutes
and
that
way
you're,
depending
on
understanding
the
contract,
understanding
that
you'll
leave
when
the
condition
is
satisfied.
But
if
you
misunderstood
the
contract
or
the
condition,
is
never
satisfied,
you're
not
stuck
forever.
So
after
your
deadline
is
still
a
way
to
put
a
limit
on
how
badly
your
your
assets
are
stuck.
If
you
misunderstood
the
contract,
here's.
B
A
A
You
could
ensure
that
both
are,
if
you're
worried
that
both
offers
might
be
taken.
Then
you
could
wait
until
you
see
that
your
first
offer
is
successfully
left
before
placing
second
offer,
but
you
can't
do
that
and
get
the
opposite
guarantee
that
the
first
offer
doesn't
leave
until
the
second
order
entrance.
B
A
Very
good,
so
our
so
bringing
up
the
case
actually
that
that
exceeds
our
current
plans.
Well,
the
the
expressiveness
that
we're
anticipating,
but
we
were
anticipating
something
very
close
to
that,
which
is
that
what
we
call
on
exclusive
choice,
which
is
you
can
put
in
a
single
offer
that
is
an
or
an
exclusive
or
exclusive
choice
between
several
different
proposals
where
you're
saying
I
would
be
I,
know
I'm
fine
with
any
of
these
alternatives.
A
So
if
you
satisfy
any
of
these
alternatives,
do
you
satisfied
my
offer
safety,
but
it's
different
than
making
multiple
independent
offers,
because
I
make
multiple
independent
offers.
Multiple
of
them
might
get
satisfied,
exact
I
might
be
I
might
want
to
say.
I
only
want
at
most
one
of
these
satisfied,
all
the
others
should
get
a
refund
only,
and
so
we're
expecting
to
do
that
and
you've
now
touched
on
essentially
exactly
the
two
forms
of
additional
expressiveness
that
we've
anticipated,
which
is
the
divisibility
and
the
exclusive
choice.
A
B
Because
it
seems
like
a
reviling,
it's
kind
of
basic
atomicity
need,
although
I
suspect,
maybe
you
can
create
a
contract
arrangement
that
says
at
the
time
I
want
to
make
if
I
want
to
make
a
new
offer
in
something
like
a
double
option.
I
can
at
that
time
under
man,
rescind
all
my
other
offers
and
reenter
a
phenomena
toric
offer
that
has
the
element.
A
A
So
it's
only
providing
certain
degree
of
assurance
and
any
remaining
assurance
can
again
be
up
to
understand
up
to
the
contract
than
you
understanding
the
contract
right.
So
the
begin
that
you're
looking
for
is
one
that
you
can
write
a
contract
that
in
the
contracts
behavior
provides
exactly
that
behavior
that
you're
looking
for
as
long
as
the
behavior
you're
asking
the
contract
to
do
is
consistent
with
how
the
offers
are
expressed
at
the
lower
level
that
Zoey
understands
such
that
the
outcomes
install
satisfied.
The
Zoey
expressed
offer
safety,
so
anatomical
atomic
alternatives.
A
Where
the
alternatives
arrived
late.
You
could
write
a
you'd
have
to
write
the
contract
to
know
about
that
upfront.
They
wouldn't
just
have
to
magically
for
a
contract
that
didn't
know
about
that,
but
a
contract
that
knew
about
that
and
intended
to
support
that
could
do
that,
because
the
allocations
that
that
condition
asks
it
to
bring
about
are
still
condition
are
still
consistent
with
the
underlying
lawful
safety
right.
B
One
thing
that
confuses
me
off
and
on
and
still
confuses
me
a
little
bit
is
the
difference
between
the
rules
of
the
game,
the
implementer
of
the
auction
who
might
use
Zoey
and
the
things
that
get
escrowed
in
Zoey
and
used
the
protection
right
so
and
the
reason
why
it's
a
little
weird
is
because
it's
not
just
a
contract.
But
it's
things
like
bids
and
asks
the
messages
can
become
contracts
and
Zoey.
A
A
What
that
say,
what
that's
doing
is
it's
telling
Zoe
if
the
offer
that's
actually
made
using
this
invite,
if
it
doesn't
have
this
shape,
then
don't
even
tell
me
about
it:
just
reject
the
offer
so
that
way,
the
contract
can
easily
say
I'm
the
contract
for
four
offers
of
this
shape,
and
if
somebody
uses
a
simple
to
make
an
offer,
that's
a
lot
of
not
in
the
shape.
Oh
no
dork
right.
C
A
C
Maybe
even
in
an
internal
market,
so
the
example
being
I
could
have
lights
put
in
a
kolache
and
now
the
total
amount
of
margin
that
I
need
to
put
up
will
depend
on
whether
I
had
both
the
put
in
the
call
option
together
or
just
one
or
the
other,
so
both
contracts
being
in
Zoe
in
some
sense
and
the
different
contracts
within
Zoe.
Can
they
talk
to
each
other
in
a
sense
of
the
the
price
that
the
price
be
a
function
of?
What's
going
on
with
other
contracts
inside
the
same
bar?
So
so.
A
So
these
can
be
put
in
and
they
can
communicate.
We
haven't
actually
done
that.
You
know
there's
a
lot
of
interesting
cases
where
we're
planning
to
do
that
and
therefore
something
like
an
auto
swap
can
be
used
as
a
price.
Our
call
for
something
like
a
you
know,
a
collateral
law,
any
kind
of
collateralized
thing
that
depends
on
an
external
price.
A
You
can
do
that
by
having
contract
a
contract
talking
to
a
price
Oracle
and
the
price
article
itself
could
just
be
another
contract
that
creates
incentives
for
an
honest
price
I
say
just
but
but
but
but
the
important
thing
about
all
that
is
this
is
this:
is
an
assurance
with
regard
to
market
price,
which
is
not
something
Zoey
can
guarantee
I'm.
Sorry,
you
held
up
some
text
there.
E
D
Also,
just
want
to
point
out
that
the
if
you
hadn't
looked
at
documentation
on
our
website
lately,
it's
it's
been
updated
quite
recently
and
it's
been
I
think
they're
still
working
on
some
of
it,
but
it.
But
it
has
like
the
latest
code
with
sort
of
all
all
the
changes
we've
made
into
the
API
and
that
sort
of
stuff.