npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@metis.io/contracts

v1.2.3

Published

`@eth-optimism/contracts` contains the various Solidity smart contracts used within the Optimistic Ethereum system. Some of these contracts are deployed on Ethereum ("Layer 1"), while others are meant to be deployed to Optimistic Ethereum ("Layer 2").

Downloads

4

Readme

codecov

Optimistic Ethereum Smart Contracts

@eth-optimism/contracts contains the various Solidity smart contracts used within the Optimistic Ethereum system. Some of these contracts are deployed on Ethereum ("Layer 1"), while others are meant to be deployed to Optimistic Ethereum ("Layer 2").

Within each contract file you'll find a comment that lists:

  1. The compiler with which a contract is intended to be compiled, solc or optimistic-solc.
  2. The network upon to which the contract will be deployed, OVM or EVM.

A more detailed overview of these contracts can be found on the community hub.

Usage (npm)

If your development stack is based on Node/npm:

npm install @eth-optimism/contracts

Within your contracts:

import { SomeContract } from "@eth-optimism/contracts/SomeContract.sol";

Guide for Developers

Setup

Install the following:

Clone the repo:

git clone https://github.com/ethereum-optimism/contracts.git
cd contracts

Install npm packages:

yarn install

Running Tests

Tests are executed via yarn:

yarn test

Run specific tests by giving a path to the file you want to run:

yarn test ./test/path/to/my/test.spec.ts

Measuring test coverage:

yarn test:coverage

The output is most easily viewable by opening the html file in your browser:

open ./coverage/index.html

Compiling and Building

Easiest way is to run the primary build script:

yarn build

Running the full build command will perform the following actions:

  1. build:contracts - Compile all Solidity contracts with both the EVM and OVM compilers.
  2. build:typescript - Builds the typescript files that are used to export utilities into js.
  3. build:copy - Copies various other files into the dist folder.
  4. build:dump - Generates a genesis state from the contracts that L2 geth will use.
  5. build:typechain - Generates TypeChain artifacts.

You can also build specific components as follows:

yarn build:contracts

Deploying the Contracts

To deploy the contracts first clone, install, and build the contracts package.

Next set the following env vars:

CONTRACTS_TARGET_NETWORK=...
CONTRACTS_DEPLOYER_KEY=...
CONTRACTS_RPC_URL=...

Then to perform the actual deployment run:

npx hardhat deploy \
  --network ... \  # `network` MUST equal your env var `CONTRACTS_TARGET_NETWORK`
  --ovm-address-manager-owner ... \
  --ovm-proposer-address ... \
  --ovm-relayer-address ... \
  --ovm-sequencer-address ... \
  --scc-fraud-proof-window ... \
  --scc-sequencer-publish-window ...

This will deploy the contracts to the network specified in your env and create an artifacts directory in ./deployments.

To view all deployment options run:

npx hardhat deploy --help

Hardhat version 2.2.1

Usage: hardhat [GLOBAL OPTIONS] deploy [--ctc-force-inclusion-period-seconds <INT>] [--ctc-max-transaction-gas-limit <INT>] --deploy-scripts <STRING> [--em-max-gas-per-queue-per-epoch <INT>] [--em-max-transaction-gas-limit <INT>] [--em-min-transaction-gas-limit <INT>] [--em-ovm-chain-id <INT>] [--em-seconds-per-epoch <INT>] --export <STRING> --export-all <STRING> --gasprice <STRING> [--l1-block-time-seconds <INT>] [--no-compile] [--no-impersonation] --ovm-address-manager-owner <STRING> --ovm-proposer-address <STRING> --ovm-relayer-address <STRING> --ovm-sequencer-address <STRING> [--reset] [--scc-fraud-proof-window <INT>] [--scc-sequencer-publish-window <INT>] [--silent] --tags <STRING> [--watch] --write <BOOLEAN>

OPTIONS:

  --ctc-force-inclusion-period-seconds  Number of seconds that the sequencer has to include transactions before the L1 queue. (default: 2592000)
  --ctc-max-transaction-gas-limit       Max gas limit for L1 queue transactions. (default: 9000000)
  --deploy-scripts                      override deploy script folder path
  --em-max-gas-per-queue-per-epoch      Maximum gas allowed in a given queue for each epoch. (default: 250000000)
  --em-max-transaction-gas-limit        Maximum allowed transaction gas limit. (default: 9000000)
  --em-min-transaction-gas-limit        Minimum allowed transaction gas limit. (default: 50000)
  --em-ovm-chain-id                     Chain ID for the L2 network. (default: 420)
  --em-seconds-per-epoch                Number of seconds in each epoch. (default: 0)
  --export                              export current network deployments
  --export-all                          export all deployments into one file
  --gasprice                            gas price to use for transactions
  --l1-block-time-seconds               Number of seconds on average between every L1 block. (default: 15)
  --no-compile                          disable pre compilation
  --no-impersonation                    do not impersonate unknown accounts
  --ovm-address-manager-owner           Address that will own the Lib_AddressManager. Must be provided or this deployment will fail.
  --ovm-proposer-address                Address of the account that will propose state roots. Must be provided or this deployment will fail.
  --ovm-relayer-address                 Address of the message relayer. Must be provided or this deployment will fail.
  --ovm-sequencer-address               Address of the sequencer. Must be provided or this deployment will fail.
  --reset                               whether to delete deployments files first
  --scc-fraud-proof-window              Number of seconds until a transaction is considered finalized. (default: 604800)
  --scc-sequencer-publish-window        Number of seconds that the sequencer is exclusively allowed to post state roots. (default: 1800)
  --silent                              whether to remove log
  --tags                                specify which deploy script to execute via tags, separated by commas
  --watch                               redeploy on every change of contract or deploy script
  --write                               whether to write deployments to file

deploy: Deploy contracts

For global options help run: hardhat help

Verifying Deployments on Etherscan

If you are using a network which Etherscan supports you can verify your contracts with:

npx hardhat etherscan-verify --api-key ... --network ...

Other hardhat tasks

To whitelist deployers on Mainnet you must have the whitelist Owner wallet connected, then run:

npx hardhat whitelist \
  --use-ledger true \
  --contracts-rpc-url https://mainnet.optimism.io \
  --address ... \ # address to whitelist

To withdraw ETH fees to L1 on Mainnet, run:

npx hardhat withdraw-fees \
  --use-ledger \  # The ledger to withdraw fees with. Ensure this wallet has ETH on L2 to pay the tx fee.
  --contracts-rpc-url https://mainnet.optimism.io \

Security

Please refer to our Security Policy for information about how to disclose security issues with this code.