►
From YouTube: How To Build a Composable DeFi Contract
Description
Learn about the Agoric smart contract platform with Kate Sills as she walks you through building an “over-the-counter” market maker. The example introduces the key concepts of safe smart contracts on Agoric, and shows how to combine DeFi legos to rapidly produce a new DeFi dapp.
HOST
Kate Sills – Software Engineer, Agoric
ABOUT
Agoric is building a new framework to enable millions of JavaScript developers to safely build and deploy secure smart contracts.
LINKS
https://agoric.com
https://agoric.com/discord
Subscribe to the channel to learn more about Agoric. Join the newsletter by visiting https://agoric.com and hitting the subscribe button.
A
All
right
so
hi
everyone,
my
name,
is
kate
sils,
I'm
a
software
engineer
at
agorik
and
I
work
mostly
on
the
smart
contract
layers.
Today
I
wanted
to
code
with
you
the
otc
desk
contract
that
we've
been
working
on
and
it
uses
the
agorik
platform.
A
So
what
do
I
mean
by
an
otc
desk
contract?
Well,
this
the
inspiration
for
this
was
a
medium
post
by
haseeb
qureshi
called
unbundling
uniswap,
and
it's
a
really
interesting
article.
I
highly
recommend
it.
I'm
going
to
focus
on
one
part
in
particular:
haseeb
outlines
a
design
for
what
he
calls
signature
based
pricing
and
effectively
it's
a
new
form
of
over-the-counter
or
otc
trading.
So
typically
in
the
world
outside
of
smart
contracts,
you
would
tell
the
desk
that
you
want
to
trade.
A
Let's
say
100
eth
for
usdc
and
the
desk
would
respond
with
the
price
and,
if
you
like,
the
price,
you
execute
the
trade.
So
without
a
smart
contract,
you're
trusting
the
otc
desk
and
you're
signing
a
legally
binding
otc
agreement,
so
haseeb
had
the
following
idea
to
use
a
smart
contract.
Instead,
he
said
that
the
otc
desk
would
reserve
the
assets
on
chain
and
then
cryptographically
sign
a
quote
off
chain
and
give
it
to
you.
A
So
if
you
like,
the
quote,
you
can
submit
it
on
chain
to
the
smart
contract
which
verifies
the
signature
and
fills
the
order
at
that
exact
price
using
the
on
chain
reserves.
So
what
exactly?
Are
we
going
to
be
building
today?
Well,
we're
going
to
be
building
an
otc
desk
where
the
trades
are
atomic
and
quote
unquote
trustless,
so
you
don't
have
to
rely
on
the
otc
desk
right.
We
don't
have
to
rely
on
them
to
keep
their
promise.
A
A
A
It
can
also
stop
quoting
when
the
market
is
crazy,
so
something
like
uniswap
famously
provides
liquidity
at
all
times,
even
when
the
market's
going
crazy-
and
we
don't
actually
know
what
the
right
prices
are.
So
our
otc
desk
contract
is
going
to
allow
us
to
make
higher
profits
because
we're
going
to
be
able
to
stop
quoting
when
we
don't
know
what
the
price
should
be.
A
Let's
see,
so
our
otc
desk
contract
is
also
going
to
be
able
to
trade,
fungible
and
non-fungible
digital
assets,
and
this
is
actually
without
doing
anything
extra.
This
is
just
part
of
our
platform,
part
of
what
I'll
go
into
in
a
bit
the
ertp
layer,
which
is
our
token
layer,
and
it
also
uses
another
contract
which
is
our
covered,
call
option
contract
as
a
reusable
component.
A
A
So
first,
of
course
this
is,
you
know
the
cosmos
code
with
us
right.
We
are
built
on
top
of
cosmos.
On
top
of
tendermint,
we
will
be
deploying
a
public
blockchain
built
on
tendermint,
with
d5
integrated
from
the
ground
up.
A
On
top
of
that
we
have
the
gork
vm,
and
this
is
what
provides
the
distributed:
javascript,
runtime
environment.
So
all
of
our
smart
contracts
are
written
in
a
subset
of
javascript
and
you're,
going
to
see
some
some
interesting
ways
in
the
interesting
ways
that
we
make
calls
to
reflect
the
distributed
aspect
of
things.
So
there
are
some
things
where
the
objects
are
going
to
be
remote
to
where
we're
coding
and
we're
going
to
have
to
call
it
in
certain
ways.
A
A
All
right,
so
can
everyone
see
my
screen
now
yeah
great,
so
let's
go
ahead
and
get
started.
I
am
going
to
assume
that
people
have
followed
the
getting
started
instructions
on
our
website
and
that
you
have
a
local
version
of
our
example.
Encouragement
app,
I'm
going
to
walk
through
a
little
bit
of
that,
but
mostly
I'm
going
to
assume
that.
So,
if
you
haven't
gotten
to
that
point,
please
head
over
to
our
website
agoric.com
and
go
to
the
documentation
page
and
it'll
show
you
how
to
get
started.
A
So
I'm
going
to
be
using
node
14
throughout
this.
So
let's
see
so
I'm
going
to
type
in
a
gorica
knit
otc
desk.
A
So
this
will
take
a
little
bit
so
there
we
go
and
then
we're
going
to
be
working
on
specifically
the
contracts
today.
But
this
sampled
app
that
you're
given
has
a
front
end.
It
has
the
deploy
scripts.
It
has
everything
that
you
need
to
kind
of
get
your
dap
up
and
running,
but
we're
going
to
be
focusing
specifically
on
the
contracts
today.
So
let's
cd
into
the
contract
directory
and
let's
do
a
yarn
test
there
and
see
how
we're
doing.
A
A
Someone
asked
if
we
can
make
the
font
larger
for
the
terminal.
Oh
the
font,
larger,
larger
sure.
Let's
see,
let's
see
if
this
does
it
is
that
better
we're
actually
going
to
be
switching
to
vs
code
at
this
point,
so
hopefully
that
will
help
looks
good.
Okay,.
A
All
right
so
in
our
sampled
app
that
we
got
there
is
a
contract
folder
and
within
that
there's
a
source
folder
and
a
contract
file.
So
what
we
are
going
to
do
is
actually
take
out
most
of
this
contract
file.
A
I
just
have
a
blank
contract
file,
okay
and
then,
let's
move
to
the
test
directory
where
there's
a
test
for
this
contract
and
let's
do
the
same
thing.
A
So
our
testing
framework
is
ava
and
we've
really
been
enjoying
it
so
far
and
the
cool
thing
is
that
what
you're
able
to
do
is
let's
go
ahead
and
get
our
testing
environment
up.
A
So,
that's
not
what
I
wanted.
Let's
try
this
again.
The
cool
thing
is
the
ability
to
just
be
able
to
run
it
and
with
a
watch
parameter
and
keep
it
going.
Let's
open
that
up,
let's
just
have
the
terminal
and
let's
take
a
look
at
explorer.
Okay,
all
right!
This
is
what
I
wanted.
Okay,
so
we're
in
the
otc
desk
right
now,
let's
move
to
contract
and
let's
go
ahead
and
get
our
ava
test
going.
A
Npx
ava
and
then,
let's
actually
cd
out
of
that
pxava
and
then
test
testcontract.js,
all
right.
Okay,
so
we
didn't
have
any
assertions
right
because
we
took
all
of
them
out
all
right,
so
let's
actually
set
this
up
to
watch.
A
So
this
will
be
running
while
we
are
building
our
contract
all
right
and
let's
actually
change
our
well
we'll
do
that
later.
I
guess:
okay,
all
right!
So
first
we're
going
to
be
building
the
covered
call
contract.
So,
let's
start
with
test
driven
development
and
write
down
some
of
our
conditions
and
test
assertions.
A
So
normally
we
would
have
the
long
live
zoe
on
our
test
net,
but
in
this
test
we're
going
to
create
a
new
zoe.
So
that's
what
we're
doing
here
in
this
line
and
let's
actually
write
down
a
few
things.
So,
let's
have
let's
make
up
a
scenario
where
alice
is
going
to.
She
is
going
to
want
to
trade
trade.
Some!
A
Let's
see,
let's
say
that
she
has
some
some
nfts
that
are
magical
items,
so
she's
gonna,
try
to
trade,
a
magical
wands
item
for
some
fake
currency
that
we
call
mula,
okay
and,
let's
see
alice-
is
going
to
give
a
contract
invitation,
the
bob
who
will
provide
the
mullah
and
buy
the
magical
wand
item
okay
so
and
though
what
we
actually
want
to
provide
right
is
a
a
covered
call
option
for
bob
and
a
covered
call
option
is
the
right,
but
not
the
obligation
to
buy
the
magical
wand.
A
Okay.
So
let's
start
some,
let's
start
making
some
assertions,
so
let's
have
alice,
create
what
we
call
an
installation.
So,
let's
see,
let's
create
a
cover,
call.
A
Installation
all
right,
so
this
is
this-
is
the
first
thing
that
we
need
to
do
and
you
may
notice
that
I'm
using
this
e
notation.
A
So
what
this
e
is
is
a
way
for
us
to
call
remote
objects
and
we
will
get
a
promise
back,
so
we
can
call
remote
objects
as
if
somewhat
as,
if
they
were
local,
without
having
to
use
any
different
api
without
having
to
use
any
different
messaging.
A
It
just
works,
so
I
can
call
a
method
on
this
remote
object.
As
long
as
I
use
this
e-notation
all
right,
so
first
we're
going
to
have
to
bundle
our
software.
So,
let's
see
so
we
have
the
path
here.
A
So
what
I'm
gonna
do
is.
I
am
going
to
actually
bundle
it.
So,
let's
call
that
covered
call
bundle
and,
let's
see,
await
bundle
source.
Let's
rename
this
to
cover
call.
A
A
All
right,
okay,
so
let's
just
do
a
quick
test,
so
an
ava
t
dot
is
is
just
a
test
of
equality.
So,
let's
test.
A
All
right,
yep
cool
it
passed
all
right,
so
let's
actually
make
some
digital
assets
for
alice,
so
we're
gonna
use
ertp
to
do
this.
Let's
first
create
a
magical
item,
kind
of
meant.
A
So
in
in
ertp,
I'm
going
to
assume
here
that
people
have
read
a
little
bit
of
our
documentation
but
I'll
try
to
explain
as
well
in
ertp
to
create
any
kind
of
digital
assets
you
have
to
hold.
This
object
called
a
mint
and
we're
going
to
create
that,
and
it
comes
as
part
of
this
kit
of
information
about
this
type
of
digital
asset.
So
there's
going
to
be
other
objects
in
there,
such
as
a
brand
which
specifies
the
type,
an
issuer
which
is
kind
of
the
publicly
accessible
facet
or
object.
A
That's
part
of
this
meant
that's
actually
publicly
accessible,
and
so
you
can
give
the
the
issuer
to
other
people
and
they
can
use
that
to
validate
their
payments.
So
let's
go
ahead
and
create
that.
So
let's
call
this
the
magic
item
kit
and
we're
going
to
be
using
ertp
here.
So
we
are
going
to
make
the
issuer
kit.
Sorry,
I
have
two
cats
in
the
background,
so
they
might
make
some
noise
at
some
point.
A
Let's
see
so,
let's
call
this
magic
items
and
we
are
going
to
need
to
for
it
to
be
a
non-functional
token,
we're
going
to
have
to
use
a
specific
kind
of
map
here.
So,
let's
see
sorry,
I
can't
see
any
of
the
comments
right
now.
So
let
me
know
if
there
are
any
questions,
so
we
are
going
to
say
that
this
is
a
particular
type
of
amount
math
and
let's
go
ahead
and
import.
This
see.
A
All
right,
so
we
imported
math
kind
from
ertp
that
gave
us
this
string
set,
and
so
what
this
means
is
that
for
any
kind
of
magical
object
or
a
magical
item
that
we
want
to
create,
we
can
describe
it
as
a
string.
That's
part
of
a
set,
so,
let's
see
so
an
example
of
of
this
would
be
something
like.
A
Sword,
one
or
magic
wand
right,
so
you
can
use
any
kind
of
kind
of
string
here
and
it'll
work
all
right.
So
we've
created
our
the
mint
for
our
magic
items.
A
And
for
that,
we're
going
to
use
the
default
math
kind,
which
is
just
natural
numbers,
so
basically
what's
happening
here
under
the
hood-
is
that
for
ertp
to
know
how
to
deposit
things
in
purses
or
withdraw
things
from
purses.
It
needs
to
know
how
to
add
and
subtract
digital
assets,
and
that
may
vary
a
lot
based
on
what
kind
of
digital
asset
it
is
right.
A
So
if
it's
just
a
currency,
what
we're
dealing
with
is
just
natural
numbers,
so
the
value
of
mula
might
be
something
like
20
or
44
right
or
a
thousand.
A
But
the
value
of
our
magical
items
might
be
something
like
sword,
one
right,
so
this
is
the
way
that
you
can
create
a
fungible
and
non-fungible
tokens
in
ertp
and
I'm
kind
of
glossing
over
this
right
now.
But
if
this
is
still
confusing,
please
take
a
look
at
our
documentation.
A
All
right,
okay,
so
our
one
test
still
passes.
We've
created,
we've
started
to
create
the
mints
for
our
items,
and
so
let's,
let's
go
ahead
and
meant
some
things
that
we
can
give
to
alice.
A
So,
let's
see,
let's
have
alice
start
with
this
magic
wand
that
we
made
so
first,
let's
create
an
amount.
A
And
what
an
amount
is
is
kind
of
the
description.
It's
not
actually
the
value
itself.
So
an
amount
is
like
saying:
hey
I'll,
give
you
five
dollars
right
like
when
you
save
five
dollars
in
that
statement,
you're
not
actually
transferring
anything
you're
just
talking
about
it
right.
So
that's
what
an
amount
is,
and
so
that's
different
than
a
payment
in
our
system
which
actually
holds
value.
A
A
A
And
we're
going
to
mint
this
specific
amount.
So
again,
the
amount
is
just
the
description,
the
payment
that
we
have
just
minted.
So
this
is
the
only
way
to
actually
create
value
in
the
system.
This
payment
is
what
actually
has
value
all
right.
A
So
let's
do
just
a
little
check
here.
Okay,
oops,
let's
see
it
said
it
failed.
I
think
that
was
okay.
So
here's
one
slightly
tricky
thing.
So
we
have
this.
This
helper
called
hardin
and
what
hardin
does
is
it
effectively?
Does
a
deep
freeze
of
of
an
object
such
that
it
can
be
passed
to
someone
else
and
they
can't
alter
any
of
the
properties.
A
All
right-
and
I
don't
if
you
guys-
have
set
up
the
the
fix,
eslint
and
fix
prettier
errors
on
save
it's
so
nice
just
being
able
to
fix
that
automatically
all
right.
Okay,
so
we
have
our
magic
wand
payment.
So
let's
go
ahead
and
create
some
mula
or
actually,
let's
not-
let's
not
do
that
for
alice,
we'll
do
that
for
bob
okay.
A
So
let's
go
ahead
and
create
a
small
test
here
that
will
just
show
that
we've
created
something
of
value.
So
what
we're
going
to
do
is
we're
going
to
use
the
magic
item
kit
issuer
to
confirm
the
payment
and
give
us
the
amount
back.
So
let's
just
confirm
that
the
amount
is
in
the
payment
is
the
same
as
what
we
meant.
So
this
is
a
dumb
little
test,
but
it'll
help
us.
A
And
let's
confirm
that
that
is
equal.
A
Oh,
and
it
is
a
promise-
so
let's
add
an
await
there,
all
right
so
that
passes
so
this
payment
has
the
amount
or
has
the
has.
The
balance
of
the
magic
wand
amount
that
we
made
all
right,
great,
okay.
A
So
so
far
we
have
a
our
code
installed
on
zoe,
for
this
covered
call
that
we're
going
to
be
making
right
now
it
is
just
this
blank
contract,
so
let's
actually
have
alice,
create
an
instance.
So
first,
let's
see
so
we're
going
to
be
using
zoe.
For
this
we're
going
to
be
calling
start
instance,
which
is
the
way
to
take
the
code
that
we
have
installed
and
actually
create
a
smart
contract
instance,
something
that's
running
so
we
are
going
to
use
the
covered.
A
A
So
right
now
that
is
undefined,
so
our
tests
aren't
passing,
but
let's
go
ahead
and
define
this
all
right,
so
we're
going
to
use
hard
in
there
to
freeze
it
and,
let's
use
the
keywords,
underline
asset
and
let's
say
that
we're
gonna
put
up
the
magic
wand
amount.
A
A
So
let's
say
that
that
type
is
the
mullah
issuer,
all
right.
Okay,
so
let's
see
cannot
destructure
property
creator
facet
of
undefined
decide
is
undefined
all
right.
So
let's
go
back
to
our
smart
contract
and
all
of
the
smart
contracts.
They
must
have
this
particular
format.
They
must
have
the
start,
function,
that's
exported
and
that
start
function
takes
in
zcf,
which
is
the
what
we
call
the
contract
facet
side
of
zoe.
A
It
has
a
number
of
things
that
it
can
return,
so
it
can
return
a
invitation
that
gets
sent
back
to
the
creator.
It
can
return
what
we
call
a
creator
facet,
which
is
an
object.
That's
kind
of
the
admin
object
that
gets
returned
to
the
creator
or
it
can
return
what
we
call
a
public
facet,
which
is
an
object.
That's
going
to
be
available
to
everyone.
A
A
And
in
order
to
create
an
invitation
within
this
contract,
we're
going
to
call
a
certain
method
on
zcf,
which
is
the
make
invitation
method
all
right,
so
the
make
invitation
method.
It
requires
a
an
offer
handler
function
and
I'll
go
into
this
in
a
bit.
But
let's
just
let's
just
fill
it
in
for
now.
So
we're
going
to
call
this
make
the
call
option
function
and
it
needs
a
description.
So,
let's
just
call
it
make
call
option
and
any
custom
properties,
but
we'll
leave
that
out
for
now
all
right.
A
Okay,
let's
see
if
this
passes
cool,
so
we
are
going
to
get
a
creator
invitation
back.
A
So
this
is
so
alice
is
calling
start
instance
with
this
installation
right
with
the
actual
covered
call
code,
which
is
this
that
we
are
still
building
since
we
returned
a
creator
invitation
here,
it's
getting
sent
back
out
to
her
here
so,
let's
add
a
little
test
to
make
sure
that
this
is
actually
a
real
zoe
invitation.
So
this
zoe
invitation
is
effectively
an
ertp
payment
that
allows
you
to
join
a
contract,
so
I'll
go
over
that
again
in
a
bit.
A
So
it's
okay,
if
it
doesn't
make
sense
right
now,
but
let's
add
that
test.
A
First,
let's
actually
get
the
zoe
invitation
issuer.
So
back
up
here
in
the
the
magic
item
kit
in
the
moonlit
kit,
we
saw
that
the
issuer
was
part
of
those
kits
right.
So
the
issuer
is
a
thing
that
can
confirm
payments
for
us.
It
can
allow
us
to
claim
them
to
make
them
exclusively
ours.
It
can
do
a
large
number
of
things,
but
it's
basically
the
source
of
truth
of
whether
a
payment
has
value
or
purse
has
value.
A
To
get,
let's
actually
say,
let's
just
ask
it
if
it's
live,
so
this
will
ask
the
issuer.
Do
you
actually
know
about
this
payment?
Is
it
something
that's
in
your
system.
A
Oh,
it's,
not
true!
Okay,
let's
see
what's
going
on
here.
Okay,
so,
let's
add
an
await
here,
all
right
cool,
so
that
passes
all
right
excellent.
So
let's
go
ahead
and
move
on
so
so
alice
has
this
invitation?
A
She's
gonna
want
to
actually
escrow
her
magic
wand
and
when
she
escrows
her
magic
wand,
she
wants
to
get
an
invitation
for
bob
to
perform
the
other
side
of
the
trade
right,
so
alice,
escrows
the
magic
wand,
using
her
invitation
all
right
so
in
order
to
actually
escrow
and
make
an
offer
alice
is
going
to
have
to
call
zoe
offer
with
her
creator
invitation.
A
See
what
her
current
allocation
is
see,
how
things
are
going
and
actually
get
her
payouts
the
results
of
of
her
offer
back
at
the
end.
So
let's
go
ahead
and
define
her
proposal
and
her
payments
all
right.
So
alice's
proposal
is
going
to
have
a
couple
of
items.
So
first
there's
the
give
right
and
then
there's
a
want,
and
then
there
is
a
exit
rule.
A
Okay,
so
first
we
decided
that
alice
was
going
to
escrow
the
magic
wand
right
and
that
she
wants
moolah
back
all
right.
So
let's
call
this
underline
assets
underline
asset
and
the
amount
well
we're
gonna
just
use
this
amount,
so
she's
gonna
be
giving
this
amount,
and
this
again
this
is
just
the
description
right.
An
amount
is
just
a
description.
It's
the
payment
that
actually
holds
the
value.
A
So
let's
say
that
she
wants.
This
is
the
strike
price.
A
She's
gonna
want,
let's
say,
20
mula,
so
let's
define
that
okay,
so
21.
We
use
the
amount
math
that
we
got
from
the
issuer
kit.
A
A
So
we're
going
to
use
the
exit
rule
after
deadline
and
we
are
going
to
specify
a
timer
and
a
deadline.
Let's
say
the
deadline
is
two,
so
the
deadline
can
be
anything
that
the
timer
understands
so,
depending
on
the
timer,
it
could
be
block
height,
it
could
be,
could
be
some
kind
of
utc
time.
It
could
be,
could
be
anything
that
the
timer
understands
so
we're
agnostic
as
to
the
exact
format
of
that
it
really
depends
on
the
timer,
so,
let's
make
sure
to
actually
import
the
timer.
A
All
right,
so
this
is
just
a
tool
that
we
have
is
kind
of
this,
this
this
timer,
that
we
use
for
testing
and
things.
So
let's
go
ahead
and
make.
A
A
A
Let's
say
underline
asset
is
the
keyword
and
we
are
going
to
be
paying
the
alice
magic
wand
payment
all
right.
Let's
go
ahead
and
harden
this.
A
Okay,
so
cool,
so
so
that
worked,
but
there's
not
a
lot
going
on
in
our
contract.
Yet
right
so,
let's
add
a
few
more
tests.
So
let's
say:
let's
test
what
we
get
back
as
the
offer
result
so
alice's
seat.
Here
we
got
back
from
zoe,
so
that
means
that
alice's
seat
is
in
the
same
remote
area
as
zoe
is,
and
we
need
to
treat
it
as
remote.
So
we're
gonna
call
when
we
call
methods
on
it.
A
We're
gonna
use
e
as
the
eventual
send
so
let's
say,
get
offer
result
and
let's
confirm
that.
That
is
something
like.
A
A
That
in
our
offer
handler
here,
the
offer
result
is
whatever
we
send
back
here.
So
let's
say
what
do
we
say
it
was.
We
said,
made
option
with
no
period.
Okay.
B
A
All
right
is
that
better,
yes,
all
right
cool
okay,
so,
let's
see
so,
we
have
successfully
given
back
the
offer
result
that
we
want,
but
not
much
is
happening
still
right,
okay,
so
what
we
actually
want
here
is
we
want
to
make
an
option
for
bob,
so
we're
going
to
create
an
invitation
specifically
for
bob.
So
actually
we
want
this
to
be
a
an
invitation.
A
And
this
invitation
is
actually
going
to
be
an
option,
a
financial
option,
all
right.
So
let's
do
what
we
did
before
and
write
a
test
just
confirm
that
it
is
actually
an
invitation.
It's
not
going
to
be
yet
this
test
is
not
going
to
pass,
but
we
will
make
it.
A
So
all
right,
so
let's
do
what
we
did
before.
So
we
are
going
to
call
this
an
option.
Ccf
make
invitation.
A
Let's
call
this
exercise
option
because
that's
what
bob
will
be
doing
if
he
accepts
this
invitation
and
let's
call
it
exercise
option
again.
This
is
just
the
description
that
indicates
where,
in
the
code,
the
invitation
is
coming
from
all
right
and
let's
return
that
option.
Okay
and
let's
actually
spec
out
the
offer
handler
for.
A
Okay,
so
we
have
successfully
created
the
option
for
pop,
but
there's
no
trading
going
on
here
right.
So
if
we,
if
we
get
alice's
payouts
they're
not
going
to
resolve
so
let's
go
ahead
and
try
to
do.
A
A
All
right,
so
the
payouts
never
resolved,
and
so
the
test
failed
all
right.
Let's
see,
let's
see
how
we're
doing
on
time.
Okay,
so
let's
go
ahead
and
let's
have
let's
actually
do
a
trade
okay.
So
we've
we've
given
this
option
to
bob
and
it
has
this
exercise
option.
So,
let's
actually
so
the
the
offer
handler
it
has
a
seat
parameter
that
gets
passed
in
and
the
seat
is
effectively
the
position
in
the
contract.
A
So
when
alice
exercises
her
creator
invitation,
let's
call
that
the
celsi
and
when
bob
exercises
the
option
that
he
got.
Let's
call
that
the
buy
seat-
okay,
so
it's
only
within
the
exercise
option
offer
handler
that
we
actually
want
to
perform
the
trade,
because
that
is
when
bob
has
escribed
his
sides
of
things
too.
A
So,
let's
do.
Let's
use
a
helper
called
swap
exact
and
we're
going
to
pass
in
zcf
there
and
we
are
going
to
add
in
the
celsi
in
the
buy
seat
and
let's
go
ahead
and
import
that
so
in
order
to
import
things,
we
have
all
of
these
helpers
that
are
come
from
the
igorix
zoe
package
under
contract
support.
A
So,
let's
import
swap
exact
there
and,
let's
see
so
what
are
we
missing?
So,
let's
return
an
offer
result.
So
let's
just
send
a
message
saying
the
offer
was
exercised
right
and,
let's
see
so,
we
have
a
failure
there.
It
still
has
not
resolved.
A
So
that
is
because
bob
has
not
been
offering
his
sides
of
things
right.
So,
let's
actually,
let's
actually
add
bob's
position,
so
bob
is
going
to
be
fulfilling
the
other
side
of
this
trade
he's
going
to
be
submitting
20,
mullah
and
getting
the
magic
wand.
So
let's
go
ahead
and
see
things
from
his
position
all
right.
So
let's
say
that
bob
gets
his
invitation.
A
Bob
receives
the
invitation
from
from
alice,
he
doesn't
trust
alice,
so
he
wants
to
inspect
the
invitation.
A
All
right,
so
the
first
thing
that
bob
can
do
is
claim
the
invite
and
that
will
effectively
make
it
exclusively
his.
So
you
can
use
the
invitation
issuer
to
claim
bob's
invitation
and
let's
call
that
a
claimed
invitation
alright
and
now
he
can.
He
can
get
some.
He
can
look
at
the
invitation
and
inspect
it
and
get
some
details
on
it
and
make
sure
that
those
match
what
he
wants.
So,
let's
call
a
method
on
zoe
called
get
invitation,
details
and.
A
Let's
say
that
the
details-
installation
well
that
should
match
the
cover,
call
installation
right.
So
bob
can
check
the
code.
The
code
of
the
contract
he's
invited
to
is
what
he
expects.
A
All
right
so
that
passes,
let's
see
he
can
check
and
see
what
has
actually
been
escrowed.
So
let's
call
that
underlying
assets
and
this
test
is
not
going
to
pass
yet.
A
All
right,
so
our
tests
are
currently
failing,
but
that
is
to
be
expected,
let's
say
so
in
order
for
bob
to
actually
effectively
make
his
offer
he's
gonna
need
to
know
what
the
deadline
is
right.
So
let's
call
that
the
timer
the
time
authority
and
let's.
A
A
Deadline-
and
let's
see
I
called
this
time
authority
all
right,
so
the
underlying
assets
are
whatever
alice,
has
escrowed
right,
so
we're
going
to
say
that
this
is
sell
seat
get
proposal.
So
this
is
just
getting
the
proposal
that
alice
made,
and
this
is
what
she
gave.
The
strike
price
is
what
alice
wants.
A
The
time
authority
is
the
timer
that
she
used
for
her
celsi.
B
A
Yeah
yeah,
that's
a
very
good
question,
so
there
actually
is
going
to
be
an
offer
on
both
sides.
If
bob
chooses
to
perform
the
trade,
so
he
he'll
get
this
option,
which
is
an
invite
to
join
the
contract
and
he
can
choose
not
to
join
the
contract,
but
he'll
still
have
that
option
as
a
as
a
zoe
invitation
and
simultaneously
an
ertp
payment
and
financial
digital
asset.
A
So
we
have
a
lot
of
concepts
coming
in
at
once
here,
but
but
yeah,
so
we're
going
to
create
an
option
for
bob
and
we
are
going
to
right
now
he's
just
inspecting
that
so
this
is.
This
is
actually
this
claims
invitation.
Let
me
put
this
here.
A
This
is
this
is
the
option,
so
he
has
the
opportunity
to
perform
to
be
part
of
this
trade,
but
not
the
obligation,
and
so
he
could
take
this
and
sell
this
to
someone
else
in
a
different
contract
which
is
really
cool.
It's
kind
of
we've
kind
of
got
inception
going
here.
One
layer
can
actually
feed
into
another
layer,
so
so
he
could
go
and
and
sell
this
or
he
can
use
it
to
perform
the
trade.
So,
just
to
test
the
contract,
we're
going
to
use
this
to
actually
perform
the
trade.
A
A
So,
normally
in
a
contract,
the
deadline
is
optional.
Currently
in
the
covered,
call
that
we're
about
to
build
we're
going
to
require
it,
and
I
can
show
you
how
to
require
it
in
the
code,
but
the
reason
why
we
want
to
require
why
we
want
to
require
it
is
because
we
want
the
the
quote
to
not
be
good
forever
right.
So
prices
move
things
change
you
don't
want
to
be
making
quotes
that
are
always
going
to
be
good
right,
and
we
also.
A
We
also
don't
want
alice,
to
be
able
to
withdraw
her
assets
before
bob
makes
the
trade
right.
Then
then
it
wouldn't
it
wouldn't
be
a
trustworthy
contract
we'd
be
depending
on
alice
to
keep
her
promised
to
keep
the
assets
there
so
having
the
alice,
having
the
deadline
or
having
the
exit
rule
of
after
deadline
that
ensures
that
alice
cannot
withdraw
her
assets
until
after
the
deadline
has
passed.
A
All
right,
so,
let's
check
our
tests
cool.
They
are
passing
all
right,
so
bob
is
able
to
inspect
his
invitation
and
he's
able
to
see
that
alice
has
put
in
underlying
assets
that
are
of
the
particular
amount
of
this
magic
wand.
He's
able
to
see
that
the
amount
that
she's
requesting
the
strike
price
is
20
mula
and
he's
able
to
see
that
he
better
move
quickly,
because
the
deadline
is
at
time
2
according
to
this
timer
okay.
A
A
A
A
Alice's,
so
he
is
going
to
give
and
his
keywords
could
be
anything
here-
I'm
just
going
to
keep
the
same
ones
for
consistency's
sake,
so
he
is
going
to
be
providing
20
mula
he's
going
to
want
the
magic
wand
amount.
A
Okay,
magic
wand
amount,
and
one
thing
that
I
think
is
really
cool
about.
How
we've
set
up
ertp
in
these
contracts
is
that
it
doesn't
matter
the
contract
doesn't
care
whether
it's
a
fungible
or
non-fungible
good.
It
treats
it
all
the
same,
because
we
have
the
amount
math
that
we
used
up
over
here
that
we
created
as
part
of
the
the
issuer
kit
that
handles
all
of
the
arithmetic
and
the
calculations
for
us.
A
All
right,
so
we
have
bob's
proposal
there
and
bob
can
actually
use
the
default
exit
rule.
But
I'll
put
it
in
here
anyways,
so
bob
connects
it
on
demand,
and
so
that
means
that
he
can
pull.
He
can
pull
out
his
assets
at
any
point.
He
can
exit
his
seat
at
any
point,
and
this
is
fine,
because
no
one's
relying
on
on
bob,
he
gets
in
the
option
the
opportunity
to
perform
this
trade,
but
no
obligation
to
all
right.
A
So
let's
actually
create
those
payments
for
bob
and
we
need
to
use
the
same
format
that
he
used
for
the
give.
So
there's
going
to
be
a
strike
price
and
let's
call
this
bob
mueller
payment.
A
So
let's
go
back
up
here
and
normally
bob
would
not
have
any
access
to
the
mint
for
this,
and
so
we're
just
gonna
pretend
that
these
pieces
of
code
are
separate,
but
let's
actually
create
the
payment
for
bob
up
here.
A
A
A
And
again,
this
is
going
to
be
remote
because
we
got
it
from
zoe,
so
we're
going
to
need
to
call
it
with
e
the
eventual
send
and,
let's
add
a
test
here-
we'll
await
that
and,
let's
see,
let's
say,
trade,
successful.
B
A
Cool
so
that
passes
all
right,
so
no
one
is
getting
their
payouts
yet
so
let's
actually
put
that
in.
So
let's,
let's
take
the
swap
out
for
one
second,
and
let's
see
what
happens
so,
let's,
let's
look
at
bob
and
let's
get
his
payout
for
the
underlying.
A
A
Okay,
so
we
took
the
swap
out
so
bob
without
any
swap
without
any
kind
of
trade.
Bob
should
just
be
getting
what
he
got
back.
So,
let's,
let's
take
out
that
swap
and
let's,
let's
exit
bob's
seat
without
doing
anything.
A
Okay,
so
let's
write
some
tests,
let's
say
deep,
equal
and
let's
use
the
the
magic
item.
Kit
issuer
to
get
the
amount
of
bob's.
A
A
And
what
he
wants
is
the
actual
magic
wand
right.
So
let's
put
that
in
here,
it'll
fail,
but
at
least
we
know
where
we're
headed
and
he
does
not
want
any
moolah
back
because
that's
what
he
gave
so,
let's
add
a
test
for.
A
A
All
right,
okay,.
A
All
right,
so,
as
we
can
see,
this
is
failing
it
it
we
did
not
get
what
we
wanted
yet.
So
let's
go
ahead
and
let's
take
this
part
out
and
let's
perform
this
swap.
A
So,
let's
see
if,
if
bob
actually
got
what
he
wanted
fantastic,
so
let's
make
sure
that
alice
got
what
she
wanted.
So,
let's
just
just
take
this
and
change
it
for.
A
A
Are
there
any
questions
on
this
while
I'm
going
through
and
changing
this
dean.
B
I
answered
one
question
about:
how
could
the
how
can
the
option
be
resellable
if
it's
not
minted
and
just
saying
that
it's
zoe,
that
does
the
minting.
A
Yeah
yeah,
so
that
is
a
that
is
an
excellent
question,
yeah
so
with
zen
zoe
there's
this
invitation
issuer
and
this
invitation
mint
that
mints
the
invitation
so
back
when
we
called
zcf
make
invitation
that
was
under
the
hood
minting
invitations
minting
ertp
payments.
That
zoe
knows
about.
B
A
Yeah
yeah,
it
is
yeah,
the
invitation
is
a
non-fungible
token
and,
as
you
saw,
we
are
able
to
there's
a
helper
here
called
get
invitation
details.
But
if
we
just
called
I'll
write
it
here
in
a
comment,
if
we
just
called
invitation,
issuer
get
amount
of
claimed
invitation
and
then
we
we
did
a
little
bit
of
fussing
with
what
we
got
back.
A
We
would
get
this
same
information,
so
so
we're
giving
you
some
helpers
here,
but
under
the
hood,
it's
really
just
the
same
kind
of
issuer
that
we've
seen
in
in
the
past,
with
information
in
the
value
of
the
digital
assets.
A
All
right,
so,
let's
actually
change
this
so
that
alice
we
expect
that
alice
is
going
to
be
getting
empty.
So
let's
do
let's
write
that
up
so
mount
math
get
empty
and
again
the
really
nice
thing
is.
I
don't
have
to
care
what
empty
is.
I
don't
have
to
care
whether
it's
a
fungible
or
non-fungible
token,
because
the
amount
math
handles
it
for
me
and
she
is
going
to
get
her
20
ml
back
or
actually
20
moola
from
bob
okay.
A
So,
let's
see
if
that
passes
cool,
so
it
took
us
a
bit,
but
in
about
an
hour
we
were
able
to
create
a
a
complete
covered
call
contract.
So
I
hope
you
all
were
able
to
to
follow
up
on
at
home
and
we're
gonna
move
on
to
the
octc
desk
contract.
Unless
there's
any
further
questions.
A
No
questions
cool
all
right,
so
let's
go
ahead.
Let's,
let's
stop
this:
let's
go
ahead
and
rename
this
to
covered
call
and
let's
rename
this
to
test
code,
recall
all
right.
So
let's
create
a
new
file
here.
Let's
call
this
otc
desk
and
let's
create
a
new
test
file.
Let's
call
this
test
otc
disk
all
right,
so,
let's,
let's
basically
reuse
what
we
had.
A
So,
let's
paste
this
in
and
let's
actually
strip
out
all
of
the
internals
like
we
did
before.
A
Let's
do
a
similar
thing
to
the
otc
desk,
but
let's
actually
keep
let's
keep
the
bob
side
of
things,
because
what
we're
going
to
be
doing
is
that
alice
is
going
to
be
creating
quotes
using
her
otc
desk
contract
but
from
bob's
side
he's
going
to
be
receiving
options
in
the
same
exact
way
that
he
received
an
option
from
the
covered
call.
A
But
let's,
let's
rewrite
alice's
part.
A
Okay,
so
what
alice
is
going
to
want
to
do
is
she's
going
to
want
to
be
able
to
do
three
things
she's
going
to
want
to
add
inventory.
A
So
the
quotes
will
be
in
the
form
of
a
free
option,
and
so
she
could
take
this
option
and
sell
it
to
bob.
But
we're
just
gonna
give
it
to
him
here
given
to
bob
okay.
A
So
let's
go
to
our
contract
and
just
start
adding
some
things
so,
rather
than
starting
with
a
creator
invitation,
as
we
saw
before,
let's
actually
return
another
one
of
the
things
that
we
can
return,
which
is
a
creator
facet,
and
this
is
just
an
object-
that
the
creator
of
the
contract
instance
can
use
without
having
to
escrow
anything.
Yet
all
right-
and
this
is
just
a
plain
object.
So
let's
just
fill
that
in.
A
Quote:
okay,
so
going
back
to
our
tests,
we're
still
going
to
be
using
this
covered
call
path,
but
let's
rename
it
to
covered
call
and,
let's
add
another
path
here-
for
the
otc
desk
contract.
So
we're
going
to
be
using
both
of
these
contracts,
and
this
is
what
dean
likes
to
call
the
defy
legos
prior
to
things
all
right.
A
Okay,
so
we
still
have
zoe
here
we
still
want
to
be
able
to
use
the
covered
call
installation.
So
let's
keep
those
tests,
but
let's
do
the
same
thing
for
our
new
otc
desk
contract.
B
No
not
yet
other
than
lots
of
people
like
to
call
them
d5
legos,
and
this
is
where
the
magic
starts
to
happen.
Rubbing.
A
A
Yeah
yeah
yeah:
this
is
where
the
legos
all
come
together:
okay,
so
so
now,
we've
installed
the
covered
call
and
the
otc
desk
contract
that
we're
still
building
so
and
let's
actually
use
the
same
items
that
we
used
before.
So
we
had,
we
created
the
mint
for
the
magical
items
for
non-fungible
magical
items
and
we
created
the
meant
for
the
fungible
tokens,
the
mula,
which
is
our
fake
currency,
and
we
had
these
specific
amounts
that
we
used.
So
we
had
this
magic
wand
amount.
A
We
had
this
20
mula
amount
all
right,
so
let's
go
ahead
and
write
some
tests
for
alice,
so
alice
is
going
to
want
to
be
able
to
well,
first
she's,
going
to
want
to
be
able
to
actually
make
a
contract
instance
of
the
otc
desk.
So
let's
go
ahead
and
do
that.
So
we
call
start
instance
with
our
otc
desk
installation
and
we
don't
need
to
put
in
any
issuers
actually.
So
let's
call
this
undefined
for
now
and
then
for
the
terms
we're
going
to
be
using
the
covered
call
contract
within
this.
A
Okay,
so
on
that
creator,
facet-
and
let
me
back
up
a
second
so
again-
we're
calling
this
method
on
zoe.
What
we
get
back,
we're
gonna
have
to
await
because
it's
a
promise
and
then
any
object
that
we
get
back.
That's
not
a
record.
That's
not
just
a
flat
flat
object
with
with
keys
and
non-function
values,
anything
that
we
get
back.
That's
actually
a
real
object
with
methods
that
actually
is
going
to
be
also
remote.
A
So
we
have
some
more
documentation
on
how
all
this
works
on
our
website,
but
I'm
not
going
to
go
into
it
right
now,
but
we
are
going
to
let's
see,
let's
call
the
ad
inventory
method
and
in
order
to
add
inventory
or
let's
see
sorry
actually,
what
we
want
to
be
able
to
do
rather
than
add
inventory
is
we
want
to
make
an
invitation
to
add
inventory,
make
add
inventory
invitation.
A
This
will
allow
us
to
easily
escrow
payments
within
zoe
without
having
to
handle
it
within
the
contract
itself.
So
that's
why
we're
going
to
make
an
invitation
because
we're
going
to
actually
be
putting
value
in
okay?
So
she
is
going
to
be
calling
make
ad
inventory
invitation
and
she
is
going
to
get
an
invitation
back.
A
Invitation
all
right-
okay,
let's
add
one
of
our
tests
from
before.
So
in
the
covered
call
we
tested
whether
the
the
invitation
that
we
got
back
was
actually
a
invitation
as
recognized
by
zoe.
So
let's
add
that
test
here:
let's
get
the
invitation.
A
A
Okay-
and
this
is
the
ad
invitation-
add
inventory,
invitation
all
right,
so
let's
actually
go
ahead
and
get
our
testing
set
up
here.
So
before
we
were
testing
the
covered
call
now
we're
going
to
be
testing
our
otc
desk
contract.
A
A
Let's
also
say
that
the
description
is
at
inventory
and
this
description
is
just
saying
where,
in
the
code
this
invitation
came
from
and
let's
return,
this
invitation.
A
And
let's
just
kind
of
start,
this
offer
handler
all
right
and
let's
type
it.
A
So,
let's
say
seat
dot
exit
and
we're
gonna
be
doing
some
things
with
the
seat.
So
let's
see
what
happens
so
our
test
pass.
That's
great
all
right!
So
let's
write
some
more
code,
some
more
tests
and
then
we'll
go
back
to
the
contract.
So
alice
wants
to
escrow.
A
So,
let's
see
so,
let's
say
let's
say
actually
that
up
here
we're
gonna
mint,
a
whole
bunch
of
items
for
alice
and
bob.
So
let's
say
that
let's
say
that
alice
actually
gets.
A
Swords
all
right
and
this
right
now
this
is
just
the
amount,
so
we
haven't
minted
anything
yet
and
let's
make
let's
make
a
thousand
moolah
for
alice,
because
why
not?
A
These
are
moola
kit,
just
create
the
amount
first,
okay,
and
so
let's
go
ahead
and
create
alice's
inventory.
A
So
you
can
see
how
easy
it
is
to
mint
fungible
tokens
non-fungible
tokens.
It's
all
the
same
thing.
The
only
thing
that
changes
is
how
they
are
described
or
what
the
value
looks
like
all
right.
Okay,
so
this
is
alice's
inventory.
We
want
to
be
able
to
add
that
inventory,
so
we're
going
to
use
this
invitation
that
we
get
to
make
an
offer.
So
let's
call
this
the
alice
add
inventory
seat,
that's
what
we're
gonna
get
back.
A
A
A
Okay,
so
we
have
alice
adding
inventory
here,
but
we
haven't
yet
told
the
contract
about
magical
items
or
moolah,
so
zcf
doesn't
know
anything
about
the
issuers.
Yet
so
we're
going
to
need
to
add
that
part.
So
here,
when
we
say
make
add
inventory
contract,
let's
take
in
an
issuer
keywords
record.
A
And
let's
actually
make
sure
to
save
that
in
zcf
before
we
start
adding
anything
and
basically
what
this
is
doing
is
that
this
is
creating
a
local
amount
math
and
it's
saving
the
issuer
in
the
brand
to
zoe
so
that
it
knows
about
it.
So
then
anything
that
we
do
further
can
be
synchronous
we
don't
have
to.
Even
if
the
issuers
are
entirely
remote,
we
don't
have
to
make
any
remote
calls
when
it
comes
to
the
issuers
and
making
calculations.
A
So
in
order
to
do
that,
let's
import
save
all
issuers
from
the
contract
support.
This
is
a
nice
little
helper
here.
So
we're
going
to
say,
await
save
all
issuers
we're
going
to
pass
in
zcf,
because
it's
a
helper
and
pass
in
this
keyword
record
that
we
got
and
since
we
set
a
wait,
we
need
to
make
this
async
all
right.
A
A
A
And
let's
call
this
underline
asset
and
we're
gonna
gonna:
let's
see
we're
gonna
just
pass
in
the
magic
items,
kit
issuer
and
let's
call
this
strike
price.
A
Actually,
since
we
are
adding
inventory,
let's
just
call
this
magic
and
let's
call
this
muah
so
in
the
future,
when
alice
makes
quotes
she
could
she
could
be
trading
magic
for
moolah.
She
could
be
trading
lula
for
magic.
She
can
add
more
inventory
and
trade
for
different
currencies.
We're
not
stuck
with
just
these
currencies
or
just
these
digital
assets,
all
right.
So
when
she
adds
her
inventory,
her
proposal
has
give
want
and
exit,
so
she
is
going
to
be
giving
magic
and
it's
going
to
be
in
the
magic
items.
A
A
One
thing
that
we
could
do
here,
so
this
is
kind
of
an
extra
thing
that
we
could
do
if
we
wanted
to
really
take
this
to
the
next
level
is
if
we
did
want
to
have
decentralized
inventory
collecting.
If
we
wanted
to
have
liquidity,
be
decentralized,
we
could
use
something
like
uniswap
does
here,
where
we
could
hand
out
invitations
to
add
inventory
and
then
give
back
tokens
representing
a
certain
percentage
of
the
capital,
a
certain
percentage
of
the
inventory,
but
we're
not
going
to
use
do
this
here.
A
We're
just
going
to
have
alice,
has
sole
ownership
of
all
of
the
inventory
and
she's
able
to
add
things,
and
it
just
gets
dropped
into
the
contract.
Okay,
so
we're
not
going
to
want
anything
and
the
exit
rule,
we
don't
care
about
either.
So
actually,
let's
take
both
of
those
out
and
just
use
the
default
all
right.
So,
let's
see
so
it
is
complaining.
It
says
that
there
is
a
payment
not
found,
let's
see
here,
oh
so
that
is
because
we
have
not
actually
put
in
our
payments.
A
So
let's
say
that
it
is
the
alice
magical
items,
payment.
A
All
right,
let's
see
if
that
satisfies
the
test
cool,
so
that
passes
all
right
so
right
now
nothing
is
happening
right,
there's,
no
reallocation!
If
we
were
to
check
the
the
payouts
for
alice
exercising
this
invitation
for
for
making
this
offer
to
add
inventory,
she
would
just
get
her
stuff
back.
So
let's
actually
take
the
items
that
alice
adds
and
add
them
to
the
contract.
A
So
we're
going
to
do
something
a
little
bit
tricky
we're
going
to
create
an
internal
seat
just
for
this
contract
that
will
be
used
as
the
store
of
all
of
the
inventory.
So
let's
call
that
the
market
maker
receipt.
A
A
So,
let's,
let's
use
another
helper
here,
let's
use
trade
and
what
trade
does
is
that
you
can
specify
effectively
the
delta
between
two
seats
and
it'll
perform
the
reallocation
for
you.
So
we
saw
earlier
the
swap
exact
which
took
everything
from
one
seat
and
gave
it
to
the
other
seat
and
vice
versa.
A
A
So
the
market
maker
seat
is
actually
going
to
gain
the
all
of
the
current
allocation
of
the
seat,
all
right,
and
then
we
have
a
second
seat
here,
which
is
just
the
seat
representing
this
particular
offer
of
alice.
Adding
inventory
and
that's
heat
is
going
to
gain
nothing.
A
Okay,
all
right,
so,
let's
actually
add
a
little
check
here,
so
we
can
check
the
proposal
shape.
Let's
make
sure
that
the
want
of
the
seat
is
not
anything
so
the
reason
why
we
don't
want
the
seat
to
want
anything.
It's
because
it's
not
going
to
get
anything.
So
if
it
wants
anything,
this
isn't
going
to
pass
all
right
cool.
A
So,
let's
see
so
we
only
have
about
30
minutes
left.
I
think
we're
going
to
be
able
to
get
through
this.
Do
we
have
any
questions,
anything
that
I'm
missing
dean
nope
so
far,
so
good
cool,
all
right,
so
alice
was
able
to
add
her
inventory.
A
A
And
let's
say
inventory
added
is
what
we
want.
So
that's
going
to
fail,
oh
because
it
needs
to
be
on
the
seat.
A
Since
we're
going
to
keep
the
same
test
for
bob,
let's
actually
have
alice
make
a
quote.
That's
of
the
same
amounts
as
before,
so
she's
going
to
trade,
a
magic
wand
for
20
lula,.
B
There
is
a
quick
question
which
is
given
that
it's
a
one-sided
offer.
Why
is
the
make
inventory
using
offers
here
instead,
instead
of
just
doing
it
directly.
A
Yeah
yeah-
that
is
a
very
good
question.
So,
as
you
can
see
in
in
this
we're,
not
wanting
anything
so
we're
not
really
checking
offer
safety
here.
But
what
we
are
able
to
do
is
we're
able
to
use
the
escrowing
capability
of
zoe
and
not
have
to
handle
that
within
the
contract
so
and-
and
that
is
really
nice,
because
we
would
have
to
somehow
maintain
purses
within
the
contract
that
escrowed
all
of
those
we'd
have
to
be
very
careful.
A
So
you
can
kind
of
think
of
it
as
I
like
to
think
of
it
as
almost
like
a
like
paypal
or
something,
if
we're
doing
if
we
were
doing
online
commerce,
so
zoe
is
handling
all
of
the
payments
for
us.
We
don't
have
to
worry
about
that,
but
that
does
mean
that
we
are
using
the
invitation
style
here
in
order
to
take
advantage
of
that.
A
Okay,
so
let's
actually
go
back
here,
let's
make
an
offer
here:
let's
make
a
quote
for
bob,
so
we're
gonna
use
our
creator.
Facet,
we're
gonna
call
make
quote,
and
we
haven't
written
this
yet
so,
let's,
let's
see
what
we
want
to
put
in,
let's
say
we'll
specify
the
assets,
the
price,
the
time
authority
and
the
deadline.
A
And
we
will
get
an
option
back
okay,
so
let's
let's
define
these
so
the
assets.
Let's
call
this
underline
asset
and
let's
actually
go
back
to
our
covered
call
and
get
these.
A
Okay,
so
it's
going
to
be
the
magic
wand
amount
is
what
alice
is
going
to
be
offering
bob
what
she
wants
from
bob.
Is
this
strike
price
which
we're
going
to
define
as
moolah20
and
the
time
authority?
A
A
So,
let's
test
that
this
option
is
actually
something
that
is
a
zoe
invite
it's
not
going
to
be
because
we
haven't
built
it
yet,
but
let's
go
ahead
and
test
that
okay,
so
that
is
false.
So
let's
go
ahead
and
write
the
make
quote.
So
we
said
it
took
in
assets,
price,
a
time
authority
and
a
deadline,
and
we
want
it
to
return
a
invitation.
A
So
actually,
rather
than
returning
the
invitation
there,
what
we're
going
to
want
to
do
is
create
a
new
covered
call
instance
like
we
saw
in
our
previous
test,
but
this
is
actually
going
to
be
within
the
contract,
so
this
is
going
to
be
where
the
d5
legos
come
in.
Okay.
So
first,
let's
up
here,
let's
make
sure
that
we
are
getting
that
the
term
that
we
passed
in
the
covered
call
installation.
A
A
All
right
so
within
make
quote:
let's
make
an
instance,
so
this
is
effectively
let's
go
back
to
what
what
alice
was
doing
here
when
she,
when
she
made
an
instance,
okay.
A
So
let's
copy
and
paste
that
in
okay,
so
we
had
an
issuer
keyword
record
and
we
had.
We
had
a
call,
a
start
instance.
So
we
want
to
keep
those
things.
Let's
add
eventual
send
here,
so
we're
going
to
import
e
from
gorick
eventual
send
and
the
reason
why
we
need
to
do
this
is
because
zoe
is
going
to
be
remote
even
from
our
contract.
A
A
All
right
cool,
so
we
got
the
creator
invitation.
We
want
to
actually
make
an
offer
so
we're
going
to
make
an
offer
in
the
same
way
that
alice
did
but
we're
going
to
make
it
from
within
this
contract.
So
we're
going
to
use
that
creator
invitation
we're
going
to
have
a
proposal
and
we're
going
to
have
payments
okay.
So
our
proposal
is
going
to
be
pretty
simple.
A
A
The
price
and
exit
is
going
to
be
after
deadline
and
the
timer
is
going
to
be
the
time
authority
and
the
deadline
is
going
to
be
the
deadline.
Okay.
So
this
is
going
to
be
very
similar
to
what
we
saw
alice
do
okay
and
then
for
the
payments,
we're
going
to
do
something
a
little
bit
tricky,
so
we
are
actually
going
to
be
taking
withdrawing
the
payments
from
the
market
maker
seat.
A
A
Let's
see
oh,
and
we
need
to
await
that.
Thank
you
type
system
and
let's
call
this:
the
cell
seat
cell
user
seat
so
by
user
seat.
This
is
this
is
something
that's.
On
the
user
side
side
of
things
normally
we're
talking
about
zcf
seats
when
we're
within
the
contract.
We
have
more
documentation
on
that
on
our
website,
but
this
is
going
to
be
as
if
we
were
alice
as
if
this
was
alice's
scene.
A
Okay.
So
what
we
saw
previously
was
that
alice
as
her
offer
result
got
an
option.
So,
let's
just
take
that
and.
A
Okay-
and
we
have
one
last
last-
remaining
task
to
do
for
this
method,
so
when
alice
actually
or
when
the
otc
desk
performs
this
trade.
What
we
saw
in
when
we
tested
for
alice
was
that
she
actually
got
payouts
back
right.
So
what
we
want
to
do
is
take
those
payouts
and
put
them
back
into
the
market
maker
seat.
A
So
let's
get
those
payouts
by
calling
get
payouts
and
there's
two
functions
here:
there's
get
payout
and
get
payouts
get
payout
gets
only
a
specific
payment,
given
a
keyword
and
get
payouts
gets
all
of
them,
so
we're
gonna
get
all
of
them
here.
A
Okay,
and
that's
going
to
be
a
promise
that
resolves
when
the
trade
actually
occurs.
So
we
don't
want
to
await
that.
Let's
add
it
then,
and
let's
call
the
outcome
payouts
and
then
what
we're
going
to
want
to
do
is
use
another
helper,
which
is
a
deposit
two-seat.
A
And
the
recipient
seat
is
going
to
be
in
the
market
maker
seat,
the
amounts-
let's
put
that
aside
for
now,
and
the
payments
are
going
to
be
the
payouts
okay,
so
we
set
a
weight,
so
we
need
to
make
that
a
sink
and
the
amounts
are
just
going
to
be
the
current
allocation
of
the
cell
user
see
so
this
is
going
to
be
after
the
trade
has
happened.
What
actually
did
this
seat
get?
A
B
A
Up,
okay,
let
me
just
check
and
see
if
I'm
missing
anything
here.
I
think
we
are
good.
So,
let's,
let's
go
ahead
and
try
to
see
if
bob's
test
will
pass
so
so
we
think
we've
created
this
option.
Let's
see
the
reallocation
failed
to
conserve
rights,
let's
see
what's
happening.
Okay
left
and
right
have
the
same
magic
wand.
Okay,
so,
let's
see
so
did
I
name
this
the
same
thing?
A
Okay,
oh
so
when
we
said
when
I
wanted
to
make
a
quote,
I
should
be
using
the
same
keywords
as
I
used
to
add
my
proposal.
So
let
me
actually
change
that.
Let's
say
magic
and.
A
A
A
And
we
already
have
this
test
below.
Take
that
out
all
right,
let's
see
moment
of
truth,
nope
still
feeling,
okay,
oh,
we
have
changed
what
these
are
called.
So
this
we
called
this
magic.
We
called
this
mula.
A
There
we
go
all
right
so
just
to
recap
what
we
did.
So
we
built
an
otc
desk
contract
that
uses
a
covered
call
under
the
hood
to
make
a
trade
between
alice
and
bob
such
that
bob
is
given
an
option
and
he
only
has
to
trust
the
covered
call
contract.
So
what
we
did
not
do
yet
was
actually
write
the
the
code
for
the
make
removed
inventory
invitation,
but
I
want
to
pause
here
because
I
think
we're
nearly
running
out
of
time
and
ask
if
we
have
any
questions.
B
Thank
you
all
right,
so
you
want
to
I
I
would
like
to
point:
can
you
go
to
where
it
spins
up
the
the
new
covered
call
contract.
A
B
I
just
wanted
to
emphasize
that
that's
actually
spawning
an
entirely
new
contract
dynamically
inside
of
this
contract.
That
is
now
a
separate
process
that
can
be
separate,
or
I
mean
a
separate
running
thing
inside
of
the
chain
that
can
be
separately
inspected
and
confirmed
and
and
and
communicate
asynchronously
with
it.
This
could
be
launching
you
know,
arbitrarily
complicated,
interesting
network
of
other
contracts.
A
Yep
yeah,
so
this
this
is
really
the
defy
legos
that
we've
been
talking
about
the
you
know
composability,
so
I
didn't
have
to
write
well.
I
did
write
it
today,
but
if
I
were
alice
right
I
wouldn't
have
to
write
the
covered
call
contract.
A
I
would
just
be
able
to
use
the
installation-
and
you
know
perhaps
bob
has
seen
it
before
in
the
past,
so
he
trusts
that
code,
and
I
don't
have
to
ask
bob
to
trust
me
for
anything
to
to
trust
the
code
that
I'm
writing
to
trust
that
I'm
going
to
have
the
assets
between
the
covered
call
code
and
zoe.
All
of
those
things
are
guaranteed.
A
All
right,
so
if
there
are
no
more
questions,
let's
go
ahead
and
finish
this
out.
I'm
going
to
start
on
the
make
remove
inventory
invitation,
so
it's
pretty
similar
to
the
make
ad
inventory
invitation
method,
but
we'll
go
ahead
and
do
that.
So
this
is
an
offer
hand
offer
handler.
So,
of
course
it
takes
in
a
seat
we're
going
to
want
to
return
a
invitation.
A
Let's
call
the
offer
handler:
oh
whoops,
sorry,
let's
call
the
offer
handler
here
remove
inventory,
and
that
is
what
actually
takes
in
a
seat.
Let's
call
the
description,
remove.
A
Okay,
so
we
have
a
seat
here
and
we
are
basically
going
to
be
doing
the
exact
opposite
of
what
we
did
earlier
so
I'll
type.
It.
A
Let's
say
inventory
removed
and
so
the
market
maker
seat
is
actually
not
going
to
gain
anything.
The
outgoing
seat
is
going
to
gain
the
exact
thing
that
it
wants.
So
the
way
that
we're
able
to
remove
inventory
is
to
specify
what
we
want
and
it'll
be
taken.
A
Okay,
so
let's
go:
let's
go
back
here:
let's
have
alice,
make
an
invite
for
herself
and
use
it
so
we're
gonna
use
the
creator
facet
we're
going
to
make
remove
inventory
invitation.
A
A
A
A
Okay,
so,
like
I
said,
we
only
have
to
specify
the
wants
here.
So
let's
say,
for
whatever
reason:
alice
is
going
to
want
to
remove
to
moola.
A
So,
let's
use
our
moolah
kit
amount
math
for.
A
A
A
And
we
don't
need
to
pass
any
payments
because
we're
we're
going
to
be
getting
payments,
we're
not
going
to
actually
be
adding
anything.
So,
let's
call
this
remove
inventory
seat.
A
Yeah,
certain
areas
of
our
system
require
things
to
be
hardened,
so
that
will
that'll
definitely
decide
things
for
you.
We
are
working
on
making
it
so
that
the
hardening
happens
automatically,
so
you
wouldn't
have
to
actually
call
that,
but
that's
still
in
the
works
okay,
so
we
got
the
offer
result
that
we
wanted,
and
so
the
inventory
was
removed.
So
there
you
have
it.
A
We
have
built
our
our
otc
desk,
it's
able
to
add
inventory
it's
able
to
remove
inventory
and
it's
able,
most
importantly,
to
make
quotes
that
are
credible.
That
are
actually
the
covered
call
options
that
we
saw
before,
and
it
does
so
by
using
the
covered
call
installation
that
we
built
today
and
so
we're
actually
using
the
the
d5
components
in
a
composable
fashion,
and
I
think
this
is
really
exciting.
So
anyone
have
any
questions
before
we
close.
B
There
are
no
questions
in
the
in
the
king
in
the
in
the
in
the
chat
list,
though
I'll
keep
an
eye
out
here.
I
just
wanted
to
add
that,
of
course,
this
is
in
the
context
of
the
agorak
init
directory,
which
has
the
contract
that
that
she
was
editing
and,
of
course,
the
the
api
side
and
the
ui,
so
in
the
last
five
minutes,
she's
going
to
no.
B
A
Yep
and
if,
if
anyone
wants
to
take
this
further,
you
could
actually
build
the
front
end
for
this
and
having
us
have
this
as
a
working
dap
example.
So
you
can
it
wouldn't
just
be
the
contract
side.
You
could
actually
create
the
front
end
for
this
as
well.
Yep.
B
Yep
yep
and
the
the
code
for
this
I
posted
in
chat
pointers
to
the
code
inside
of
our
repository.
The
otc
desk
is
already
there
covered,
call
has
been
there
for
for
for
months
and
predates
ott
otc
desk
by
by
quite
a
long
time
and
had
been
previously
reviewed
and
and
used
in
other
purposes
so
well.
Thank
you
very
much
kate.
For
this.
This
was
really
really
useful
and
really
great
to
see.