Skip to main content

Getting Started with Bundler3

This tutorial will guide you through setting up your development environment for Morpho Bundler3, the newest version of Morpho’s bundler contracts.

Prerequisites

  • Git
  • Node.js (preferably the latest LTS)
  • Yarn (or your favorite package manager)
  • Foundry (for Forge tests)
  • Alchemy (or Infura) API key (if you plan to connect to mainnet or testnets)

Steps

  1. Clone the Bundler3 repository:

    git clone https://github.com/morpho-org/bundler3
    cd bundler3
  2. Install dependencies:

    yarn install
  3. Set up your Alchemy API key:

    export ALCHEMY_KEY=<your_alchemy_key>
  4. Run tests to ensure everything is set up correctly:

    By default, this tests on chain ID 1 (Ethereum).

    forge test

    Optionally specify another chain, e.g. Base (8453):

    forge test --chain 8453

Note: The first time you run the tests, it will build Morpho, which may take a few minutes.

  1. Explore the repository:

    • ./src/Bundler3.sol is the main contract, exposing the multicall entry point.
    • ./src/adapters/ contains the pre-built adapters (e.g. GeneralAdapter1, EthereumGeneralAdapter1, ParaswapAdapter), each inheriting from CoreAdapter.
    • ./test/ folder contains Forge-based tests demonstrating Bundler3 usage.

Now your development environment is ready for working with Morpho Bundlers!