►
From YouTube: NEAR Certified Demo | Episode 3.1 -- NEARmons
Description
This demonstration was presented by the author(s) after just 1 week of working with the NEAR platform as part of the NEAR Certified Developer program.
You can find the source code to this demo here:
https://github.com/Learn-NEAR/NCD-03--nearmons
---
Follow the latest from NEAR Protocol on:
Website: https://near.org/
Discord: https://near.chat/
Blog: https://near.org/blog/
Twitter: https://twitter.com/NEARProtocol
GitHub: https://github.com/near https://github.com/nearprotocol
#Blockchain #FutureIsNEAR #NEAR #nearprotocol
B
So
welcome
this
is
over
this
week.
I've
been
writing
this
smart
contract
that
I
call
near
mons.
B
It's
a
smart
contract
that
basically
creates
nfts,
and
these
nfts
are
essentially
creatures
with
skills
and
attributes
you
can
think
of
as
pokemon
actually
like
a
fire
move
water
move,
and
then
you
can
actually
create
new
creatures
by
fusing
two
creatures,
and
then
the
descendant
creature
would
inherit
skills
and
attributes
from
the
ancestors
of
your
choice,
and
so
this
would
be
considered
an
in-game
collectible
that
could
be
used
one
day
in
part
as
part
of
a
trading
card
game,
and
so
this
is
the
the
project
repository
and
then,
let's
see
sharif.
A
So
if
you've,
given
us
an
idea
of
the
project,
can
you
give
us
an
idea
of?
Maybe
how
does
it
look
like
when
you're
using
it?
Do
you
have
an
interface
of
any
sort,
whether.
A
Or
implemented
you're
only
one
minute
in
by
the
way.
So
if
you
give
us
a
sense
of
how
it
works,
what
it
feels
like
when
you're
using
it
and
then
we
can
dive
into
the
code.
B
So
there
is
no
front
end
at
the
moment.
I've
only
started
on
the
contract
itself.
I
broke
the
test
and
I've
deployed
it
onto
the
mainnet
and
called
it
and
all
that
stuff
so
no
front
end,
but
I
can
show
you
from
the
interface:
let's
see
what
should
I
show
first
actually
so
first
we
can
call
yarn
test
just
just
to
make
sure
everything
works.
B
Basically
there
this,
I
would
say
that
this
epic,
this
contract,
is
a
lot
more
complicated
than
what
I
wanted
to
and
there
have
been
challenges
along
the
way
like
how
much
like
design
problems
like
what
to
store
in
and
what
to
keep
out
and
I
had
to.
I
also
have
to
consider
the
trade-offs
between
storage
and
speed.
B
So,
let's
see
okay,
all
of
them
are
passing,
which
is
a
good
sign,
so
I'll
walk
through
the
code.
Actually,
let's
go
through
models.ts.
So
there's
the
the
creature
ids
list
creature
and
sample
creature
classes.
These
are
basically
used
sample.
B
Cat
class
is
used
to
identify
the
creature
itself
like
as
a
sample,
basically
not
something
owned
in
its
original
form,
and
the
creature
class
is
the
one
that's
actually
owned
by
the
owner
and
creature.id
lists
is
the
list
of
creature
ids
that
are
owned
by
an
owner.
So
we
would
use
those
ids
for
fast
look
up
times,
and
here
we
would
call
the
init
contract
that
would
initiate
all
of
the
data
structures
that
we
need
in
order
to.
B
That
we
need,
in
order
to
find
the
creatures
that
we
need
and
then
in
index
we
have.
We
have
roughly
200
lines
of
code
where
you
can
retrieve
the
creatures
by
owner.
You
can
preview
the
future
child
creature
by
looking
for
its
ancestors
instant
ids,
and
then
you
could
actually
fuse
for
the
creature
and
then
you
can
actually
give
creatures
to
the
owner.
B
B
B
Close
window
we're
here,
export
owner,
equal
to
monsta,
testnet,
and
so
now
we
have
both
the
owner
and
the
contract
ready.
So
let's
run
the
second
script,
so
we're
going
to
run
the
script
it's
going
to
initiate
initialize
the
contract
and
make
sure
all
the
data
structure
is
ready,
and
then
we
also
give
ourselves
of
creatures
to
start
with.
So
you
can
see
that
we
got.
We
already
have
two
creatures,
one
each
of
them
has
a
sample
id
and
an
instant
id.
B
The
instance
id
is
the
very
unique
one
and
the
sample
id
is
the
one
that's
specific
to
that
creature.
It's
the
same,
no
matter
who
you
who
owns
the
creature
and
you
can
see
the
attack
at
defense
and
speed,
valuables
and
then
the
skills
and
what
element
it
is
and
what
evolution
rank
it
is
the
higher
the
revolution
rank
the
more
powerful
it
is
essentially
so,
let's,
let's
actually
start
fusing.
So
let's
go
into.
B
A
B
B
Case
we
will
be
scheduling
a
call
that
gives
us
an
idea
of
what
the
future
child
would
look
like
here
this
this
would
be
the
future
child,
and
so
now,
if
we
want
to
actually
create
the
child,
we
need
to
call
the
procreate
function,
and
this
would
be
like
this
and
then
we
copy
over
the
instance
ids,
where
we
go
all
the
way
to
parent
id
instance
equal
to
a
and
then
r
is.
B
Paste
and
then
the
skills-
let's
just
let's
just
say,
let's
just
let's
just
leave
it
as
before-
simply
simplicity's
sake.
B
So
yes
and
then,
let's,
let's
import
one
of
the
ancestors,
so
we
have
fs,
let's
put
in
fs
and
then
finally,
the
new
creature
sample
id
would
be
l1
and
we
call
scheduling,
call
and
now
we
have
produced
osp,
which
is
the
name
of
the
creature.
And
so
now,
if
we,
if
we
call
this
function,
we
should
see
that
we
have
three
creatures
that
we
own.
B
B
Oh
yeah,
I'm
missing
the
okay,
see
now
we
have
we
own
three
creatures,
the
two
that
we
owned,
that
we
were
given
at
first
and
then
the
last
one
osp
that
we
fused
from
these
previous
one
now
now
going
going
by
what
I
just
did.
You
can
continue
fusing
these
creatures
and
then
basically
they
actually
evolve.
B
You
can
see
here
that
the
evolution
rank
is
actually
rank,
one
because
we
fuse
two
zeros,
which
means,
as
we've
continued
fusing
creatures
will
become
more
specialized
and
just
more
powerful
in
the
future,
and
I
wanted
to
implement
trading,
but
that
would
have
been
way
too
advanced
for
me
at
this
time
and
yeah.
That
is
all
for
my
demo.
A
Okay,
that's
great
congratulations!
Spot
on
10
minutes!
Do
you
want
to
take
maybe
30
seconds
to
talk
about
a
few
lessons
learned
or
anything
that
that
caught
your
attention
during
the
week,
but.
B
Yes,
one
base.
One
really
big
thing
that
I
learned
is
that
sometimes
I
had
to
take
a
step
back
and
while
the
take
a
step
back
and
learn
to
read
a
book
and
read
the
book,
get
to
know
all
the
tools
that
are
necessary
how
to
how
to
test
how
to
test
basically,
rather
than
go
going
in
dark
and
sometimes
the
short
term.
While
the
short
term
time
that
you
put
in
seems
long,
it
would
be
probably
a
lot,
it
would
be
worth
it
in
the
long
run.
A
Okay,
thanks
for
that,
danny
congrats,
great
work,
we're
at
11
minutes.