►
Description
During this workshop, we will demonstrate CasperLabs' ERC-20 Contract implementation. We will walk through the guide available for dApp developers: https://techspec.casperlabs.io/en/latest/dapp/erc20/index.html
To attend the next workshop, visit: https://bit.ly/2TQnXfM
Follow Us: https://twitter.com/meetCasperLabs
General Discussion: https://t.me/CasperLabs
Technical Discussion: https://discordapp.com/invite/Q38s3Vh
A
Hello,
everyone
for
the
record.
My
name
is
much
easy.
Liske
and
we're
gonna
do
the
second
part
of
smart
contract
of
year
C
20
smart
contract
in
the
previous
previous
part.
We
did
the
logic,
so
we
build
the
basic
trade
that
implements
year,
C
20
logic
we
covered.
What
actually
LC
20
is
what
are
those
methods
and
in
this
session,
I'll
walk
you
through
smart
contract
itself,
I'll
show
you
how
it's
how
it's
built
again
I'll,
be
following
the
smart
contract
tutorial
on
our
tech
spec.
A
A
A
A
A
A
So
in
Casper
labs
you
have
the
memory.
The
memory
comes
from
the
storage
grade.
It's
here
it
allows
you
to
save
to
save
the
value
some
kind
of
value
under
exceed
so
key
value.
Storage,
simple
few
are
very
simple:
key
value
storage
to
be
able
to
to
save
it
like
this,
you
need
a
key
and
the
key
is
an
UFO,
so
unfortunately
reference.
This
is
like
a
very
universal
element
that
we
used
to
refer
to
all
the
things
in
our
system.
A
A
A
A
A
A
A
A
A
A
So
there
is
no
pointer.
We
need
to
create
the
pointer
and
have
you
do
it?
You
use
storage,
new
URF
and
you
put
the
value
inside
and
using
into
you
converted
to
the
key,
and
so
in
at
this
moment
you
already
did
store
it
right
so
that
the
object
is
in
the
memory
you
have
and
you
have
a
reference
to
it,
which
is
this
key,
and
now
you
and
now
you
can
save
it
this
now
you
can
save
this
key
under
under
the
name.
So
you
use
runtime,
put
key.
A
A
That
this
T
option,
the
T
value,
will
be
transferred
from
the
underlined
bytes
to
the
CL
side.
So
it
is
required
and
again
we
take
the
the
key
under
the
name.
So
if
someone
already
put
it
through
set
key
here,
it's
gonna
resolve
this
disk
or
gonna
resolve
to
some.
But
if
it's
not,
there
return
none,
but
if
it's
there
first,
you
need
to
convert
it
to
the
key.
A
So
from
some
from
to
the
US
and
this
how
we
do
it,
maybe
key
try
in
too
big.
We
do
it
because
someone
could
put
something
else
under
this,
so
there
might
be
a
value,
it's
a
one-bite
that
doesn't
actually
and
that
cannot
be
converted
to
the
proper
URF.
So
that's
why
we
do
the
try.
If
it
doesn't
succeed,
we
use
unwrap
or
revert
with,
and
this
is
an
error.
A
Okay,
so
if
we
get
the
key,
if
so,
if
the
key
exists
and
we
can
parse
it
and
then
we
can
use
storage
to
actually
read
this
key
and
again,
the
key
might
be
missing
so
in
to
handle
this,
and
the
type
can
be
something
else.
If
someone
by
mistake
someone
you,
if
you
by
mistake,
saved
something
comes
to
the
key
and
then
it's
gonna
be
a
new
request,
different
type,
maybe
someone
saved,
maybe
you
saved
it
as
a
in
here
but
somewhere
else.
A
A
A
A
Another
thing
is
and
that
here
I
have
these
under
tations
and
because,
when
you
get
the
error
from
the
system,
when
you
execute
this
map
contract,
it's
converted
to
to
that
value.
For
example,
one
is
converted
to
that
value.
That's
because
the
user
range
error
is
above
6,
5,
5,
3
6,
so
it's
6,
5,
5,
3,
6,
plus
what
we
have
here,
but
that's
gonna,
be
fixed
in
the
next
release.
So
you'll
actually
see
the
error
that
you
defined.
A
A
A
So
we
talked
about
sales
balance,
so
now
we
know
how
how
this
works.
So
this
save
directly
or
updates
the
balance
and
there
is
a
drink.
So
first
we
need
to
have
a
string
when
we
save
the
balance,
we
get
an
address
and
the
balance,
but
we
need
to
have
a
string
in
the
balance,
so
you
can
set
aside
it.
So
we
can.
You
actually
use
the
set
key
method,
so
I
need
to
create
a
string
out
of
a
dress
and
how
I
do
it?
A
A
Create
I
use
the
same
function,
two
to
create
a
string
type
key
and
just
use
it
the
same
for
total
supply
in
total
supply.
The
difference
is
that
the
key
is
actually
constant
is
defined
here.
It's
gonna
be
total
supply
and
there
will
be
no
other
key
like
this
and
in
allowance
here
in
save
allowance,
I
actually
save
the
amount
that
is
approved
to
the
pair
of
on
there
and
spender
so
I
use
allowance
key
and
the
string
keys
in
the
format
of
owner
plus
spender
okay.
So,
let's.
A
Maybe
here
look
before
we
get
to
the
details,
how
it
works.
I
would
like
to
show
you
how
to
parse
arguments,
because
the
structure
of
the
of
handling
the
incoming
request
is
first,
is
get
the
input.
Parser
and
called
from
arcs
are
going
to
part
the
arguments
and
expect
input
type
of
different
methods
like
transfer
within
arguments,
I'm
going
to
show
you
how
to
how
to
actually
build
this
object.
So
it's
writer
we
can
use
it
here.
You
have
input
here
here
here
here
here
and
through
the
end.
A
A
A
Will
go
to
this
in
the
middle,
but
the
method
name
return
the
string
and
then
match
this
method
name
here
to
one
of
the
strings
I
defined
above
and
if
the
method
is
transfer.
Please
return
me
an
input
of
type
transfer
and
put
the
first
argument
as
as
a
public
key
and
the
second
argument,
as
you
5.20.
A
A
It's
okay
to
return
T
that
implements
those
two
and
I
handle
an
errors
because
like
this,
because
when
I
tell
get
arc,
I
pass
the
position
of
the
argument
and
if
it's
wrong,
if
it's
not
there,
then
I
draw
missing
argument
I
and
if
it's
with
the
wrong
type,
I
trowe
involved
argument
of
I
okay,
so
we
built
the
actually
deco.
Let's
go.
A
A
A
A
Initialization,
so
there's
no
built-in
constructor
in
here,
so
you
need
to
define
one
it's
not
hard.
So
there
is
a
just
a
flag:
that's
called
FC
Twente
contract
name
and
I
said
it
and
first
I
use.
My
own
function
is
in
July's.
So
is
the
flag
there.
This
is
just
bullying
in
this
in
the
space
in
the
key
value.
If
it's,
if
it's
not
not,
if
it's
there
then
handle
ear,
c20
function
this
function
and
if
it's
not
there,
then
to
the
initialize
part
and
mark
it
as
initialized
in
it
year.
A
A
A
That
assumes
that
the
right
side
of
the
statement
is
the
left
side
of
the
statement.
If
not
I
do
runtime
revert
and
one
of
the
ears
so
under
20
constructor
command.
This
function
expects
the
the
first
code
called
to
be
a
type
of
in
it,
ears,
20,
okay
and
what
it
does
it
creates
a
trait
and
it
calls
Minton
on
it
and
gives
the
color
as
the
one
that
calls
the
contract
as
a
account.
That's
gonna
have
the
amount
of
tokens
and
that's
it.
So
after
calling
this
deep.
A
The
account
that
that
cold,
it
has
tokens
okay
and
now,
let's
take
a
look
at
the
handle,
because
that's
the
only
one
that
immediately
twenty
is
called
after
that
we
mark
it
as
initialized,
which
means
that
next
time
someone
calls
this
function,
it
will
go
here
to
handle
ear,
see
20
so
handle
here
see.
20
should
read
return
a
result
of
empty
okay
or
an
error,
and
here
you
have
unwrapped
or
rebirth
on
the
in
error.
A
A
Let's
go
through
the
transfer
example.
If
you
pass
the
right
argument,
you
should
get
the
transfer
object
that
has
proper
types
of
recipient
and
Ana.
Then
you
do
you
take
the
token
and
you
call
the
transfer
and
and
the
transfer
at
some
point,
we'll
call
rid
balance
and
save
balance
and
yeah.
So
it's
gonna
call
this
this
method
that
we
talked
talked
about
a
few
minutes
ago.
A
Was
defined
in
an
error
when
I
showed
you
how
I
translate
the
years
twenty
trait
errors
to
the
smart
contract
and
errors,
and
basically
that's
it.
If
you
talk
about
the
implementation,
the
same
happens
here:
transfer
from
balance.
The
balance
is
different
because
balance
actually
returns
the
value.
So
if
you
want
to
return
it,
you
do
it
like
this.
You
take
the
balance,
object.
A
So
now,
let's,
let's
talk
about
the
execution
context
of
our
smart
contracts
when
I
deploy
the
smart
contract
and
when
I
call
it
directly
as
an
account
it
executes
in
this
account
context,
it
means
that
it's
gonna
use
this
accounts
memory
and
every
operation
that
we
did
in
year.
C20
uses
some
kind
of
memory,
so
if
you
would
use
it
directly,
you
would
have
your
own,
like
the
contract
would
use.
A
You
need
to
actually
call
the
code
that
can
execute
in
your
context
and
make
this
code
to
call
the
instance
of
exigent,
because
if
you
do
this
hop,
the
ear
c20
will
execute
in
its
own
context
and
if
I
call
it
through
my
code
and
to
the
Year
c20,
and
if
you
call
it
through
your
code
and
yes
20.
We
will
call
the
same
instance
of
years
in
20,
so
the
one
so
I
will
be
able
to
do
the
transfer,
because
we
will
share
the
same
memory.
So
how?
How
how
to
do
it?
A
A
A
It
goes
like
this
when
I
call
the
in
this
initial
contract.
I
expect
my
first
argument
to
be
a
topple
of
two
things.
One
is
the
method
name
and
the
other
is
hard
to
the
contract.
I
want
to
call
so
the
method
name
will
be
used
to
person
to
do
to
do
the
from
arcs
function
and
that
is,
and
the
hash
will
be
used
to
actually
direct
the
call
somewhere
else.
So
to
do
the
proxy
call
some
say,
delegate
code,
and
that
way,
this
method
name
is
a
bit
complicated
because
it
handles
two
cases.
A
In
one
case,
as
the
first
argument,
you
have
a
just
drink
and
in
the
other
case,
as
an
argument,
you
have
a
couple
of
string
and
hash,
so
you
so
you
extract
only
the
method
as
the
first
element
of
the
tuples
it's
it's
described
in
the
to
the
tutorial.
Actually,
everything
is
described
in
the
torso
view.
You
didn't
get
something.
A
A
A
The
goal
of
the
call
function
here
is
to
deploy
here,
C
20
proxy
and
we're
C
20
contract.
So
let's
do
it,
and
there
is
one
initial
argument:
that
is
the
initial
balance,
so
I
deployed
the
contract
and
after
this
I
would
like
to
have
here
C
20,
that
is
already
initialized,
with
the
initial
balance
set
to
my
account
and
I
want
to
have
ear
C
20
proxy.
A
A
Okay,
deploy
token
is
here
what
it
does
first
store
faction
at
half
so
because
our
function
here,
C
2020
contract
name,
yes,
20,
so
because
our
function
was
no
mangle,
it
means
that
when
the
compiler
compiles
it,
it
keeps
the
function
name.
So
here
I
can
actually
tell
tell
the
smart
contract
look.
Find
me.
I
can
tell
the
host
find
me
and
function.
That's
called
est.
20,
please
save
it
as
another
smart
contract
and
give
me
give
me
a
reference
to
it.
A
So
that's
so
I
have
a
smart
here:
I
have
a
smart
contract
deployed
and
I
do
this
now,
I
call
it
with
the
init
method,
so
I
do
they
initialize
initialization
part.
So,
let's
step
here
after
that,
I
also
need
to
store
it
under
a
key,
in
my
account
space.
So
when
I
want
to
after
this
is
deployed,
I'll
have
two
houses
of
two
smart
contracts.
A
One
is
year:
C,
20
and
another
is
year,
C
20
proxy,
and
you
need
from
me
actually
to
two
contracts
to
houses,
because
you're
gonna
call
the
proxy
as
you
deploy,
but
you
will
pass
the
hash
of
the
years
20
as
an
argument.
Of
course,
you
can
have
your
own
proxy
deployed
in
your
own
account
space,
but
you
can
use
money
and
those
those
methods
save
save
the
token
contract
under
the
years.
A
A
A
A
A
A
So
to
the
token
transfer
from
Bob
Bob
actually
sent
him
this
amount
from
sander
Ali
and
a
third
values
so
give
me
a
balance
of
Ali.
It
should
be
the
initial
value
of
the
amount
she
sent
and
the
balance
of
Bob
should
be
amount,
and
this
follows
other
tests
follow
the
same
logic.
So,
as
you
see
here,
I
used
ear,
C,
20
contract,
a
trait,
not
great
object.
Here
it
comes
from
here-
and
this
is
my
test
environment
that
I
used
to
run
the
test.
So
what
it
does.
A
First
I
define
few
keys,
but
I'm
gonna
need
then
I
I
have
methods,
then
we're
gonna
call
and
some
keys
I'll
need
to
get
things
from
the
blockchain
I
define
centre
struct
to
set
exactly
which
I
can
to
distinguish
the
account
that
sends
from
others
and
the
main
here
C
20
contract,
and
this
will
have
its
own
test
context.
You
should
know
this
from
previous
tutorials
about
three
previous
simple
tutorial.
I'll
show
you
where
you
should
know
it
from
from
here.
A
You
have
smart
contracts
and
tests,
so
you
should
not
know
it
good
time
to
do
it.
Let's
go
back
here.
So
I
have
an
object
that
has
its
own
context
so
which
will
machine
of
the
smart
contract
and
two
hashes
extracted.
So
after
the
the
contract
is
deployed,
as
I
told
you,
there
will
be
two
hashes
talking
contract
so
after
it
deployed
it
needs
to
be
extracted
and
set
here,
and
the
whole
logic
is
here
when
you
call
deployed
that
returns.
Do
this
object?
What
it
does?
A
A
And
then
the
session
builder
builds
you.
The
call
for
the
code
and
arguments
look
that
it's
comes
from:
Ali
authorized
by
a
leaky
and
Iran
the
session
against
the
context,
and
now
it's
possible
to
to
call
contract
hash
function
that
will
using
the
context
and
the
key
will
give
you
the
token
hash
and
it's
defined
to
find
somewhere
here.
A
It's
here,
so
it
uses
contact
context,
query
so,
for
the
account
of
Ali.
Give
me
a
name
so
for
that
could
be
year.
C
20
and
this
is
for
parsing.
The
result
object
to
the
hash
so
now
I.
So
here
now,
I
have
the
hashes.
I
can
construct
the
object
and
you
show
for
you,
you
show
the
transfer
call.
So,
let's
take
a
look:
how
to
transfer
it
looks
like
transfer,
uses
called
proxy
and
says
dissenters,
use
this
Center
and
these
arguments.
A
Let's
take
a
look.
What
called
proxy
looks
like
so
two
arguments,
ender
and
arguments
first
wraps
enter
into
the
center
unwrapped
Center
from
the
sender
of
a
construct,
define
define
what
you
want
to
call.
We
always
want
to
call
proxy
and
build
this
build
call
that
that
comes
from
the
address
some
from
the
sender
address
and
run
it
against
the
context
easy.
A
A
Use
the
another
context
of
PLC
20
smart
contract
and
give
me
the
name
and
the
letter
is
just
parsing
the
object.
So
it's
option
of
tea
and
the
tea
here
is
U
1,
u
5
1
2,
and
so
it
could
be
there
and
could
not
be
there.
If
it's
not.
There
then
return
0
in
test
I
used
you
64,
because
it's
easier,
okay,
I
think
I'm
done.
So.
Thank
you
very
much
for
listening.
All
of
this
I
hope
that
makes
sense
I'm
available
at
this
court.