Commit 0e6af08e authored by smartcontracts's avatar smartcontracts Committed by GitHub

feat(ctb): minor README update (#3368)

Co-authored-by: default avatarMark Tyneway <mark.tyneway@gmail.com>
parent 5bbeb7af
# RPC for the L1 network to deploy to
L1_RPC=
# Private key for the deployer account
PRIVATE_KEY_DEPLOYER=
# Optimism: Bedrock Edition - Contracts
# Optimism Smart Contracts (Bedrock)
## Install
This package contains the smart contracts that compose the on-chain component of Optimism's upcoming Bedrock upgrade.
We've tried to maintain 100% backwards compatibility with the existing system while also introducing new useful features.
You can find detailed specifications for the contracts contained within this package [here](../../specs).
The repo currently uses solidity tests (run with Forge). The project uses the default hardhat directory structure, and all build/test steps should be run using the yarn scripts to ensure
the correct options are set.
## Contracts Overview
Install node modules with yarn (v1), and Node.js (16+).
### Contracts deployed to L1
| Name | Proxy Type | Description |
| ---- | ---------- | ----------- |
| [`L1CrossDomainMessenger`](../../specs/messengers.md) | [`ResolvedDelegateProxy`](./contracts/legacy/ResolvedDelegateProxy.sol) | High-level interface for sending messages to and receiving messages from Optimism |
| [`L1StandardBridge`](../../specs/bridges.md) | [`L1ChugSplashProxy`](./contracts/legacy/L1ChugSplashProxy.sol) | Standardized system for transfering ERC20 tokens to/from Optimism |
| [`L2OutputOracle`](../../specs/proposals.md#l2-output-oracle-smart-contract) | [`Proxy`](./contracts/universal/Proxy.sol) | Stores commitments to the state of Optimism which can be used by contracts on L1 to access L2 state |
| [`OptimismPortal`](../../specs/deposits.md#deposit-contract) | [`Proxy`](./contracts/universal/Proxy.sol) | Low-level message passing interface |
| [`OptimismMintableERC20Factory`](../../specs/predeploys.md#optimismmintableerc20factory) | [`Proxy`](./contracts/universal/Proxy.sol) | Deploys standard `OptimismMintableERC20` tokens that are compatible with either `StandardBridge` |
| [`ProxyAdmin`](../../specs/TODO) | - | Contract that can upgrade L1 contracts |
### Contracts deployed to L2
| Name | Proxy Type | Description |
| ---- | ---------- | ----------- |
| [`GasPriceOracle`](../../specs/predeploys.md#ovm_gaspriceoracle) | [`Proxy`](./contracts/universal/Proxy.sol) | Stores L2 gas price configuration values |
| [`L1Block`](../../specs/predeploys.md#l1block) | [`Proxy`](./contracts/universal/Proxy.sol) | Stores L1 block context information (e.g., latest known L1 block hash) |
| [`L2CrossDomainMessenger`](../../specs/predeploys.md#l2crossdomainmessenger) | [`Proxy`](./contracts/universal/Proxy.sol) | High-level interface for sending messages to and receiving messages from L1 |
| [`L2StandardBridge`](../../specs/predeploys.md#l2standardbridge) | [`Proxy`](./contracts/universal/Proxy.sol) | Standardized system for transferring ERC20 tokens to/from L1 |
| [`L2ToL1MessagePasser`](../../specs/predeploys.md#ovm_l2tol1messagepasser) | [`Proxy`](./contracts/universal/Proxy.sol) | Low-level message passing interface |
| [`SequencerFeeVault`](../../specs/predeploys.md#sequencerfeevault) | [`Proxy`](./contracts/universal/Proxy.sol) | Vault for L2 transaction fees |
| [`OptimismMintableERC20Factory`](../../specs/predeploys.md#optimismmintableerc20factory) | [`Proxy`](./contracts/universal/Proxy.sol) | Deploys standard `OptimismMintableERC20` tokens that are compatible with either `StandardBridge` |
| [`L2ProxyAdmin`](../../specs/TODO) | - | Contract that can upgrade L2 contracts when sent a transaction from L1 |
### Legacy and deprecated contracts
| Name | Location | Proxy Type | Description |
| ---- | -------- | ---------- | ----------- |
| [`AddressManager`](./contracts/legacy/AddressManager.sol) | L1 | - | Legacy upgrade mechanism (unused in Bedrock) |
| [`DeployerWhitelist`](./contracts/legacy/DeployerWhitelist.sol) | L2 | [`Proxy`](./contracts/universal/Proxy.sol) | Legacy contract for managing allowed deployers (unused since EVM Equivalence upgrade)
| [`L1BlockNumber`](./contracts/legacy/L1BlockNumber.sol) | L2 | [`Proxy`](./contracts/universal/Proxy.sol) | Legacy contract for accessing latest known L1 block number, replaced by `L1Block` |
## Installation
We export contract ABIs, contract source code, and contract deployment information for this package via `npm`:
```shell
yarn
npm install @eth-optimism/contracts-bedrock
```
See installation instructions for forge [here](https://github.com/gakonst/foundry).
## Development
## Build
### Dependencies
We work on this repository with a combination of [Hardhat](https://hardhat.org) and [Foundry](https://getfoundry.sh/).
1. Install Foundry by following [the instructions located here](https://getfoundry.sh/).
2. Install node modules with yarn (v1) and Node.js (16+):
```shell
yarn install
```
### Build
```shell
yarn build
```
## Running Tests
Then the full test suite can be executed via `yarn`:
### Tests
```shell
yarn test
```
The differential tests require typescript to be compiled to javascript.
### Deployment
## Deployment
#### Configuration
Create a file that corresponds to the network name in the `deploy-config`
directory and then run the command:
1. Create or modify a file `<network-name>.json` inside of the [`deploy-config`](./deploy-config/) folder.
2. Fill out this file according to the `deployConfigSpec` located inside of the [`hardhat.config.ts](./hardhat.config.ts)
```shell
L1_RPC=<ETHEREUM L1 RPC endpoint> \
PRIVATE_KEY_DEPLOYER=<PRIVATE KEY TO PAY FOR THE DEPLOYMENT> \
npx hardhat deploy --network <network-name>
```
#### Execution
In the `hardhat.config.ts`, there is a `deployConfigSpec` field that validates that the types
are correct, be sure to export an object in the `deploy-config/<network-name>.ts` file that
has a key for each property in the `deployConfigSpec`.
1. Copy `.env.example` into `.env`
2. Fill out the `L1_RPC` and `PRIVATE_KEY_DEPLOYER` environment variables in `.env`
3. Run `npx hardhat deploy --network <network-name>` to deploy the L1 contracts
4. Run `npx hardhat etherscan-verify --network <network-name> --sleep` to verify contracts on Etherscan
## Standards and Conventions
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment