GithubHelp home page GithubHelp logo

boilerplate's Introduction

LayerZero Boilerplate

Overview

This repo is intended to serve as a potential starting point for building on top of LayerZero. This repo is setup to deploy the following:

  1. OFT (V1) on the original 7 chains LayerZero initially supported.
  2. OFTV2 contracts on goerli and bsc-testnet.
  3. ProxyOFTWithFee on fuji to convert already deployed ERC20 into OFT and OFTWithFee on arbitrum-goerli and bsc-testnet.

Learn about the difference between OFT(v1) and OFTV2 here.

This repo comes with LayerZero tooling to Lock in UA Configuration and Wire Up Configuration. To use the UA Configuration script please fill in your appConfig.json according to this documentation. To use the Wire Up Configuration script please fill in your wireUpConfig.json according to this documentation.

Deploy Setup

  1. Add a .env file (to the root project directory) with your MNEMONIC="" and fund your wallet in order to deploy!

Deploying OFT (V1)

Run the following hardhat commands to deploy OFT to the original 7 chains:

npx hardhat deploy --network goerli --tags ExampleOFT
npx hardhat deploy --network bsc-testnet --tags ExampleOFT
npx hardhat deploy --network fuji --tags ExampleOFT
npx hardhat deploy --network mumbai --tags ExampleOFT
npx hardhat deploy --network arbitrum-goerli --tags ExampleOFT
npx hardhat deploy --network optimism-goerli --tags ExampleOFT
npx hardhat deploy --network fantom-testnet --tags ExampleOFT

Wire Up Configuration

Then run the Wire Up Configuration to:

  • function setTrustedRemote(uint16, bytes)
  • function setUseCustomAdapterParams(bool)
  • function setMinDstGas(uint16, uint16, uint)
npx hardhat wireAll --e testnet --config-path "./constants/oftConfig/wireUpConfig.json"

Send OFT accross chains

npx hardhat --network fuji oftSend --qty 100000000000000000 --target-network mumbai

Deploying OFTV2

Run the following hardhat commands to deploy OFTV2 to goerli and bsc-testnet:

npx hardhat deploy --network goerli --tags ExampleOFTV2
npx hardhat deploy --network bsc-testnet --tags ExampleOFTV2

Wire Up Configuration

Then run the Wire Up Configuration to:

  • function setTrustedRemote(uint16, bytes)
  • function setUseCustomAdapterParams(bool)
  • function setMinDstGas(uint16, uint16, uint)
  • function setDefaultFeeBp(uint16)
  • function setFeeBp(uint16, bool, uint16)
npx hardhat wireAll --e testnet --config-path "./constants/oftv2Config/wireUpConfig.json"

Send OFTV2 accross chains

npx hardhat --network fuji oftv2Send --qty 100000000000000000 --target-network arbitrum-goerli

Deploying OFTWithFee w/ already deployed ERC20 token

Run the following hardhat commands to deploy OFTV2 to goerli and bsc-testnet:

npx hardhat deploy --network fuji --tags ExampleProxyOFTWithFee
npx hardhat deploy --network bsc-testnet --tags ExampleOFTWithFee
npx hardhat deploy --network arbitrum-goerli --tags ExampleOFTWithFee

Wire Up Configuration

Then run the Wire Up Configuration to:

  • function setTrustedRemote(uint16, bytes)
  • function setUseCustomAdapterParams(bool)
  • function setMinDstGas(uint16, uint16, uint)
  • function setDefaultFeeBp(uint16)
  • function setFeeBp(uint16, bool, uint16)
npx hardhat wireAll --e testnet --config-path "./constants/oftWithFeeConfig/wireUpConfig.json"

Send OFTV2 accross chains

npx hardhat --network fuji oftv2Send --qty 100000000000000000 --target-network arbitrum-goerli

Lock down UA config

OFT (V1)

npx hardhat setConfig --config-path "./constants/oftConfig/appConfig.json"

OFTV2

npx hardhat setConfig --config-path "./constants/oftv2Config/appConfig.json"

OFTWithFee

npx hardhat setConfig --config-path "./constants/oftWithFeeConfig/appConfig.json"

boilerplate's People

Contributors

sirarthurmoney avatar

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.