Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ethereum-optimism/contracts
[Optimism] Smart Contracts
https://github.com/ethereum-optimism/contracts
Last synced: 3 months ago
JSON representation
[Optimism] Smart Contracts
- Host: GitHub
- URL: https://github.com/ethereum-optimism/contracts
- Owner: ethereum-optimism
- License: mit
- Archived: true
- Created: 2020-09-14T05:19:48.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-04-12T00:07:24.000Z (over 3 years ago)
- Last Synced: 2024-05-29T21:51:41.904Z (6 months ago)
- Language: Solidity
- Homepage:
- Size: 2.59 MB
- Stars: 251
- Watchers: 13
- Forks: 111
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
**[DEPRECATED]** This repository is now deprecated in favour of the new development [monorepo](https://github.com/ethereum-optimism/optimism-monorepo).
# 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](http://community.optimism.io/docs/protocol/protocol.html#system-overview).
## Usage (npm)
If your development stack is based on Node/npm:```shell
npm install @eth-optimism/contracts
```Within your contracts:
```solidity
import { SomeContract } from "@eth-optimism/contracts/SomeContract.sol";
```## Guide for Developers
### Setup
Install the following:
- [`Node.js` (14+)](https://nodejs.org/en/)
- [`npm`](https://www.npmjs.com/get-npm)
- [`yarn`](https://classic.yarnpkg.com/en/docs/install/)Clone the repo:
```shell
git clone https://github.com/ethereum-optimism/contracts.git
cd contracts
```Install `npm` packages:
```shell
yarn install
```### Running Tests
Tests are executed via `yarn`:
```shell
yarn test
```Run specific tests by giving a path to the file you want to run:
```shell
yarn test ./test/path/to/my/test.spec.ts
```### Measuring test coverage:
```shell
yarn test-coverage
```The output is most easily viewable by opening the html file in your browser:
```shell
open ./coverage/index.html
```### Compiling and Building
Easiest way is to run the primary build script:
```shell
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 build folder.
4. `build:dump` - Generates a genesis state from the contracts that L2 geth will use.
5. `build:typechain` - Generates [TypeChain](https://github.com/ethereum-ts/TypeChain) artifacts.You can also build specific components as follows:
```shell
yarn build:contracts
```## Security
Please refer to our [Security Policy](https://github.com/ethereum-optimism/.github/security/policy) for information about how to disclose security issues with this code.