Introduction

This package contains the L1 and L2 smart contracts for the OP Stack. Detailed specifications for the contracts contained within this package can be found at specs.optimism.io. High-level information about these contracts can be found within this book and within the Optimism Developer Docs. For more information about contributing to OP Stack smart contract development, read on in this book.

Contributing

Contributing Guide

Contributions to the OP Stack are always welcome. Please refer to the CONTRIBUTING.md for general information about how to contribute to the OP Stack monorepo.

When contributing to the contracts-bedrock package there are some additional steps you should follow. These have been conveniently packaged into a just command which you should run before pushing your changes.

just pre-pr

Style Guide

OP Stack smart contracts should be written according to the style guide found within this book. Maintaining a consistent code style makes code easier to review and maintain, ultimately making the development process safer.

Contract Interfaces

OP Stack smart contracts use contract interfaces in a relatively unique way. Please refer to the [interfaces guide] ifaces to read more about how the OP Stack uses contract interfaces.

Solidity Versioning

OP Stack smart contracts are designed to utilize a single, consistent Solidity version. Please refer to the Solidity upgrades guide to understand the process for updating to newer Solidity versions.

Frozen Code

From time to time we need to ensure that certain files remain frozen, as they may be under audit or a large PR is in the works and we wish to avoid a large rebase. In order to enforce this, a hardcoded list of contracts is stored in ./scripts/checks/check-frozen-files.sh. Any change which affects the resulting init or source code of a contract which is not allowed to be modified will prevent merging to the develop branch.

In order to remove a file from the freeze it must be removed from the check file.