Giter Site home page Giter Site logo

sukrucildirr / layerzero-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jamesbachini/layerzero-example

0.0 0.0 1.0 9 KB

A simple test passing a string between Goerli and Optimism Goerli using LayerZero

License: MIT License

Solidity 100.00%

layerzero-example's Introduction

LayerZero Example

A simple example of cross chain communications where I tested passing a string between Goerli and Optimism Goerli using LayerZero

I ran this on Remix you'll need to add Optimism Goerli testnet to Metamask using Chainlist.

Note that the chainId's that LayerZero uses are different from the real chain ID's

Instructions

Copy the code into remix

Deploy on both networks using these lzEndpoints in the constructor argument.

LayerZero Optimism Goerli

  • lzChainId:10132
  • lzEndpoint:0xae92d5aD7583AD66E49A0c67BAd18F6ba52dDDc1

LayerZero Goerli

  • lzChainId:10121
  • lzEndpoint:0xbfD2135BFfbb0B5378b56643c2Df8a87552Bfa23

Then use the trustAddress(address _otherContract) function to approve the other contract address on both deployed contracts.

Once that's done you can send messages both ways using send("Hello World")

Note that you will need to call the send function with some funds by putting a value amount in. I sent 12345678 gwei which seemed to work on testnet and any surplus is refunded back to your wallet. There's an option for this near the gas limit in the top left panel on Remix.

More Information

I'll do an article and video at some point about cross chain communications.

layerzero-example's People

Contributors

jamesbachini avatar sukrucildirr avatar

Forkers

muskuz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.