►
From YouTube: NEAR Certified Demo | Episode 4.2 -- Popularity Contest
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-04--popularity-contest
---
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
A
B
Like
we
have
two
members
me
like
senpai
and
the
chosen
one,
so
we
are
ranking
projects,
I
don't
want
to
be
offensive
and
like
rank
the
girls,
so
this
will
be
like
our
ui
for
the
ranking.
So
we
can
vote
on
two.
I
just
limited
the
amount
of
contest
into
two:
that's
it
and
you
can
get
the
winner
if
you
like.
If
any
error
happens
or
log
happens,
then
this
pop-up
will
jump
and
you
can
see
the
what
what's
going
wrong.
B
B
And,
let's
start
with
unit
tests
yep
these
these
are
some
unit
tests.
I
already
ran
those
because
I
knew
like
it
will
take
some
time
so
I'll.
I
have
like
six
unit
tests
like
taking
the
various
parameters
like
is
contract.
Initialize
is
contestant
added.
When
you
can
vote
all
those
things,
then
this
is
just
a
bash
script,
which
is
which
comes
with
assembly
script
starter
starter
file.
B
I
didn't
change
anything
because
it
was
very
simple.
Like
everything
was
set
up,
then
it
is
deployed
like
you
can
see
the
code.
This
is
the
contract
id.
Then
I
am
on
doing
this
near
login.
I
logged
in
this.
This
is
the
contract.
This
is
my
username
a
different
one,
and
here
I'm
calling
some
methods
like
get
owner.
This
is
my
id,
then
I'm
adding
the
contestants
here,
these
con
contestants
and
these
this
doesn't
return
anything
but
like
it
returns
like
empty
string.
I
am
having
problem
with
this.
B
Like
get
stop
contestant
time,
it
is
returning
one,
but
I
am
expecting
some
other
value
locally.
It
is
working
fine,
but
on
test
net
it
is
like
confusing
for
me,
so
I'll
figure
it
out.
Some
way
or
another,
so
let's
start
with
this
contract.
Actually,
so
I
just
like
created
a
bunch
of
variables.
I
know
this
is
not
efficient,
but
this
this
was
a
way
because
I
don't
know
like
how
to
do
this
efficiently.
B
B
Yeah
here,
when
contracted
initialize,
the
owner
will
be
set
automatically
because
it
is
another
bash
script
like
that's.
Why
and
then.
B
This
is
first
method,
add
contrast,
so
what
it
does
it
so
it
allows
owner
to
add
the
contestant
and
the
stop
time
stop
time
is
when
contest
will
stop.
B
So
I
set
the
default
value
of
stop
contest
time
to
1,
because
it
was
like
very
convenient
because
I'm
doing
my
multiplication
here
so
null
will
be
like
a
troublesome
and
0
will
be
also
troublesome.
So
I
set
it
to
1.
Then
I
am
setting
this
to
these
two
contestants
here
then.
B
B
Yep,
then
you
have
the
vote
method
which
will
be
like
very
restrictive,
because
we
we
don't
have
we
don't
want
user
or
other
voters
to
vote
when
the
contest
is
not
started
and
after
it
ended
right.
So
these
two
methods
are
doing
that
only
like
this
one
is
checking
for
like
block
time
stamp
and
it
is
deciding
it
whether
it
started
or
not
and
ended
or
not
so,
choice
will
be
only
two
like
it
can't
be
less
than
zero.
B
It
can't
be
more
than
two
greater
than
two,
so
one
or
two
then
here
it
is.
You
have
to
also
pay
some
small
amount
of
fee
to
vote,
so
we
can
like
filter
out
the
spam
yeah,
and
then
we
can
get
the
winner.
If
contest
is
not
started,
it
will
be
restricted
and
through
some
errors,
and
if
contest
is
going
on,
then
also
it
will
throw
there
because
we
don't
want
to
get
the
betweener
before
it
ends
right.
That's
why?
B
Then
I'm
setting
the
default
back
to
this
one
and
showing
the
who
is
winner,
like
returning
the
winner
in
the
string,
and
these
are
some
methods
which
are
which
I
am
using
to
restrict
some
conditions
like
mostly
time
conditions,
and
this
is
for
like
restrict
anyone
to
use
the
methods
except
for
the
owner.
A
B
These
are
some
united,
so
I
am
any
checking
if
it
is
initialized
and
the
default
owner
is
said
to
be
owner
like
the.
This
is
what
I'm
taking
here
afterwards.
Adding
the
contestants,
so
only
owner,
can
add
the
contestant
and
checking
variables
after
starting
the
context,
because
we
don't
want
to
like
different
values
in
the
variables.
B
B
So
this
checks
for
whether
contact
is
stored,
started
and
if
it
is
started,
then
owner
also
can't
set
the
contestants.
So-
and
this
is
the
last
voting
voting
for
contestants
like
you,
can't
do
it.
If
you
can't
vote
before
the
contest
start,
and
you
only
have
to
use
one
or
two,
you
can't
use
any
other
thing.
B
B
B
A
Okay,
that's
great!
Thank
you
so
much.
I
appreciate
the
organization
of
your
preparation
for
the
presentation
as
well
running
the
tests
and
and
having
everything
kind
of
ready
in
one
environment
that
was
helpful.