Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
d288b2bb
Unverified
Commit
d288b2bb
authored
Dec 06, 2022
by
mergify[bot]
Committed by
GitHub
Dec 06, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4260 from ethereum-optimism/sc/ctb-clean-deploy-fn
maint(ctb): clean up deploy function
parents
f2dd7e85
73e9f373
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
83 additions
and
94 deletions
+83
-94
000-ProxyAdmin.ts
packages/contracts-bedrock/deploy/000-ProxyAdmin.ts
+2
-5
001-AddressManager.ts
packages/contracts-bedrock/deploy/001-AddressManager.ts
+2
-5
002-L1StandardBridgeProxy.ts
...ges/contracts-bedrock/deploy/002-L1StandardBridgeProxy.ts
+2
-5
003-L2OutputOracleProxy.ts
packages/contracts-bedrock/deploy/003-L2OutputOracleProxy.ts
+2
-2
004-L1CrossDomainMessengerProxy.ts
...ntracts-bedrock/deploy/004-L1CrossDomainMessengerProxy.ts
+2
-5
005-OptimismPortalProxy.ts
packages/contracts-bedrock/deploy/005-OptimismPortalProxy.ts
+2
-2
006-OptimismMintableERC20FactoryProxy.ts
...s-bedrock/deploy/006-OptimismMintableERC20FactoryProxy.ts
+2
-2
007-L1ERC721BridgeProxy.ts
packages/contracts-bedrock/deploy/007-L1ERC721BridgeProxy.ts
+2
-5
008-SystemConfigProxy.ts
packages/contracts-bedrock/deploy/008-SystemConfigProxy.ts
+2
-2
009-SystemDictatorProxy.ts
packages/contracts-bedrock/deploy/009-SystemDictatorProxy.ts
+2
-5
010-L1CrossDomainMessengerImpl.ts
...ontracts-bedrock/deploy/010-L1CrossDomainMessengerImpl.ts
+2
-2
011-L1StandardBridgeImpl.ts
...ages/contracts-bedrock/deploy/011-L1StandardBridgeImpl.ts
+2
-2
012-L2OutputOracleImpl.ts
packages/contracts-bedrock/deploy/012-L2OutputOracleImpl.ts
+2
-5
013-OptimismPortalImpl.ts
packages/contracts-bedrock/deploy/013-OptimismPortalImpl.ts
+2
-2
014-OptimismMintableERC20FactoryImpl.ts
...ts-bedrock/deploy/014-OptimismMintableERC20FactoryImpl.ts
+2
-2
015-L1ERC721BridgeImpl.ts
packages/contracts-bedrock/deploy/015-L1ERC721BridgeImpl.ts
+2
-2
016-PortalSenderImpl.ts
packages/contracts-bedrock/deploy/016-PortalSenderImpl.ts
+2
-2
017-SystemConfigImpl.ts
packages/contracts-bedrock/deploy/017-SystemConfigImpl.ts
+2
-5
018-SystemDictatorImpl.ts
packages/contracts-bedrock/deploy/018-SystemDictatorImpl.ts
+2
-2
deploy-utils.ts
packages/contracts-bedrock/src/deploy-utils.ts
+45
-32
No files found.
packages/contracts-bedrock/deploy/000-ProxyAdmin.ts
View file @
d288b2bb
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
import
{
assertContractVariable
,
deploy
}
from
'
../src/deploy-utils
'
assertContractVariable
,
deployAndVerifyAndThen
,
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
await
deploy
AndVerifyAndThen
({
await
deploy
({
hre
,
hre
,
name
:
'
ProxyAdmin
'
,
name
:
'
ProxyAdmin
'
,
args
:
[
deployer
],
args
:
[
deployer
],
...
...
packages/contracts-bedrock/deploy/001-AddressManager.ts
View file @
d288b2bb
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
import
{
assertContractVariable
,
deploy
}
from
'
../src/deploy-utils
'
assertContractVariable
,
deployAndVerifyAndThen
,
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
await
deploy
AndVerifyAndThen
({
await
deploy
({
hre
,
hre
,
name
:
'
Lib_AddressManager
'
,
name
:
'
Lib_AddressManager
'
,
contract
:
'
AddressManager
'
,
contract
:
'
AddressManager
'
,
...
...
packages/contracts-bedrock/deploy/002-L1StandardBridgeProxy.ts
View file @
d288b2bb
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
import
{
assertContractVariable
,
deploy
}
from
'
../src/deploy-utils
'
assertContractVariable
,
deployAndVerifyAndThen
,
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
await
deploy
AndVerifyAndThen
({
await
deploy
({
hre
,
hre
,
name
:
'
Proxy__OVM_L1StandardBridge
'
,
name
:
'
Proxy__OVM_L1StandardBridge
'
,
contract
:
'
L1ChugSplashProxy
'
,
contract
:
'
L1ChugSplashProxy
'
,
...
...
packages/contracts-bedrock/deploy/003-L2OutputOracleProxy.ts
View file @
d288b2bb
...
@@ -2,13 +2,13 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
...
@@ -2,13 +2,13 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
import
{
import
{
assertContractVariable
,
assertContractVariable
,
deploy
AndVerifyAndThen
,
deploy
,
getDeploymentAddress
,
getDeploymentAddress
,
}
from
'
../src/deploy-utils
'
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
proxyAdmin
=
await
getDeploymentAddress
(
hre
,
'
ProxyAdmin
'
)
const
proxyAdmin
=
await
getDeploymentAddress
(
hre
,
'
ProxyAdmin
'
)
await
deploy
AndVerifyAndThen
({
await
deploy
({
hre
,
hre
,
name
:
'
L2OutputOracleProxy
'
,
name
:
'
L2OutputOracleProxy
'
,
contract
:
'
Proxy
'
,
contract
:
'
Proxy
'
,
...
...
packages/contracts-bedrock/deploy/004-L1CrossDomainMessengerProxy.ts
View file @
d288b2bb
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
import
{
deploy
,
getDeploymentAddress
}
from
'
../src/deploy-utils
'
deployAndVerifyAndThen
,
getDeploymentAddress
,
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
addressManager
=
await
getDeploymentAddress
(
hre
,
'
Lib_AddressManager
'
)
const
addressManager
=
await
getDeploymentAddress
(
hre
,
'
Lib_AddressManager
'
)
await
deploy
AndVerifyAndThen
({
await
deploy
({
hre
,
hre
,
name
:
'
Proxy__OVM_L1CrossDomainMessenger
'
,
name
:
'
Proxy__OVM_L1CrossDomainMessenger
'
,
contract
:
'
ResolvedDelegateProxy
'
,
contract
:
'
ResolvedDelegateProxy
'
,
...
...
packages/contracts-bedrock/deploy/005-OptimismPortalProxy.ts
View file @
d288b2bb
...
@@ -2,13 +2,13 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
...
@@ -2,13 +2,13 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
import
{
import
{
assertContractVariable
,
assertContractVariable
,
deploy
AndVerifyAndThen
,
deploy
,
getDeploymentAddress
,
getDeploymentAddress
,
}
from
'
../src/deploy-utils
'
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
proxyAdmin
=
await
getDeploymentAddress
(
hre
,
'
ProxyAdmin
'
)
const
proxyAdmin
=
await
getDeploymentAddress
(
hre
,
'
ProxyAdmin
'
)
await
deploy
AndVerifyAndThen
({
await
deploy
({
hre
,
hre
,
name
:
'
OptimismPortalProxy
'
,
name
:
'
OptimismPortalProxy
'
,
contract
:
'
Proxy
'
,
contract
:
'
Proxy
'
,
...
...
packages/contracts-bedrock/deploy/006-OptimismMintableERC20FactoryProxy.ts
View file @
d288b2bb
...
@@ -2,13 +2,13 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
...
@@ -2,13 +2,13 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
import
{
import
{
assertContractVariable
,
assertContractVariable
,
deploy
AndVerifyAndThen
,
deploy
,
getDeploymentAddress
,
getDeploymentAddress
,
}
from
'
../src/deploy-utils
'
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
proxyAdmin
=
await
getDeploymentAddress
(
hre
,
'
ProxyAdmin
'
)
const
proxyAdmin
=
await
getDeploymentAddress
(
hre
,
'
ProxyAdmin
'
)
await
deploy
AndVerifyAndThen
({
await
deploy
({
hre
,
hre
,
name
:
'
OptimismMintableERC20FactoryProxy
'
,
name
:
'
OptimismMintableERC20FactoryProxy
'
,
contract
:
'
Proxy
'
,
contract
:
'
Proxy
'
,
...
...
packages/contracts-bedrock/deploy/007-L1ERC721BridgeProxy.ts
View file @
d288b2bb
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
import
{
assertContractVariable
,
deploy
}
from
'
../src/deploy-utils
'
assertContractVariable
,
deployAndVerifyAndThen
,
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
await
deploy
AndVerifyAndThen
({
await
deploy
({
hre
,
hre
,
name
:
'
L1ERC721BridgeProxy
'
,
name
:
'
L1ERC721BridgeProxy
'
,
contract
:
'
Proxy
'
,
contract
:
'
Proxy
'
,
...
...
packages/contracts-bedrock/deploy/008-SystemConfigProxy.ts
View file @
d288b2bb
...
@@ -2,13 +2,13 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
...
@@ -2,13 +2,13 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
import
{
import
{
assertContractVariable
,
assertContractVariable
,
deploy
AndVerifyAndThen
,
deploy
,
getDeploymentAddress
,
getDeploymentAddress
,
}
from
'
../src/deploy-utils
'
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
proxyAdmin
=
await
getDeploymentAddress
(
hre
,
'
ProxyAdmin
'
)
const
proxyAdmin
=
await
getDeploymentAddress
(
hre
,
'
ProxyAdmin
'
)
await
deploy
AndVerifyAndThen
({
await
deploy
({
hre
,
hre
,
name
:
'
SystemConfigProxy
'
,
name
:
'
SystemConfigProxy
'
,
contract
:
'
Proxy
'
,
contract
:
'
Proxy
'
,
...
...
packages/contracts-bedrock/deploy/009-SystemDictatorProxy.ts
View file @
d288b2bb
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
import
{
assertContractVariable
,
deploy
}
from
'
../src/deploy-utils
'
assertContractVariable
,
deployAndVerifyAndThen
,
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
await
deploy
AndVerifyAndThen
({
await
deploy
({
hre
,
hre
,
name
:
'
SystemDictatorProxy
'
,
name
:
'
SystemDictatorProxy
'
,
contract
:
'
Proxy
'
,
contract
:
'
Proxy
'
,
...
...
packages/contracts-bedrock/deploy/010-L1CrossDomainMessengerImpl.ts
View file @
d288b2bb
...
@@ -3,7 +3,7 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
...
@@ -3,7 +3,7 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
import
{
import
{
assertContractVariable
,
assertContractVariable
,
deploy
AndVerifyAndThen
,
deploy
,
getContractFromArtifact
,
getContractFromArtifact
,
}
from
'
../src/deploy-utils
'
}
from
'
../src/deploy-utils
'
...
@@ -13,7 +13,7 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -13,7 +13,7 @@ const deployFn: DeployFunction = async (hre) => {
'
OptimismPortalProxy
'
'
OptimismPortalProxy
'
)
)
await
deploy
AndVerifyAndThen
({
await
deploy
({
hre
,
hre
,
name
:
'
L1CrossDomainMessenger
'
,
name
:
'
L1CrossDomainMessenger
'
,
args
:
[
OptimismPortalProxy
.
address
],
args
:
[
OptimismPortalProxy
.
address
],
...
...
packages/contracts-bedrock/deploy/011-L1StandardBridgeImpl.ts
View file @
d288b2bb
...
@@ -3,7 +3,7 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
...
@@ -3,7 +3,7 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
import
{
predeploys
}
from
'
../src
'
import
{
predeploys
}
from
'
../src
'
import
{
import
{
assertContractVariable
,
assertContractVariable
,
deploy
AndVerifyAndThen
,
deploy
,
getContractFromArtifact
,
getContractFromArtifact
,
}
from
'
../src/deploy-utils
'
}
from
'
../src/deploy-utils
'
...
@@ -13,7 +13,7 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -13,7 +13,7 @@ const deployFn: DeployFunction = async (hre) => {
'
Proxy__OVM_L1CrossDomainMessenger
'
'
Proxy__OVM_L1CrossDomainMessenger
'
)
)
await
deploy
AndVerifyAndThen
({
await
deploy
({
hre
,
hre
,
name
:
'
L1StandardBridge
'
,
name
:
'
L1StandardBridge
'
,
args
:
[
L1CrossDomainMessengerProxy
.
address
],
args
:
[
L1CrossDomainMessengerProxy
.
address
],
...
...
packages/contracts-bedrock/deploy/012-L2OutputOracleImpl.ts
View file @
d288b2bb
...
@@ -2,13 +2,10 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
...
@@ -2,13 +2,10 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
import
'
@eth-optimism/hardhat-deploy-config
'
import
'
@eth-optimism/hardhat-deploy-config
'
import
'
@nomiclabs/hardhat-ethers
'
import
'
@nomiclabs/hardhat-ethers
'
import
{
import
{
assertContractVariable
,
deploy
}
from
'
../src/deploy-utils
'
assertContractVariable
,
deployAndVerifyAndThen
,
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
await
deploy
AndVerifyAndThen
({
await
deploy
({
hre
,
hre
,
name
:
'
L2OutputOracle
'
,
name
:
'
L2OutputOracle
'
,
args
:
[
args
:
[
...
...
packages/contracts-bedrock/deploy/013-OptimismPortalImpl.ts
View file @
d288b2bb
...
@@ -3,7 +3,7 @@ import '@eth-optimism/hardhat-deploy-config'
...
@@ -3,7 +3,7 @@ import '@eth-optimism/hardhat-deploy-config'
import
{
import
{
assertContractVariable
,
assertContractVariable
,
deploy
AndVerifyAndThen
,
deploy
,
getContractFromArtifact
,
getContractFromArtifact
,
}
from
'
../src/deploy-utils
'
}
from
'
../src/deploy-utils
'
...
@@ -13,7 +13,7 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -13,7 +13,7 @@ const deployFn: DeployFunction = async (hre) => {
'
L2OutputOracleProxy
'
'
L2OutputOracleProxy
'
)
)
await
deploy
AndVerifyAndThen
({
await
deploy
({
hre
,
hre
,
name
:
'
OptimismPortal
'
,
name
:
'
OptimismPortal
'
,
args
:
[
args
:
[
...
...
packages/contracts-bedrock/deploy/014-OptimismMintableERC20FactoryImpl.ts
View file @
d288b2bb
...
@@ -2,7 +2,7 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
...
@@ -2,7 +2,7 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
import
{
import
{
assertContractVariable
,
assertContractVariable
,
deploy
AndVerifyAndThen
,
deploy
,
getContractFromArtifact
,
getContractFromArtifact
,
}
from
'
../src/deploy-utils
'
}
from
'
../src/deploy-utils
'
...
@@ -12,7 +12,7 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -12,7 +12,7 @@ const deployFn: DeployFunction = async (hre) => {
'
Proxy__OVM_L1StandardBridge
'
'
Proxy__OVM_L1StandardBridge
'
)
)
await
deploy
AndVerifyAndThen
({
await
deploy
({
hre
,
hre
,
name
:
'
OptimismMintableERC20Factory
'
,
name
:
'
OptimismMintableERC20Factory
'
,
args
:
[
L1StandardBridgeProxy
.
address
],
args
:
[
L1StandardBridgeProxy
.
address
],
...
...
packages/contracts-bedrock/deploy/015-L1ERC721BridgeImpl.ts
View file @
d288b2bb
...
@@ -3,7 +3,7 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
...
@@ -3,7 +3,7 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
import
{
predeploys
}
from
'
../src
'
import
{
predeploys
}
from
'
../src
'
import
{
import
{
assertContractVariable
,
assertContractVariable
,
deploy
AndVerifyAndThen
,
deploy
,
getContractFromArtifact
,
getContractFromArtifact
,
}
from
'
../src/deploy-utils
'
}
from
'
../src/deploy-utils
'
...
@@ -13,7 +13,7 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -13,7 +13,7 @@ const deployFn: DeployFunction = async (hre) => {
'
Proxy__OVM_L1CrossDomainMessenger
'
'
Proxy__OVM_L1CrossDomainMessenger
'
)
)
await
deploy
AndVerifyAndThen
({
await
deploy
({
hre
,
hre
,
name
:
'
L1ERC721Bridge
'
,
name
:
'
L1ERC721Bridge
'
,
args
:
[
L1CrossDomainMessengerProxy
.
address
,
predeploys
.
L2ERC721Bridge
],
args
:
[
L1CrossDomainMessengerProxy
.
address
,
predeploys
.
L2ERC721Bridge
],
...
...
packages/contracts-bedrock/deploy/016-PortalSenderImpl.ts
View file @
d288b2bb
...
@@ -2,7 +2,7 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
...
@@ -2,7 +2,7 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
import
{
import
{
assertContractVariable
,
assertContractVariable
,
deploy
AndVerifyAndThen
,
deploy
,
getContractFromArtifact
,
getContractFromArtifact
,
}
from
'
../src/deploy-utils
'
}
from
'
../src/deploy-utils
'
...
@@ -12,7 +12,7 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -12,7 +12,7 @@ const deployFn: DeployFunction = async (hre) => {
'
OptimismPortalProxy
'
'
OptimismPortalProxy
'
)
)
await
deploy
AndVerifyAndThen
({
await
deploy
({
hre
,
hre
,
name
:
'
PortalSender
'
,
name
:
'
PortalSender
'
,
args
:
[
OptimismPortalProxy
.
address
],
args
:
[
OptimismPortalProxy
.
address
],
...
...
packages/contracts-bedrock/deploy/017-SystemConfigImpl.ts
View file @
d288b2bb
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
'
@eth-optimism/hardhat-deploy-config
'
import
'
@eth-optimism/hardhat-deploy-config
'
import
{
import
{
assertContractVariable
,
deploy
}
from
'
../src/deploy-utils
'
assertContractVariable
,
deployAndVerifyAndThen
,
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
batcherHash
=
hre
.
ethers
.
utils
.
hexZeroPad
(
const
batcherHash
=
hre
.
ethers
.
utils
.
hexZeroPad
(
...
@@ -12,7 +9,7 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -12,7 +9,7 @@ const deployFn: DeployFunction = async (hre) => {
32
32
)
)
await
deploy
AndVerifyAndThen
({
await
deploy
({
hre
,
hre
,
name
:
'
SystemConfig
'
,
name
:
'
SystemConfig
'
,
args
:
[
args
:
[
...
...
packages/contracts-bedrock/deploy/018-SystemDictatorImpl.ts
View file @
d288b2bb
...
@@ -2,10 +2,10 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
...
@@ -2,10 +2,10 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
import
'
@eth-optimism/hardhat-deploy-config
'
import
'
@eth-optimism/hardhat-deploy-config
'
import
'
hardhat-deploy
'
import
'
hardhat-deploy
'
import
{
deploy
AndVerifyAndThen
}
from
'
../src/deploy-utils
'
import
{
deploy
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
await
deploy
AndVerifyAndThen
({
await
deploy
({
hre
,
hre
,
name
:
'
SystemDictator
'
,
name
:
'
SystemDictator
'
,
args
:
[],
args
:
[],
...
...
packages/contracts-bedrock/src/deploy-utils.ts
View file @
d288b2bb
...
@@ -8,13 +8,26 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types'
...
@@ -8,13 +8,26 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types'
import
'
hardhat-deploy
'
import
'
hardhat-deploy
'
import
'
@eth-optimism/hardhat-deploy-config
'
import
'
@eth-optimism/hardhat-deploy-config
'
import
'
@nomiclabs/hardhat-ethers
'
import
'
@nomiclabs/hardhat-ethers
'
import
{
Deployment
,
DeployResult
}
from
'
hardhat-deploy/dist/types
'
export
const
deployAndVerifyAndThen
=
async
({
/**
* Wrapper around hardhat-deploy with some extra features.
*
* @param opts Options for the deployment.
* @param opts.hre HardhatRuntimeEnvironment.
* @param opts.contract Name of the contract to deploy.
* @param opts.name Name to use for the deployment file.
* @param opts.iface Interface to use for the returned contract.
* @param opts.args Arguments to pass to the contract constructor.
* @param opts.postDeployAction Action to perform after the contract is deployed.
* @returns Deployed contract object.
*/
export
const
deploy
=
async
({
hre
,
hre
,
name
,
name
,
iface
,
args
,
args
,
contract
,
contract
,
iface
,
postDeployAction
,
postDeployAction
,
}:
{
}:
{
hre
:
HardhatRuntimeEnvironment
hre
:
HardhatRuntimeEnvironment
...
@@ -24,47 +37,47 @@ export const deployAndVerifyAndThen = async ({
...
@@ -24,47 +37,47 @@ export const deployAndVerifyAndThen = async ({
iface
?:
string
iface
?:
string
postDeployAction
?:
(
contract
:
Contract
)
=>
Promise
<
void
>
postDeployAction
?:
(
contract
:
Contract
)
=>
Promise
<
void
>
})
=>
{
})
=>
{
const
{
deploy
}
=
hre
.
deployments
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
// Hardhat deploy will usually do this check for us, but currently doesn't also consider
// Hardhat deploy will usually do this check for us, but currently doesn't also consider
// external deployments when doing this check. By doing the check ourselves, we also get to
// external deployments when doing this check. By doing the check ourselves, we also get to
// consider external deployments. If we already have the deployment, return early.
// consider external deployments. If we already have the deployment, return early.
const
existing
=
await
hre
.
deployments
.
getOrNull
(
name
)
let
result
:
Deployment
|
DeployResult
=
await
hre
.
deployments
.
getOrNull
(
name
)
if
(
existing
)
{
if
(
result
)
{
console
.
log
(
console
.
log
(
`skipping
${
name
}
, using existing at
${
result
.
address
}
`
)
`skipping
${
name
}
deployment, using existing at
${
existing
.
address
}
`
}
else
{
)
result
=
await
hre
.
deployments
.
deploy
(
name
,
{
return
}
const
result
=
await
deploy
(
name
,
{
contract
,
contract
,
from
:
deployer
,
from
:
deployer
,
args
,
args
,
log
:
true
,
log
:
true
,
waitConfirmations
:
hre
.
deployConfig
.
numDeployConfirmations
,
waitConfirmations
:
hre
.
deployConfig
.
numDeployConfirmations
,
})
})
}
// Always wait for the transaction to be mined, just in case.
await
hre
.
ethers
.
provider
.
waitForTransaction
(
result
.
transactionHash
)
await
hre
.
ethers
.
provider
.
waitForTransaction
(
result
.
transactionHash
)
if
(
result
.
newlyDeployed
)
{
// Create the contract object to return.
if
(
postDeployAction
)
{
const
created
=
getAdvancedContract
({
const
signer
=
hre
.
ethers
.
provider
.
getSigner
(
deployer
)
let
abi
=
result
.
abi
if
(
iface
!==
undefined
)
{
const
factory
=
await
hre
.
ethers
.
getContractFactory
(
iface
)
abi
=
factory
.
interface
as
any
}
await
postDeployAction
(
getAdvancedContract
({
hre
,
hre
,
contract
:
new
Contract
(
result
.
address
,
abi
,
signer
),
contract
:
new
Contract
(
result
.
address
,
iface
!==
undefined
?
(
await
hre
.
ethers
.
getContractFactory
(
iface
)).
interface
:
result
.
abi
,
hre
.
ethers
.
provider
.
getSigner
(
deployer
)
),
})
})
)
// Run post-deploy actions if necessary.
if
((
result
as
DeployResult
).
newlyDeployed
)
{
if
(
postDeployAction
)
{
await
postDeployAction
(
created
)
}
}
}
}
return
created
}
}
// Returns a version of the contract object which modifies all of the input contract's methods to:
// Returns a version of the contract object which modifies all of the input contract's methods to:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment