Package Exports
- @eth-optimism/contracts
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@eth-optimism/contracts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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:
- The compiler with which a contract is intended to be compiled,
solcoroptimistic-solc. - The network upon to which the contract will be deployed,
OVMorEVM.
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/contractsWithin 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 contractsInstall npm packages:
yarn installRunning Tests
Tests are executed via yarn:
yarn testRun specific tests by giving a path to the file you want to run:
yarn test ./test/path/to/my/test.spec.tsMeasuring test coverage:
yarn test-coverageThe output is most easily viewable by opening the html file in your browser:
open ./coverage/index.htmlCompiling and Building
Easiest way is to run the primary build script:
yarn buildRunning the full build command will perform the following actions:
build:contracts- Compile all Solidity contracts with both the EVM and OVM compilers.build:typescript- Builds the typescript files that are used to export utilities into js.build:copy- Copies various other files into the dist folder.build:dump- Generates a genesis state from the contracts that L2 geth will use.build:typechain- Generates TypeChain artifacts.
You can also build specific components as follows:
yarn build:contractsSecurity
Please refer to our Security Policy for information about how to disclose security issues with this code.