Giter VIP home page Giter VIP logo

layerzeroquoter's Introduction

Contributors Forks Stargazers Issues


LayerZeroQuoter

Foundry tooling to help assess costs when using LayerZero V2. Quote enumeration is performed entirely offchain.

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License
  6. Contact
  7. Acknowledgments

About The Project

This is primarily a set of foundry scripts that are designed to make it very easy to get quotes for a particular payload using a variety of routes, completely offchain. It supports performing quotes from a specific source chain to N destination chains, or performing full mesh enumeration for a set of chains so you can identify the cheapest routes.

(back to top)

Built With

  • Ethereum
  • Solidity

(back to top)

Getting Started

LayerZeroQuoter was designed using Foundry, so I recommend familiarizing yourself with that if required.

Prerequisites

  • Install Foundry
    curl -L https://foundry.paradigm.xyz | bash
    foundryup

Installation

  1. Clone this repo:
    git clone https://github.com/Zodomo/LayerZeroQuoter
    cd LayerZeroQuoter
    
  2. Install LayerZeroQuoter:
    forge install
    
  3. Install LayerZero-v2 dependencies
    cd lib/LayerZero-v2
    yarn
    yarn build
    cd ../..
    
  4. Copy .env.example into .env:
    cp ./.env.example ./.env
    
  5. Populate the RPC URLs for the chains you want to test in .env, save it, and then run:
    source .env
    

(back to top)

Usage

  1. Pick any of the scripts in ./scripts/ and modify the variables near the top of the script you want to run.
    MeshQuote.s.sol:
    uint128 internal gas = 50_000; // Must be in units of gas, not in gwei
    uint128 internal msgValue = 0.01 ether;
    bytes internal message = abi.encode("Zodomo");
    bool internal payInLzToken = false;
    OutboundQuote.s.sol:
    uint32 internal srcEid = EID_MAINNET; // Source this in src/LZConfig.sol
    uint128 internal gas = 50_000; // Must be in units of gas, not in gwei
    uint128 internal msgValue = 0.01 ether;
    bytes internal message = abi.encode("Zodomo");
    bool internal payInLzToken = false;
    InboundQuote.s.sol:
    uint32 internal dstEid = EID_MAINNET; // Source this in src/LZConfig.sol
    uint128 internal gas = 50_000; // Must be in units of gas, not in gwei
    uint128 internal msgValue = 0.01 ether;
    bytes internal message = abi.encode("Zodomo");
    bool internal payInLzToken = false;

  1. Comment and/or uncomment each _deploy() call in the specified script's setUp() function to configure which chains you are testing.
    Example:
    _deploy("Ethereum", vm.envString("ETHEREUM_RPC_URL"), EID_ETHEREUM);
    //_deploy("BNB Chain", vm.envString("BNB_RPC_URL"), EID_BNB);
    //_deploy("Avalanche", vm.envString("AVALANCHE_RPC_URL"), EID_AVALANCHE);
    _deploy("Polygon", vm.envString("POLYGON_RPC_URL"), EID_POLYGON);
    _deploy("Arbitrum", vm.envString("ARBITRUM_RPC_URL"), EID_ARBITRUM);
    _deploy("Optimism", vm.envString("OPTIMISM_RPC_URL"), EID_OPTIMISM);

  1. Lastly, execute your preferred script using one of the following commands (be careful not to broadcast, as that is not necessary).
    forge script script/InboundQuote.s.sol --sig "run()" -vvv
    forge script script/OutboundQuote.s.sol --sig "run()" -vvv
    forge script script/MeshQuote.s.sol --sig "run()" -vvv

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the CC0-1.0 License.

(back to top)

Contact

Zodomo: Farcaster - Twitter - Email - Zodomo.eth - zodomo/

Project Link: https://github.com/Zodomo/LayerZeroQuoter

(back to top)

Acknowledgments

(back to top)

layerzeroquoter's People

Contributors

zodomo avatar

Stargazers

Panic avatar Carter Carlson avatar Etch avatar  avatar Sabnock avatar Michael Demarais avatar Beach Crypto avatar

Watchers

 avatar  avatar

Forkers

gman0n

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.