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
3c228713
Commit
3c228713
authored
Jun 15, 2023
by
Andreas Bigger
Committed by
Mark Tyneway
Jun 16, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DisputeGameFactory devnet deploy scripts
parent
cd24e96b
Changes
15
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
1321 additions
and
0 deletions
+1321
-0
010-DisputeGameFactoryProxy.ts
...s/contracts-bedrock/deploy/010-DisputeGameFactoryProxy.ts
+25
-0
011-L1CrossDomainMessengerImpl.ts
...ontracts-bedrock/deploy/011-L1CrossDomainMessengerImpl.ts
+31
-0
012-L1StandardBridgeImpl.ts
...ages/contracts-bedrock/deploy/012-L1StandardBridgeImpl.ts
+37
-0
013-L2OutputOracleImpl.ts
packages/contracts-bedrock/deploy/013-L2OutputOracleImpl.ts
+61
-0
014-OptimismPortalImpl.ts
packages/contracts-bedrock/deploy/014-OptimismPortalImpl.ts
+72
-0
015-OptimismMintableERC20FactoryImpl.ts
...ts-bedrock/deploy/015-OptimismMintableERC20FactoryImpl.ts
+31
-0
016-L1ERC721BridgeImpl.ts
packages/contracts-bedrock/deploy/016-L1ERC721BridgeImpl.ts
+32
-0
017-PortalSenderImpl.ts
packages/contracts-bedrock/deploy/017-PortalSenderImpl.ts
+31
-0
018-SystemConfigImpl.ts
packages/contracts-bedrock/deploy/018-SystemConfigImpl.ts
+94
-0
019-SystemDictatorImpl.ts
packages/contracts-bedrock/deploy/019-SystemDictatorImpl.ts
+17
-0
020-DisputeGameFactoryImpl.ts
...es/contracts-bedrock/deploy/020-DisputeGameFactoryImpl.ts
+26
-0
021-DisputeGameFactoryInit.ts
...es/contracts-bedrock/deploy/021-DisputeGameFactoryInit.ts
+53
-0
022-SystemDictatorInit.ts
packages/contracts-bedrock/deploy/022-SystemDictatorInit.ts
+195
-0
023-SystemDictatorSteps-1.ts
...ges/contracts-bedrock/deploy/023-SystemDictatorSteps-1.ts
+256
-0
024-SystemDictatorSteps-2.ts
...ges/contracts-bedrock/deploy/024-SystemDictatorSteps-2.ts
+360
-0
No files found.
packages/contracts-bedrock/deploy/010-DisputeGameFactoryProxy.ts
0 → 100644
View file @
3c228713
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
deploy
,
getDeploymentAddress
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
proxyAdmin
=
await
getDeploymentAddress
(
hre
,
'
ProxyAdmin
'
)
// We only want to deploy the dgf on devnet for now
if
(
hre
.
deployConfig
.
l1ChainID
===
900
)
{
console
.
log
(
'
Devnet detected, deploying DisputeGameFactoryProxy
'
)
const
disputeGameFactoryProxy
=
await
deploy
({
hre
,
name
:
'
DisputeGameFactoryProxy
'
,
contract
:
'
Proxy
'
,
args
:
[
proxyAdmin
],
})
console
.
log
(
'
DisputeGameFactoryProxy deployed at
'
+
disputeGameFactoryProxy
.
address
)
}
}
deployFn
.
tags
=
[
'
DisputeGameFactoryProxy
'
,
'
setup
'
,
'
l1
'
]
export
default
deployFn
packages/contracts-bedrock/deploy/011-L1CrossDomainMessengerImpl.ts
0 → 100644
View file @
3c228713
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
assertContractVariable
,
deploy
,
getContractFromArtifact
,
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
OptimismPortalProxy
=
await
getContractFromArtifact
(
hre
,
'
OptimismPortalProxy
'
)
await
deploy
({
hre
,
name
:
'
L1CrossDomainMessenger
'
,
args
:
[
OptimismPortalProxy
.
address
],
postDeployAction
:
async
(
contract
)
=>
{
await
assertContractVariable
(
contract
,
'
PORTAL
'
,
OptimismPortalProxy
.
address
)
},
})
}
deployFn
.
tags
=
[
'
L1CrossDomainMessengerImpl
'
,
'
setup
'
,
'
l1
'
]
export
default
deployFn
packages/contracts-bedrock/deploy/012-L1StandardBridgeImpl.ts
0 → 100644
View file @
3c228713
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
predeploys
}
from
'
../src
'
import
{
assertContractVariable
,
deploy
,
getContractFromArtifact
,
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
L1CrossDomainMessengerProxy
=
await
getContractFromArtifact
(
hre
,
'
Proxy__OVM_L1CrossDomainMessenger
'
)
await
deploy
({
hre
,
name
:
'
L1StandardBridge
'
,
args
:
[
L1CrossDomainMessengerProxy
.
address
],
postDeployAction
:
async
(
contract
)
=>
{
await
assertContractVariable
(
contract
,
'
MESSENGER
'
,
L1CrossDomainMessengerProxy
.
address
)
await
assertContractVariable
(
contract
,
'
OTHER_BRIDGE
'
,
predeploys
.
L2StandardBridge
)
},
})
}
deployFn
.
tags
=
[
'
L1StandardBridgeImpl
'
,
'
setup
'
,
'
l1
'
]
export
default
deployFn
packages/contracts-bedrock/deploy/013-L2OutputOracleImpl.ts
0 → 100644
View file @
3c228713
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
'
@eth-optimism/hardhat-deploy-config
'
import
'
@nomiclabs/hardhat-ethers
'
import
{
assertContractVariable
,
deploy
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
if
(
hre
.
deployConfig
.
l2BlockTime
===
0
)
{
throw
new
Error
(
'
L2OutputOracle deployment: l2BlockTime must be greater than 0
'
)
}
if
(
hre
.
deployConfig
.
l2OutputOracleSubmissionInterval
===
0
)
{
throw
new
Error
(
'
L2OutputOracle deployment: submissionInterval cannot be 0
'
)
}
await
deploy
({
hre
,
name
:
'
L2OutputOracle
'
,
args
:
[
hre
.
deployConfig
.
l2OutputOracleSubmissionInterval
,
hre
.
deployConfig
.
l2BlockTime
,
0
,
0
,
hre
.
deployConfig
.
l2OutputOracleProposer
,
hre
.
deployConfig
.
l2OutputOracleChallenger
,
hre
.
deployConfig
.
finalizationPeriodSeconds
,
],
postDeployAction
:
async
(
contract
)
=>
{
await
assertContractVariable
(
contract
,
'
SUBMISSION_INTERVAL
'
,
hre
.
deployConfig
.
l2OutputOracleSubmissionInterval
)
await
assertContractVariable
(
contract
,
'
L2_BLOCK_TIME
'
,
hre
.
deployConfig
.
l2BlockTime
)
await
assertContractVariable
(
contract
,
'
PROPOSER
'
,
hre
.
deployConfig
.
l2OutputOracleProposer
)
await
assertContractVariable
(
contract
,
'
CHALLENGER
'
,
hre
.
deployConfig
.
l2OutputOracleChallenger
)
await
assertContractVariable
(
contract
,
'
FINALIZATION_PERIOD_SECONDS
'
,
hre
.
deployConfig
.
finalizationPeriodSeconds
)
},
})
}
deployFn
.
tags
=
[
'
L2OutputOracleImpl
'
,
'
setup
'
,
'
l1
'
]
export
default
deployFn
packages/contracts-bedrock/deploy/014-OptimismPortalImpl.ts
0 → 100644
View file @
3c228713
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
'
@eth-optimism/hardhat-deploy-config
'
import
{
assertContractVariable
,
deploy
,
getContractFromArtifact
,
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
const
isLiveDeployer
=
deployer
.
toLowerCase
()
===
hre
.
deployConfig
.
controller
.
toLowerCase
()
const
L2OutputOracleProxy
=
await
getContractFromArtifact
(
hre
,
'
L2OutputOracleProxy
'
)
const
Artifact__SystemConfigProxy
=
await
hre
.
deployments
.
get
(
'
SystemConfigProxy
'
)
const
portalGuardian
=
hre
.
deployConfig
.
portalGuardian
const
portalGuardianCode
=
await
hre
.
ethers
.
provider
.
getCode
(
portalGuardian
)
if
(
portalGuardianCode
===
'
0x
'
)
{
console
.
log
(
`WARNING: setting OptimismPortal.GUARDIAN to
${
portalGuardian
}
and it has no code`
)
if
(
!
isLiveDeployer
)
{
throw
new
Error
(
'
Do not deploy to production networks without the GUARDIAN being a contract
'
)
}
}
// Deploy the OptimismPortal implementation as paused to
// ensure that users do not interact with it and instead
// interact with the proxied contract.
// The `portalGuardian` is set at the GUARDIAN.
await
deploy
({
hre
,
name
:
'
OptimismPortal
'
,
args
:
[
L2OutputOracleProxy
.
address
,
portalGuardian
,
true
,
// paused
Artifact__SystemConfigProxy
.
address
,
],
postDeployAction
:
async
(
contract
)
=>
{
await
assertContractVariable
(
contract
,
'
L2_ORACLE
'
,
L2OutputOracleProxy
.
address
)
await
assertContractVariable
(
contract
,
'
GUARDIAN
'
,
hre
.
deployConfig
.
portalGuardian
)
await
assertContractVariable
(
contract
,
'
SYSTEM_CONFIG
'
,
Artifact__SystemConfigProxy
.
address
)
},
})
}
deployFn
.
tags
=
[
'
OptimismPortalImpl
'
,
'
setup
'
,
'
l1
'
]
export
default
deployFn
packages/contracts-bedrock/deploy/015-OptimismMintableERC20FactoryImpl.ts
0 → 100644
View file @
3c228713
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
assertContractVariable
,
deploy
,
getContractFromArtifact
,
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
L1StandardBridgeProxy
=
await
getContractFromArtifact
(
hre
,
'
Proxy__OVM_L1StandardBridge
'
)
await
deploy
({
hre
,
name
:
'
OptimismMintableERC20Factory
'
,
args
:
[
L1StandardBridgeProxy
.
address
],
postDeployAction
:
async
(
contract
)
=>
{
await
assertContractVariable
(
contract
,
'
BRIDGE
'
,
L1StandardBridgeProxy
.
address
)
},
})
}
deployFn
.
tags
=
[
'
OptimismMintableERC20FactoryImpl
'
,
'
setup
'
,
'
l1
'
]
export
default
deployFn
packages/contracts-bedrock/deploy/016-L1ERC721BridgeImpl.ts
0 → 100644
View file @
3c228713
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
predeploys
}
from
'
../src
'
import
{
assertContractVariable
,
deploy
,
getContractFromArtifact
,
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
L1CrossDomainMessengerProxy
=
await
getContractFromArtifact
(
hre
,
'
Proxy__OVM_L1CrossDomainMessenger
'
)
await
deploy
({
hre
,
name
:
'
L1ERC721Bridge
'
,
args
:
[
L1CrossDomainMessengerProxy
.
address
,
predeploys
.
L2ERC721Bridge
],
postDeployAction
:
async
(
contract
)
=>
{
await
assertContractVariable
(
contract
,
'
MESSENGER
'
,
L1CrossDomainMessengerProxy
.
address
)
},
})
}
deployFn
.
tags
=
[
'
L1ERC721BridgeImpl
'
,
'
setup
'
,
'
l1
'
]
export
default
deployFn
packages/contracts-bedrock/deploy/017-PortalSenderImpl.ts
0 → 100644
View file @
3c228713
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
assertContractVariable
,
deploy
,
getContractFromArtifact
,
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
OptimismPortalProxy
=
await
getContractFromArtifact
(
hre
,
'
OptimismPortalProxy
'
)
await
deploy
({
hre
,
name
:
'
PortalSender
'
,
args
:
[
OptimismPortalProxy
.
address
],
postDeployAction
:
async
(
contract
)
=>
{
await
assertContractVariable
(
contract
,
'
PORTAL
'
,
OptimismPortalProxy
.
address
)
},
})
}
deployFn
.
tags
=
[
'
PortalSenderImpl
'
,
'
setup
'
,
'
l1
'
]
export
default
deployFn
packages/contracts-bedrock/deploy/018-SystemConfigImpl.ts
0 → 100644
View file @
3c228713
import
assert
from
'
assert
'
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
'
@eth-optimism/hardhat-deploy-config
'
import
{
BigNumber
}
from
'
ethers
'
import
{
defaultResourceConfig
}
from
'
../src/constants
'
import
{
assertContractVariable
,
deploy
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
batcherHash
=
hre
.
ethers
.
utils
.
hexZeroPad
(
hre
.
deployConfig
.
batchSenderAddress
,
32
)
.
toLowerCase
()
const
l2GenesisBlockGasLimit
=
BigNumber
.
from
(
hre
.
deployConfig
.
l2GenesisBlockGasLimit
)
const
l2GasLimitLowerBound
=
BigNumber
.
from
(
defaultResourceConfig
.
systemTxMaxGas
+
defaultResourceConfig
.
maxResourceLimit
)
if
(
l2GenesisBlockGasLimit
.
lt
(
l2GasLimitLowerBound
))
{
throw
new
Error
(
`L2 genesis block gas limit must be at least
${
l2GasLimitLowerBound
}
`
)
}
await
deploy
({
hre
,
name
:
'
SystemConfig
'
,
args
:
[
hre
.
deployConfig
.
finalSystemOwner
,
hre
.
deployConfig
.
gasPriceOracleOverhead
,
hre
.
deployConfig
.
gasPriceOracleScalar
,
batcherHash
,
l2GenesisBlockGasLimit
,
hre
.
deployConfig
.
p2pSequencerAddress
,
defaultResourceConfig
,
],
postDeployAction
:
async
(
contract
)
=>
{
await
assertContractVariable
(
contract
,
'
owner
'
,
hre
.
deployConfig
.
finalSystemOwner
)
await
assertContractVariable
(
contract
,
'
overhead
'
,
hre
.
deployConfig
.
gasPriceOracleOverhead
)
await
assertContractVariable
(
contract
,
'
scalar
'
,
hre
.
deployConfig
.
gasPriceOracleScalar
)
await
assertContractVariable
(
contract
,
'
batcherHash
'
,
batcherHash
)
await
assertContractVariable
(
contract
,
'
unsafeBlockSigner
'
,
hre
.
deployConfig
.
p2pSequencerAddress
)
const
config
=
await
contract
.
resourceConfig
()
assert
(
config
.
maxResourceLimit
===
defaultResourceConfig
.
maxResourceLimit
)
assert
(
config
.
elasticityMultiplier
===
defaultResourceConfig
.
elasticityMultiplier
)
assert
(
config
.
baseFeeMaxChangeDenominator
===
defaultResourceConfig
.
baseFeeMaxChangeDenominator
)
assert
(
BigNumber
.
from
(
config
.
systemTxMaxGas
).
eq
(
defaultResourceConfig
.
systemTxMaxGas
)
)
assert
(
BigNumber
.
from
(
config
.
minimumBaseFee
).
eq
(
defaultResourceConfig
.
minimumBaseFee
)
)
assert
(
BigNumber
.
from
(
config
.
maximumBaseFee
).
eq
(
defaultResourceConfig
.
maximumBaseFee
)
)
},
})
}
deployFn
.
tags
=
[
'
SystemConfigImpl
'
,
'
setup
'
,
'
l1
'
]
export
default
deployFn
packages/contracts-bedrock/deploy/019-SystemDictatorImpl.ts
0 → 100644
View file @
3c228713
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
'
@eth-optimism/hardhat-deploy-config
'
import
'
hardhat-deploy
'
import
{
deploy
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
await
deploy
({
hre
,
name
:
'
SystemDictator
'
,
args
:
[],
})
}
deployFn
.
tags
=
[
'
SystemDictatorImpl
'
,
'
setup
'
,
'
l1
'
]
export
default
deployFn
packages/contracts-bedrock/deploy/020-DisputeGameFactoryImpl.ts
0 → 100644
View file @
3c228713
import
assert
from
'
assert
'
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
deploy
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
// We only want to deploy the dgf on devnet for now
if
(
hre
.
deployConfig
.
l1ChainID
===
900
)
{
const
disputeGameFactory
=
await
deploy
({
hre
,
name
:
'
DisputeGameFactory
'
,
args
:
[],
})
console
.
log
(
'
DisputeGameFactory deployed at
'
+
disputeGameFactory
.
address
)
const
finalOwner
=
hre
.
deployConfig
.
finalSystemOwner
await
disputeGameFactory
.
initialize
(
finalOwner
)
const
fetchedOwner
=
await
disputeGameFactory
.
owner
()
assert
(
fetchedOwner
===
finalOwner
)
console
.
log
(
'
DisputeGameFactory implementation initialized
'
)
}
}
deployFn
.
tags
=
[
'
DisputeGameFactoryImpl
'
,
'
setup
'
,
'
l1
'
]
export
default
deployFn
packages/contracts-bedrock/deploy/021-DisputeGameFactoryInit.ts
0 → 100644
View file @
3c228713
import
assert
from
'
assert
'
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
'
@eth-optimism/hardhat-deploy-config
'
import
'
hardhat-deploy
'
import
{
getContractsFromArtifacts
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
// The DisputeGameFactory is only deployed on devnet
if
(
hre
.
deployConfig
.
l1ChainID
===
900
)
{
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
const
[
proxyAdmin
,
disputeGameFactoryProxy
,
disputeGameFactoryImpl
]
=
await
getContractsFromArtifacts
(
hre
,
[
{
name
:
'
ProxyAdmin
'
,
signerOrProvider
:
deployer
,
},
{
name
:
'
DisputeGameFactoryProxy
'
,
iface
:
'
DisputeGameFactory
'
,
signerOrProvider
:
deployer
,
},
{
name
:
'
DisputeGameFactory
'
,
},
])
const
finalOwner
=
hre
.
deployConfig
.
finalSystemOwner
try
{
const
tx
=
await
proxyAdmin
.
upgradeAndCall
(
disputeGameFactoryProxy
.
address
,
disputeGameFactoryImpl
.
address
,
disputeGameFactoryProxy
.
interface
.
encodeFunctionData
(
'
initialize
'
,
[
finalOwner
,
])
)
await
tx
.
wait
()
}
catch
(
e
)
{
console
.
log
(
'
DisputeGameFactory already initialized
'
)
}
const
fetchedOwner
=
await
disputeGameFactoryProxy
.
callStatic
.
owner
()
assert
(
fetchedOwner
===
finalOwner
)
console
.
log
(
'
Updgraded and initialized DisputeGameFactory
'
)
}
}
deployFn
.
tags
=
[
'
DisputeGameFactoryInitialize
'
,
'
l1
'
]
export
default
deployFn
packages/contracts-bedrock/deploy/022-SystemDictatorInit.ts
0 → 100644
View file @
3c228713
import
assert
from
'
assert
'
import
{
ethers
}
from
'
ethers
'
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
awaitCondition
}
from
'
@eth-optimism/core-utils
'
import
'
@eth-optimism/hardhat-deploy-config
'
import
'
hardhat-deploy
'
import
{
getContractsFromArtifacts
,
getDeploymentAddress
,
}
from
'
../src/deploy-utils
'
import
{
defaultResourceConfig
}
from
'
../src/constants
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
// Load the contracts we need to interact with.
const
[
SystemDictator
,
SystemDictatorProxy
,
SystemDictatorProxyWithSigner
,
SystemDictatorImpl
,
]
=
await
getContractsFromArtifacts
(
hre
,
[
{
name
:
'
SystemDictatorProxy
'
,
iface
:
'
SystemDictator
'
,
signerOrProvider
:
deployer
,
},
{
name
:
'
SystemDictatorProxy
'
,
},
{
name
:
'
SystemDictatorProxy
'
,
signerOrProvider
:
deployer
,
},
{
name
:
'
SystemDictator
'
,
signerOrProvider
:
deployer
,
},
])
// Load the dictator configuration.
const
config
=
{
globalConfig
:
{
proxyAdmin
:
await
getDeploymentAddress
(
hre
,
'
ProxyAdmin
'
),
controller
:
hre
.
deployConfig
.
controller
,
finalOwner
:
hre
.
deployConfig
.
finalSystemOwner
,
addressManager
:
await
getDeploymentAddress
(
hre
,
'
Lib_AddressManager
'
),
},
proxyAddressConfig
:
{
l2OutputOracleProxy
:
await
getDeploymentAddress
(
hre
,
'
L2OutputOracleProxy
'
),
optimismPortalProxy
:
await
getDeploymentAddress
(
hre
,
'
OptimismPortalProxy
'
),
l1CrossDomainMessengerProxy
:
await
getDeploymentAddress
(
hre
,
'
Proxy__OVM_L1CrossDomainMessenger
'
),
l1StandardBridgeProxy
:
await
getDeploymentAddress
(
hre
,
'
Proxy__OVM_L1StandardBridge
'
),
optimismMintableERC20FactoryProxy
:
await
getDeploymentAddress
(
hre
,
'
OptimismMintableERC20FactoryProxy
'
),
l1ERC721BridgeProxy
:
await
getDeploymentAddress
(
hre
,
'
L1ERC721BridgeProxy
'
),
systemConfigProxy
:
await
getDeploymentAddress
(
hre
,
'
SystemConfigProxy
'
),
},
implementationAddressConfig
:
{
l2OutputOracleImpl
:
await
getDeploymentAddress
(
hre
,
'
L2OutputOracle
'
),
optimismPortalImpl
:
await
getDeploymentAddress
(
hre
,
'
OptimismPortal
'
),
l1CrossDomainMessengerImpl
:
await
getDeploymentAddress
(
hre
,
'
L1CrossDomainMessenger
'
),
l1StandardBridgeImpl
:
await
getDeploymentAddress
(
hre
,
'
L1StandardBridge
'
),
optimismMintableERC20FactoryImpl
:
await
getDeploymentAddress
(
hre
,
'
OptimismMintableERC20Factory
'
),
l1ERC721BridgeImpl
:
await
getDeploymentAddress
(
hre
,
'
L1ERC721Bridge
'
),
portalSenderImpl
:
await
getDeploymentAddress
(
hre
,
'
PortalSender
'
),
systemConfigImpl
:
await
getDeploymentAddress
(
hre
,
'
SystemConfig
'
),
},
systemConfigConfig
:
{
owner
:
hre
.
deployConfig
.
finalSystemOwner
,
overhead
:
hre
.
deployConfig
.
gasPriceOracleOverhead
,
scalar
:
hre
.
deployConfig
.
gasPriceOracleScalar
,
batcherHash
:
hre
.
ethers
.
utils
.
hexZeroPad
(
hre
.
deployConfig
.
batchSenderAddress
,
32
),
gasLimit
:
hre
.
deployConfig
.
l2GenesisBlockGasLimit
,
unsafeBlockSigner
:
hre
.
deployConfig
.
p2pSequencerAddress
,
// The resource config is not exposed to the end user
// to simplify deploy config. It may be introduced in the future.
resourceConfig
:
defaultResourceConfig
,
},
}
// Update the implementation if necessary.
if
(
(
await
SystemDictatorProxy
.
callStatic
.
implementation
({
from
:
ethers
.
constants
.
AddressZero
,
}))
!==
SystemDictatorImpl
.
address
)
{
console
.
log
(
'
Upgrading the SystemDictator proxy...
'
)
// Upgrade and initialize the proxy.
await
SystemDictatorProxyWithSigner
.
upgradeToAndCall
(
SystemDictatorImpl
.
address
,
SystemDictatorImpl
.
interface
.
encodeFunctionData
(
'
initialize
'
,
[
config
])
)
// Wait for the transaction to execute properly.
await
awaitCondition
(
async
()
=>
{
return
(
(
await
SystemDictatorProxy
.
callStatic
.
implementation
({
from
:
ethers
.
constants
.
AddressZero
,
}))
===
SystemDictatorImpl
.
address
)
},
30000
,
1000
)
// Verify that the contract was initialized correctly.
const
dictatorConfig
=
await
SystemDictator
.
config
()
for
(
const
[
outerConfigKey
,
outerConfigValue
]
of
Object
.
entries
(
config
))
{
for
(
const
[
innerConfigKey
,
innerConfigValue
]
of
Object
.
entries
(
outerConfigValue
))
{
let
have
=
dictatorConfig
[
outerConfigKey
][
innerConfigKey
]
let
want
=
innerConfigValue
as
any
if
(
ethers
.
utils
.
isAddress
(
want
))
{
want
=
want
.
toLowerCase
()
have
=
have
.
toLowerCase
()
}
else
if
(
typeof
want
===
'
number
'
)
{
want
=
ethers
.
BigNumber
.
from
(
want
)
have
=
ethers
.
BigNumber
.
from
(
have
)
assert
(
want
.
eq
(
have
),
`incorrect config for
${
outerConfigKey
}
.
${
innerConfigKey
}
. Want:
${
want
}
, have:
${
have
}
`
)
return
}
assert
(
want
===
have
,
`incorrect config for
${
outerConfigKey
}
.
${
innerConfigKey
}
. Want:
${
want
}
, have:
${
have
}
`
)
}
}
}
// Update the owner if necessary.
if
(
(
await
SystemDictatorProxy
.
callStatic
.
admin
({
from
:
ethers
.
constants
.
AddressZero
,
}))
!==
hre
.
deployConfig
.
controller
)
{
console
.
log
(
'
Transferring ownership of the SystemDictator proxy...
'
)
// Transfer ownership to the controller address.
await
SystemDictatorProxyWithSigner
.
changeAdmin
(
hre
.
deployConfig
.
controller
)
// Wait for the transaction to execute properly.
await
awaitCondition
(
async
()
=>
{
return
(
(
await
SystemDictatorProxy
.
callStatic
.
admin
({
from
:
ethers
.
constants
.
AddressZero
,
}))
===
hre
.
deployConfig
.
controller
)
},
30000
,
1000
)
}
}
deployFn
.
tags
=
[
'
SystemDictatorImpl
'
,
'
setup
'
,
'
l1
'
]
export
default
deployFn
packages/contracts-bedrock/deploy/023-SystemDictatorSteps-1.ts
0 → 100644
View file @
3c228713
import
assert
from
'
assert
'
import
{
ethers
}
from
'
ethers
'
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
awaitCondition
}
from
'
@eth-optimism/core-utils
'
import
'
@eth-optimism/hardhat-deploy-config
'
import
'
hardhat-deploy
'
import
'
@nomiclabs/hardhat-ethers
'
import
{
assertContractVariable
,
getContractsFromArtifacts
,
getDeploymentAddress
,
doOwnershipTransfer
,
doPhase
,
liveDeployer
,
}
from
'
../src/deploy-utils
'
const
uint128Max
=
ethers
.
BigNumber
.
from
(
'
0xffffffffffffffffffffffffffffffff
'
)
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
// Set up required contract references.
const
[
SystemDictator
,
ProxyAdmin
,
AddressManager
,
L1StandardBridgeProxy
,
L1StandardBridgeProxyWithSigner
,
L1ERC721BridgeProxy
,
L1ERC721BridgeProxyWithSigner
,
SystemConfigProxy
,
]
=
await
getContractsFromArtifacts
(
hre
,
[
{
name
:
'
SystemDictatorProxy
'
,
iface
:
'
SystemDictator
'
,
signerOrProvider
:
deployer
,
},
{
name
:
'
ProxyAdmin
'
,
signerOrProvider
:
deployer
,
},
{
name
:
'
Lib_AddressManager
'
,
signerOrProvider
:
deployer
,
},
{
name
:
'
Proxy__OVM_L1StandardBridge
'
,
},
{
name
:
'
Proxy__OVM_L1StandardBridge
'
,
signerOrProvider
:
deployer
,
},
{
name
:
'
L1ERC721BridgeProxy
'
,
},
{
name
:
'
L1ERC721BridgeProxy
'
,
signerOrProvider
:
deployer
,
},
{
name
:
'
SystemConfigProxy
'
,
iface
:
'
SystemConfig
'
,
signerOrProvider
:
deployer
,
},
])
// If we have the key for the controller then we don't need to wait for external txns.
// Set the DISABLE_LIVE_DEPLOYER=true in the env to ensure the script will pause to simulate scenarios
// where the controller is not the deployer.
const
isLiveDeployer
=
await
liveDeployer
({
hre
,
disabled
:
process
.
env
.
DISABLE_LIVE_DEPLOYER
,
})
// Transfer ownership of the ProxyAdmin to the SystemDictator.
if
((
await
ProxyAdmin
.
owner
())
!==
SystemDictator
.
address
)
{
await
doOwnershipTransfer
({
isLiveDeployer
,
proxy
:
ProxyAdmin
,
name
:
'
ProxyAdmin
'
,
transferFunc
:
'
transferOwnership
'
,
dictator
:
SystemDictator
,
})
}
// We don't need to transfer proxy addresses if we're already beyond the proxy transfer step.
const
needsProxyTransfer
=
(
await
SystemDictator
.
currentStep
())
<=
(
await
SystemDictator
.
PROXY_TRANSFER_STEP
())
// Transfer ownership of the AddressManager to SystemDictator.
if
(
needsProxyTransfer
&&
(
await
AddressManager
.
owner
())
!==
SystemDictator
.
address
)
{
await
doOwnershipTransfer
({
isLiveDeployer
,
proxy
:
AddressManager
,
name
:
'
AddressManager
'
,
transferFunc
:
'
transferOwnership
'
,
dictator
:
SystemDictator
,
})
}
else
{
console
.
log
(
`AddressManager already owned by the SystemDictator`
)
}
// Transfer ownership of the L1StandardBridge (proxy) to SystemDictator.
if
(
needsProxyTransfer
&&
(
await
L1StandardBridgeProxy
.
callStatic
.
getOwner
({
from
:
ethers
.
constants
.
AddressZero
,
}))
!==
SystemDictator
.
address
)
{
await
doOwnershipTransfer
({
isLiveDeployer
,
proxy
:
L1StandardBridgeProxyWithSigner
,
name
:
'
L1StandardBridgeProxy
'
,
transferFunc
:
'
setOwner
'
,
dictator
:
SystemDictator
,
})
}
else
{
console
.
log
(
`L1StandardBridge already owned by MSD`
)
}
// Transfer ownership of the L1ERC721Bridge (proxy) to SystemDictator.
if
(
needsProxyTransfer
&&
(
await
L1ERC721BridgeProxy
.
callStatic
.
admin
({
from
:
ethers
.
constants
.
AddressZero
,
}))
!==
SystemDictator
.
address
)
{
await
doOwnershipTransfer
({
isLiveDeployer
,
proxy
:
L1ERC721BridgeProxyWithSigner
,
name
:
'
L1ERC721BridgeProxy
'
,
transferFunc
:
'
changeAdmin
'
,
dictator
:
SystemDictator
,
})
}
else
{
console
.
log
(
`L1ERC721Bridge already owned by MSD`
)
}
// Wait for the ownership transfers to complete before continuing.
await
awaitCondition
(
async
():
Promise
<
boolean
>
=>
{
const
proxyAdminOwner
=
await
ProxyAdmin
.
owner
()
const
addressManagerOwner
=
await
AddressManager
.
owner
()
const
l1StandardBridgeOwner
=
await
L1StandardBridgeProxy
.
callStatic
.
getOwner
({
from
:
ethers
.
constants
.
AddressZero
,
})
const
l1Erc721BridgeOwner
=
await
L1ERC721BridgeProxy
.
callStatic
.
admin
({
from
:
ethers
.
constants
.
AddressZero
,
})
return
(
proxyAdminOwner
===
SystemDictator
.
address
&&
addressManagerOwner
===
SystemDictator
.
address
&&
l1StandardBridgeOwner
===
SystemDictator
.
address
&&
l1Erc721BridgeOwner
===
SystemDictator
.
address
)
},
5000
,
1000
)
await
doPhase
({
isLiveDeployer
,
SystemDictator
,
phase
:
1
,
message
:
`
Phase 1 includes the following steps:
Step 1 will configure the ProxyAdmin contract, you can safely execute this step at any time
without impacting the functionality of the rest of the system.
Step 2 will stop deposits and withdrawals via the L1CrossDomainMessenger and will stop the
DTL from syncing new deposits via the CTC, effectively shutting down the legacy system. Once
this step has been executed, you should immediately begin the L2 migration process. If you
need to restart the system, run exit1() followed by finalize().
`
,
checks
:
async
()
=>
{
// Step 1 checks
await
assertContractVariable
(
ProxyAdmin
,
'
addressManager
'
,
AddressManager
.
address
)
assert
(
(
await
ProxyAdmin
.
implementationName
(
getDeploymentAddress
(
hre
,
'
Proxy__OVM_L1CrossDomainMessenger
'
)
))
===
'
OVM_L1CrossDomainMessenger
'
)
assert
(
(
await
ProxyAdmin
.
proxyType
(
getDeploymentAddress
(
hre
,
'
Proxy__OVM_L1CrossDomainMessenger
'
)
))
===
2
)
assert
(
(
await
ProxyAdmin
.
proxyType
(
getDeploymentAddress
(
hre
,
'
Proxy__OVM_L1StandardBridge
'
)
))
===
1
)
// Check the SystemConfig was initialized properly.
await
assertContractVariable
(
SystemConfigProxy
,
'
owner
'
,
hre
.
deployConfig
.
finalSystemOwner
)
await
assertContractVariable
(
SystemConfigProxy
,
'
overhead
'
,
hre
.
deployConfig
.
gasPriceOracleOverhead
)
await
assertContractVariable
(
SystemConfigProxy
,
'
scalar
'
,
hre
.
deployConfig
.
gasPriceOracleScalar
)
await
assertContractVariable
(
SystemConfigProxy
,
'
batcherHash
'
,
ethers
.
utils
.
hexZeroPad
(
hre
.
deployConfig
.
batchSenderAddress
.
toLowerCase
(),
32
)
)
await
assertContractVariable
(
SystemConfigProxy
,
'
gasLimit
'
,
hre
.
deployConfig
.
l2GenesisBlockGasLimit
)
const
config
=
await
SystemConfigProxy
.
resourceConfig
()
assert
(
config
.
maxResourceLimit
===
20
_000_000
)
assert
(
config
.
elasticityMultiplier
===
10
)
assert
(
config
.
baseFeeMaxChangeDenominator
===
8
)
assert
(
config
.
systemTxMaxGas
===
1
_000_000
)
assert
(
ethers
.
utils
.
parseUnits
(
'
1
'
,
'
gwei
'
).
eq
(
config
.
minimumBaseFee
))
assert
(
config
.
maximumBaseFee
.
eq
(
uint128Max
))
// Step 2 checks
const
messenger
=
await
AddressManager
.
getAddress
(
'
OVM_L1CrossDomainMessenger
'
)
assert
(
messenger
===
ethers
.
constants
.
AddressZero
)
},
})
}
deployFn
.
tags
=
[
'
SystemDictatorSteps
'
,
'
phase1
'
,
'
l1
'
]
export
default
deployFn
packages/contracts-bedrock/deploy/024-SystemDictatorSteps-2.ts
0 → 100644
View file @
3c228713
This diff is collapsed.
Click to expand it.
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