Skip to content

Commit

Permalink
maintenance: contracts README update 1
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcontracts committed Feb 3, 2022
1 parent b6dedc3 commit 175ae0b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/tiny-chicken-occur.md
@@ -0,0 +1,5 @@
---
'@eth-optimism/contracts': patch
---

Minor README update
25 changes: 17 additions & 8 deletions packages/contracts/README.md
Expand Up @@ -3,16 +3,16 @@
# Optimism Smart Contracts

`@eth-optimism/contracts` contains the various Solidity smart contracts used within the Optimism system.
Some of these contracts are deployed on Ethereum ("Layer 1"), while others are meant to be deployed to Optimism ("Layer 2").
Some of these contracts are [meant to be deployed to Ethereum ("Layer 1")](https://github.com/ethereum-optimism/optimism/tree/develop/packages/contracts/contracts/L1), while others are [meant to be deployed to Optimism ("Layer 2")](https://github.com/ethereum-optimism/optimism/tree/develop/packages/contracts/contracts/L2).
Within each contract file you'll find the network upon which the contract is meant to be deloyed, listed as either `EVM` (for Ethereum) or `OVM` (for Optimism).
If neither `EVM` nor `OVM` are listed, the contract is likely intended to be used on either network.

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`.
## Usage (npm)

<!-- TODO: Add link to final contract docs here when finished. -->
You can import `@eth-optimism/contracts` to use the Optimism contracts within your own codebase.
We currently only export `@eth-optimism/contracts` via `npm`.

## Usage (npm)
If your development stack is based on Node/npm:
Install via `npm` or `yarn`:

```shell
npm install @eth-optimism/contracts
Expand All @@ -21,7 +21,16 @@ npm install @eth-optimism/contracts
Within your contracts:

```solidity
import { SomeContract } from "@eth-optimism/contracts/SomeContract.sol";
import { SomeContract } from "@eth-optimism/contracts/path/to/SomeContract.sol";
```

Note that the `/path/to/SomeContract.sol` is the path to the target contract within the [contracts folder](https://github.com/ethereum-optimism/optimism/tree/develop/packages/contracts/contracts) inside of this package.
For example, the [L1CrossDomainMessenger](/contracts/L1/messaging/L1CrossDomainMessenger.sol) contract is located at `/contracts/L1/messaging/L1CrossDomainMessenger.sol`, relative to this README.
You would therefore import the contract as:


```solidity
import { L1CrossDomainMessenger } from "@eth-optimism/contracts/L1/messaging/L1CrossDomainMessenger.sol";
```

## Guide for Developers
Expand Down

0 comments on commit 175ae0b

Please sign in to comment.