►
From YouTube: Cross Ecosystem Communication between Aurora and NEAR - Michael Birch - Near Day at ETHDenver 2023
Description
Join NEAR's community:
Website: https://near.org/
Reddit: https://www.reddit.com/r/nearprotocol/
Discord: https://near.chat/
Medium: https://medium.com/nearprotocol
Blog: https://near.org/blog/
Twitter: https://twitter.com/NEARProtocol
GitHub: https://github.com/near https://github.com/nearprotocol
Dev Docs: https://docs.near.org/
Create a wallet: https://wallet.near.org/create
Apps on NEAR: https://awesomenear.com/
Learn to Build On NEAR: https://www.near.university/
Grants & Funding: https://near.org/grants/
#Blockchain #FutureisNEAR #NEAR #nearprotocol
#nft #dao
A
A
This
is
a
QR
code
here.
That'll.
Take
you
right
to
that
repository.
This
includes
a
rust
library
for
your
near
contracts
to
be
able
to
interact
with
Aurora,
and
it
includes
a
solidity
library
for
your
evm
contracts
to
interact
with
near
so
this
is
covering
both
sides
of
that
communication,
and
it
also
includes
documentation
and
examples
so
that
you
can
get
to
know
this
Library
figure
out
how
to
use
them
and
integrate
it
into
your
own
projects.
A
So
let's
go
ahead
and
take
a
look
at
some
of
those
examples
right
now,
so
the
first
example
we're
going
to
look
at
is
a
solidity
example.
This
is
a
AVM
contract
that
is
deployed
on
Aurora,
but
it's
going
to
call
the
Social
DB
deployed
on
near
now.
Social
DB
is
the
storage
layer
that
backs
the
near
dot
social
decentralized,
social
media
platform,
which
is
a
super
cool
thing
in
its
own
right.
A
So
this
is
a
high
level
sketch
of
what
the
example
is
doing
right.
So
we've
got
our
evm
contract
deployed
on
Aurora
and
it's
going
to
be
calling
the
set
function,
which
is
on
the
social
DB
contract
deployed
on
near
and
we're
going
to
include
a
callback
back
to
the
evm
so
that
we
can
get
the
result
of
that
call.
Now.
The
the
set
method
on
on
social
DB
is
exactly
how
you
store
data
in
in
the
contract.
A
So
again
you
could
try
to
use
this,
for
example,
to
try
to
build
a
metamask
or
other
ethereum
wallet-based
entry
point
into
near
social.
So,
okay!
So
what
does
this
code
look
like?
Well,
it
looks
just
like
normal
solidity
code.
You've
got
your
contract
definition
you're,
using
an
open,
Zeppelin
library
and
access
control,
which
tons
of
people
will
be
familiar
with
here,
and
all
you
have
to
do
is
add
in
the
Aurora
SDK
library
for
the
near
related
pieces
that
you
want
to
use
so,
for
example,
this
is
the
definition
of
that
set
function.
A
Call
right,
so
we
have
this
nice
near
dot,
call
command
or
function
method
in
the
SDK
you
can
see
it
takes
the
the
account
that
we
want
to
call
the
method.
We
want
to
call
on
it.
What
data
we
want,
the
near
and
gas
that
we
need
to
attach
to
that
call
and
attaching
near
is
important
so
that
we
can
cover
the
storage
that
we're
incurring
in
the
social
DB
contract.
A
But
what's
super
cool
about
this
is
the
cross
contract
calls
feature
is
making
everything
seamless
in
between
these
two
sides
so
inside
the
evm
the
attached
near
you're
using
is
an
erc20
token.
It
is
the
wrapped
near
bridged,
erc20
that
comes
in
Over,
the
Rainbow
Bridge
into
Aurora,
but
behind
the
scenes
the
cross
contract
call
feature
is
going
to
bridge
that
token
back
unwrap
it
and
turn
it
into
the
base
near
token,
so
that
by
the
time
it
hits
social
DB.
A
You
have
just
base
near
so
on
both
sides
you're
using
the
preferred
token
type
erc20
and
the
evm
and
base
near
in
Social
DB,
and
then,
of
course,
we
want
this
callback
back
into
Aurora
to
do
any
error
handling
we
might
want
to
do
on
this
call.
So
that's
what
the
near
dot
Aurora
call.
Does
you
pass
in
what
address
you
want
to
call
and
any
any
data
you
want
to
pass
to
it?
A
Let's
take
a
look
at
that
callback,
so
this
this
is
what
it
looks
like
again,
pretty
pretty
simple
method:
right,
Aurora,
SDK
promise
result.
This
is
getting
back
the
result
of
the
near
call
that
we
made
and
making
sure
it
was
successful,
and
if
it
wasn't,
we
can
do
some
error
handling
in
this
case,
of
course,
I'm
just
doing
a
revert
message,
keeping
it
simple
for
the
sake
of
the
example,
but
you
can
imagine,
depending
on
your
use
case,
you
might
need
more
sophisticated
error
handling
there.
A
So,
let's
move
on
to
another
example,
this
is
going
to
be
a
rust
example.
So
this
is
a
contract
deployed
on
Mir,
which
is
going
to
call
the
uni
swap
contract,
which
is
deployed
on
Aurora
unit
swap
is
an
automated
Market
maker.
It's
a
really
important
piece
of
the
defy
infrastructure
on
ethereum
mainnet
and
on
Aurora.
We've
got
a
number
of
similar
contracts
deployed
again
high
level
sketch
of
what
this
looks
like.
A
So
this
is
a
sort
of
low
level
API
in
in
the
uni
swap
contract,
but
basically
it
just
means
I
want
to
perform
a
swap
on
one
particular
token
pool
and
I
want
a
very
specific
number
of
tokens
to
come
back
from
this
swap
and
once
again,
we're
going
to
include
a
callback
so
that
we
can
get
the
results
of
the
evm
call
back
into
our
near
contract
to
do
any
error,
handling
or
or
success
handling
as
well,
that
we
might
want
to
do
so
again.
What
does
this
code
look
like?
A
Now
you
do
have
to
add
some
extra
code
that
does
come
from
the
Aurora
SDK
Library.
So
what
we
want
to
have
is
full
integration
with
with
the
near
ecosystem.
Typically,
Json
is
used
to
pass
in
arguments
so
up
at
the
top
we're
still
taking
in
those
arguments
as
Json,
but
then
we
need
to
re-encode
them
into
the
solidity
API
to
be
able
to
pass
it
into
the
evm.
So
that's
what
that
big
block
of
code
in
the
middle?
A
Does
it's
a
lot
of
lines
only
because
there's
a
lot
of
parameters
that
go
into
this
exact
output
single
function
call,
but
it's
it's
not
very,
very
complicated
and
then
at
the
bottom.
We
actually
do
the
cross
contract
call.
So
we
are
again
following
the
same
patterns
coming
out
of
near
SDK
right.
We
have
the
X
trait
that
is
able
to
create
this
thing.
A
That
that
does
the
the
promise
and
actually
makes
makes
the
call-
and
we
can
attach
a
callback
to
it,
and
if
we
take
a
look
at
that
callback
function,
the
again
you're
actually
key
patterns
are
followed.
A
We're
saying:
okay,
the
engine
gives
back
its
result
using
borscht,
so
we'll
Define
that
as
the
serializer-
and
this
is
in
fact
a
callback,
but
we
can
still
write
it
in
this
really
nice
still
Rusty
style
because
of
the
magic
of
near
SDK
that
submit
result
type
that
you
see
there
is
defined
in
the
rust
Library
coming
out
of
the
Aurora
contracts.
Sdk-
and
you
can
see
here,
it
has
a
status
field.