Skip to content

← Back to contracts

Bundler3 & Bundler2

Code

Bundler3 Structure

bundlers3 plot
  1. The core Bundler3 contract implements multicall(Call[] calldata bundle), where each call is defined by:

    • to: Target address
    • data: Calldata
    • value: Native currency amount
    • skipRevert: Flag to skip reverting if this particular call fails
    • callbackHash: Specifies the hash used for controlling reentrancy callbacks
  2. Adapters all inherit from CoreAdapter, which provides access to the initiator (the original caller) via transient storage. This mechanism allows adapters to enforce strict permission checks (e.g. only acting on behalf of the initiator).

  3. Chain-specific adapters, such as EthereumGeneralAdapter1, extend the base GeneralAdapter1 to support network-specific features (e.g. stETH on Ethereum).

  4. Specialized adapters target specific integrations:

    • ParaswapAdapter for DEX aggregation (buy/sell/swaps)
    • Migration adapters for moving user positions between protocols (Aave, Compound, Morpho, etc.)

Bundler2 Structure

blue-bundlers plot
  1. All bundlers inherit from BaseBundler that enables bundling multiple function calls into a single multicall(bytes[] calldata data) call to the end bundler contract.

  2. Each chain-specific bundler is available under its chain-specific folder (e.g. ethereum).

  3. Some chain-specific domains are also scoped to the chain-specific folder because they are not expected to be used on any other chain (e.g. DAI and its specific permit function is only available on Ethereum - see EthereumPermitBundler.

  4. User-end bundlers are provided in each chain-specific folder, instantiating all the intermediary domain-specific bundlers and associated parameters (such as chain-specific protocol addresses, e.g. EthereumBundler).

Permit 2

In November 2022, Uniswap Labs introduced Permit2, a robust token approval contract designed to standardize and secure token approvals across various smart contracts. By enabling signature-based approvals and efficient management of token allowances, Permit2 significantly enhances the user experience. It reduces transaction costs and bolsters smart contract security by mitigating risks associated with traditional approval methods.

The integration of Permit2 is set to benefit the entire DeFi ecosystem. Specifically, the Bundlers, operating within the Morpho and Morpho Optimizers framework, leverage Permit2's features to streamline transactions. This integration ensures more secure, cost-effective, and user-friendly operations across these platforms.

Discover the full potential of Permit2 and how it revolutionizes token approvals in the integration guide.