🚀 DAY 3 OF LAUNCH WEEK: Introducing Webhook Events for Pull Request Scans.Learn more →
Socket
Book a DemoInstallSign in
Socket

@morpho-labs/v2-deployment

Package Overview
Dependencies
Maintainers
4
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@morpho-labs/v2-deployment

Morpho v2 chain configurations for viem

latest
Source
npmnpm
Version
0.2.1
Version published
Maintainers
4
Created
Source

@morpho-labs/v2-deployment

Morpho v2 chain configurations and contract deployment tools for viem.

Features

  • đź”— Pre-configured Morpho Ethereum fork chain for viem
  • 🚀 Automated contract deployment CLI
  • đź“‹ TypeScript ABI generation
  • 📍 Address registry with deployment metadata
  • đź”§ Blue SDK integration helpers
  • đź“‚ Broadcast-based deployment parsing

Installation

npm install @morpho-labs/v2-deployment
# or
bun add @morpho-labs/v2-deployment

Fork Definition

The Morpho Ethereum Fork is a development chain that replicates Ethereum mainnet state at a specific block, pre-configured with:

  • Chain ID: 1111 (default)
  • Base: Ethereum mainnet fork
  • Purpose: Development, testing, and integration of Morpho v2 protocols
  • Features:
    • All mainnet contracts and state available
    • Pre-deployed Morpho v2 contracts
    • Blue SDK integration with mainnet token data
    • Fast block times for development

Shared Development Addresses

For internal testing and development, use these pre-funded Anvil addresses:

LabelAddressPrivate Key
Alice0xf39Fd6e51aad88F6F4ce6aB8827279cffFb922660xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
Bob0x70997970C51812dc3A010C7d01b50e0d17dc79C80x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
Charlie0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a
Dave0x90F79bf6EB2c4f870365E785982E1f101E93b9060x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6
Eve0x15d34AAf54267DB7D7c367839AAf71A00a2C6A650x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a

⚠️ Warning: These are well-known test keys. Never use them on mainnet or with real funds.

Chain Configuration

import { createPublicClient, http } from 'viem';
import { morphoEthereumFork, createMorphoFork } from '@morpho-labs/v2-deployment';

// Use the pre-configured Morpho fork (chain ID 1111)
const client = createPublicClient({
  chain: morphoEthereumFork,
  transport: http('https://rpc.tenderly.co/fork/your-fork-id')
});

// Or create a custom fork configuration
const customFork = createMorphoFork({
  forkUrl: 'https://rpc.tenderly.co/fork/custom-fork-id',
  chainId: 2222
});

// Using with Anvil (local development)
const anvilClient = createPublicClient({
  chain: morphoEthereumFork,
  transport: http('http://127.0.0.1:8545')
});

Deployment CLI

Setup

  • Create a .env.local file:
TENDERLY_FORK_RPC_URL=https://rpc.tenderly.co/fork/your-fork-id
PRIVATE_KEY=0x...
  • Check your environment:
bun run deploy:status

Available Commands

# List available contracts
bun run contracts:list

# Deploy a specific contract
bun run deploy:terms
# or
bun run scripts/deploy.ts deploy Terms

# Deploy all contracts
bun run deploy:all

# Extract addresses from existing broadcasts
bun run deploy:extract
bun run deploy:extract Terms  # Generate ABI + addresses for Terms

Command Reference

  • deploy <contract> - Deploy a specific contract to Tenderly fork
  • deploy-all - Deploy all available contracts
  • list - Show available contracts and descriptions
  • extract [contract] - Parse deployment info from broadcast files
  • status - Check environment setup and connectivity

Extract Command

The extract command is useful for parsing existing Foundry broadcast files:

# View all deployments from broadcast files
bun run scripts/deploy.ts extract

# Extract specific contract and generate TypeScript files
bun run scripts/deploy.ts extract Terms

# Extract from specific chain ID
bun run scripts/deploy.ts extract --chain 1111

This reads the broadcast/Deploy.s.sol/{chainId}/run-latest.json file and:

  • Displays deployment information (address, block, deployer, timestamp)
  • Generates TypeScript ABI files in src/abis/
  • Updates the deployment addresses registry in src/deployments/addresses.ts

Blue SDK Integration

import { setupMorphoFork, getMorphoForkAddresses } from '@morpho-labs/v2-deployment';
import { addressesRegistry } from '@morpho-org/blue-sdk';

// Setup Morpho fork with mainnet data (addresses, deployments, tokens)
setupMorphoFork(1111); // Chain ID for your Tenderly fork

// Get typed addresses for the fork
const addresses = getMorphoForkAddresses(1111);
console.log('Morpho address:', addresses.morpho);

// Access through blue-sdk registry
const morphoAddress = addressesRegistry[1111].morpho;

Generated Files

The deployment system generates:

  • src/abis/{contract}.ts - TypeScript ABI definitions
  • src/deployments/addresses.ts - Deployment registry with metadata

Example generated address file:

export const deployments = {
  1111: {
    "terms": {
      "address": "0x1234567890123456789012345678901234567890" as Address,
      "deploymentBlock": 23168920n,
      "deployer": "0x9876543210987654321098765432109876543210" as Address,
      "deployedAt": "2025-08-18T19:11:30.000Z"
    }
  }
} as const;

Development

Prerequisites

  • Foundry - Ethereum development toolkit
  • Bun - JavaScript runtime and package manager

Setup

# Install dependencies
bun install

# Build the project
bun run build

# Run tests
bun test

# Lint and format
bun run check:fix

Foundry Commands

# Build contracts
forge build

# Run tests
forge test

# Format code
forge fmt

# Gas snapshots
forge snapshot

Keywords

morpho

FAQs

Package last updated on 19 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts