Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add contract deployment scripts #192

Merged
merged 3 commits into from
Jul 27, 2020
Merged

Conversation

smartcontracts
Copy link
Contributor

Description

This PR adds simple contract deployment scripts to the contracts package.

API for deployments is:

const deployAllContracts = async (
  config: RollupDeployConfig
): Promise<AddressResolverMapping>

Where RollupDeployConfig is defined as:

interface RollupDeployConfig {
  signer: Signer
  rollupOptions: {
    gasLimit: number
    forceInclusionPeriod: number
    owner: Signer
    sequencer: Signer
    l1ToL2TransactionPasser: Signer
  },
  addressResolverConfig?: {
    factory: ContractFactory,
    params: any[],
    signer: Signer
  },
  contractDeployConfig?: Partial<ContractDeployConfig>
  dependencies?: ContractFactoryName[]
}

Where contractDeployConfig is a partial of ContractDeployConfig is an object mapping factory names to deploy options:

interface ContractDeployConfig {
  L1ToL2TransactionQueue: ContractDeployOptions
  SafetyTransactionQueue: ContractDeployOptions
  CanonicalTransactionChain: ContractDeployOptions
  StateCommitmentChain: ContractDeployOptions
  StateManager: ContractDeployOptions
  ExecutionManager: ContractDeployOptions
  SafetyChecker: ContractDeployOptions
  FraudVerifier: ContractDeployOptions
  ContractAddressGenerator: ContractDeployOptions
  EthMerkleTrie: ContractDeployOptions
  RLPEncode: ContractDeployOptions
  RollupMerkleUtils: ContractDeployOptions
}

Since it's a partial, you can provide a subset of these contracts and the rest will be deployed as their default versions.

And each ContractDeployOptions is:

interface ContractDeployOptions {
  factory: ContractFactory
  params: any[]
  signer: Signer
}

dependencies is simply an array of contract factory names to deploy. If not provided, the function will deploy all contracts.

Returns an object of the form:

{
  addressResolver: Contract,
  contracts: { [name: string]: Contract }
}

You can also use the second helper function deployAndRegister to overwrite an address in the AddressResolver and replace the contract on the fly:

const deployAndRegister = async (
  addressResolver: Contract,
  name: string,
  deployConfig: ContractDeployOptions
): Promise<Contract>

Where addressResolver.getAddress(name) will then point to the contract deployed based on the provided deployConfig.

Questions

  • Does the API look ok?
  • Any additions that would make this more useful?

Contributing Agreement

Copy link

@willmeister willmeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@smartcontracts smartcontracts merged commit d15918e into master Jul 27, 2020
@gakonst gakonst deleted the YAS-XXX/contracts/deployment branch March 18, 2021 15:02
Lredhdx pushed a commit to node-real/combo-optimism that referenced this pull request Jun 17, 2024
bap2pecs pushed a commit to babylonlabs-io/optimism that referenced this pull request Jul 31, 2024
OptimismBot pushed a commit that referenced this pull request Jan 16, 2025
* chore: partial implementation comments

* feat: new lockbox

* feat: introduce dependency manager predeploy

* feat: remove timestamp check from CrossL2Inbox

* feat: introduce cluster manager role and remove immutables

* fix: remove unnecessary code, fix tests and setup

* feat: use unstructured storage and OZ v5

* fix: L2ToL2CDM dependency set check

* fix: dependency manager gas limit

* feat: refactor interop feature contracts (#200)

* feat: refactor interop feature contracts

* fix: add noops comment

* feat: adds OptimismPortal migrated flag

* test: add missing tests

* fix: portal interop storage naming

---------

Co-authored-by: Skeletor Spaceman <[email protected]>
mslipper added a commit that referenced this pull request Feb 6, 2025
* feat: add shared lockbox (#126)

* feat: create shared lockbox contract with its interface and unit tests

* chore: polish tests and interfaces

* chore: run pre-pr

* chore: improve natspec

* chore: run pre-pr

* chore: update compiler version

* feat: integrate portal to lockbox (#139)

* feat: integrate portal to lockbox

* fix: pr fixes

* test: refactor assert

* feat: add liquidity migrator contract with its unit test and interface (#128)

* feat: create shared lockbox contract with its interface and unit tests

* chore: polish tests and interfaces

* chore: run pre-pr

* chore: improve natspec

* chore: run pre-pr

* feat: add liqudity migrator contract with its unit test and interface

* chore: remove underscore on stack var

* chore: add todo

* chore: run pre-pr

* chore: add contract title natspec and proxied

* refactor: integrate testing suite with common test

* chore: pre-pr

* chore: add spec test

* feat: integrate system config with superchain config (#140)

* feat: integrate portal to lockbox

* fix: pr fixes

* test: refactor assert

* feat: integrate system config with superchain config

* fix: remove OPCM interop

* test: add dependency counter test

* feat: manage dependency set on superchain config (#138)

* chore: add zero dependencies check (#142)

* fix: pre pr

* feat: Add pause check (#145)

* feat: Add pause check

Co-authored-by: 0xParticle <[email protected]>
Co-authored-by: gotzenx <[email protected]>
Co-authored-by: Joxess <[email protected]>

* test: add tests natspecs

---------

Co-authored-by: 0xParticle <[email protected]>
Co-authored-by: gotzenx <[email protected]>
Co-authored-by: Joxess <[email protected]>

* fix: pre pr and interfaces imports

* feat: add upgrader role to superchain config (#163)

* feat: use superchain config lockbox in portal (#164)

* feat: use superchain config lockbox in portal

* test: add new sharedlockbox test

* fix: pre pr

* feat: liquidity migrator deployment (#166)

* feat: liquidity migrator deployment

* test: fix comment

* test: fix internal variables names

* feat: dependency set refactor (#170)

* feat: dependency set refactor

* fix: deploy script variable name

* fix: pr

* fix: pr

* fix: pre pr

* fix: semgrep

* fix: merge conflict

* [WIP] feat: new lockbox (#192)

* chore: partial implementation comments

* feat: new lockbox

* feat: introduce dependency manager predeploy

* feat: remove timestamp check from CrossL2Inbox

* feat: introduce cluster manager role and remove immutables

* fix: remove unnecessary code, fix tests and setup

* feat: use unstructured storage and OZ v5

* fix: L2ToL2CDM dependency set check

* fix: dependency manager gas limit

* feat: refactor interop feature contracts (#200)

* feat: refactor interop feature contracts

* fix: add noops comment

* feat: adds OptimismPortal migrated flag

* test: add missing tests

* fix: portal interop storage naming

---------

Co-authored-by: Skeletor Spaceman <[email protected]>

* fix: pre pr, setup and tests

* fix: remove system config interop and add interop portal target check (#205)

* fix: remove system config interop and add interop portal check

* fix: interop portal target check order

* fix: remove wrong comment

* fix: refactor portal noops function (#206)

* test: add dependency manager and portal interop tests (#209)

* feat: initialize shared lockbox in interop portal (#211)

* feat: initialize shared lockbox in interop portal

* fix: refactor shared lockbox storage getter

* fix: lockbox pr fixes (#214)

* fix: pre pr

* fix: semver lock

* fix: semver lock

* feat: descope dependency manager (#242)

* feat: descope dependency manager

* test: fix tests

* test: fix tests

* chore: improve eth liquidity test (#248)

* fix: internal review fixes (#243)

* fix: I-0

* fix: I-1

* fix: I-2

* fix: I-3

* fix: I-6

* fix: I-7

* fix: I-9

* fix: pre pr

* fix: pre pr

* fix: portal withdrawal checks (#255)

* fix: portal withdrawal checks

* fix: include current withdrawal check

* fix: remove unused interop contracts (#256)

* test: fix flake tests (#257)

* fix: adjust op-deployer interop scripts (#262)

* fix: pre pr

* fix op-deployer tests

* remove dependency code

* fix lint

* use Bob account

---------

Co-authored-by: Disco <[email protected]>
Co-authored-by: AgusDuha <[email protected]>
Co-authored-by: agusduha <[email protected]>
Co-authored-by: 0xParticle <[email protected]>
Co-authored-by: gotzenx <[email protected]>
Co-authored-by: Joxess <[email protected]>
Co-authored-by: Skeletor Spaceman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants