OVM 2.0 Release Dates

OVM 2.0 is already released on the Kovan test network. We expect to deploy it to the production Optimistic Ethereum network on November 11th.

# Using the Protocol Contracts in OVM 2.0

OVM 2.0 Page

This page refers to the new state of Optimistic Ethereum after the OVM 2.0 update.

# Finding contract addresses

Check out the Networks and Connection Details page for links to the contract addresses for each network. You can also find the addresses for all networks in the deployments folder (opens new window) of the contracts package (opens new window). Take a look at the Contract Overview for a list of all protocol contracts and their purpose within the system.

# @eth-optimism/contracts (opens new window)

The easiest way to interact with the Optimistic Ethereum protocol contracts is to use the @eth-optimism/contracts (opens new window) npm package. You can use this package to get an interface or factory instance for any of the Optimistic Ethereum contracts.

# Installation

Install via npm or yarn:

npm install @eth-optimism/contracts

# Usage

@eth-optimism/contracts exports various useful tools. Here are some of the most useful tools exported by the package:

# getContractInterface

const { getContractInterface } = require("@eth-optimism/contracts");

// Returns an ethers.utils.Interface object
const iface = getContractInterface("CanonicalTransactionChain"); // or whatever contract

# getContractFactory

const { getContractFactory } = require("@eth-optimism/contracts");

// Returns an ethers.ContractFactory object
const factory = getContractFactory("CanonicalTransactionChain"); // or whatever contract

# getL1ContractData

const { getL1ContractData } = require("@eth-optimism/contracts");

// Returns an ethers.Contract object at the correct address
const contract = getL1ContractData("mainnet").CanonicalTransactionChain; // or whatever contract

# getL2ContractData

const { getL2ContractData } = require("@eth-optimism/contracts");

// Returns an ethers.Contract object at the correct address
const contract = getL2ContractData().Lib_AddressManager; // or whatever contract

# predeploys

const { predeploys } = require("@eth-optimism/contracts");

// Returns an address (string)
const ovmETHAddress = predeploys.OVM_GasPriceOracle; // or whatever contract