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
df38d134
Commit
df38d134
authored
Apr 05, 2023
by
Maurelian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ctb): Add doOwnershipTransfer to deploy utils
parent
153e5781
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
51 deletions
+71
-51
020-SystemDictatorSteps-1.ts
...ges/contracts-bedrock/deploy/020-SystemDictatorSteps-1.ts
+39
-51
deploy-utils.ts
packages/contracts-bedrock/src/deploy-utils.ts
+32
-0
No files found.
packages/contracts-bedrock/deploy/020-SystemDictatorSteps-1.ts
View file @
df38d134
...
...
@@ -11,10 +11,8 @@ import {
assertContractVariable
,
getContractsFromArtifacts
,
getDeploymentAddress
,
doOwnershipTransfer
,
doPhase
,
printJsonTransaction
,
printTenderlySimulationLink
,
printCastCommand
,
}
from
'
../src/deploy-utils
'
const
uint128Max
=
ethers
.
BigNumber
.
from
(
'
0xffffffffffffffffffffffffffffffff
'
)
...
...
@@ -73,10 +71,23 @@ const deployFn: DeployFunction = async (hre) => {
// Transfer ownership of the ProxyAdmin to the SystemDictator.
if
((
await
ProxyAdmin
.
owner
())
!==
SystemDictator
.
address
)
{
console
.
log
(
`Setting ProxyAdmin owner to MSD`
)
await
ProxyAdmin
.
transferOwnership
(
SystemDictator
.
address
)
}
else
{
console
.
log
(
`Proxy admin already owned by MSD`
)
await
doOwnershipTransfer
({
isLiveDeployer
,
proxy
:
ProxyAdmin
,
name
:
'
ProxyAdmin
'
,
transferFunc
:
'
transferOwnership
'
,
dictator
:
SystemDictator
,
})
// Wait for the ownership transfer to complete.
await
awaitCondition
(
async
()
=>
{
const
owner
=
await
ProxyAdmin
.
owner
()
return
owner
===
SystemDictator
.
address
},
5000
,
1000
)
}
// We don't need to transfer proxy addresses if we're already beyond the proxy transfer step.
...
...
@@ -89,20 +100,13 @@ const deployFn: DeployFunction = async (hre) => {
needsProxyTransfer
&&
(
await
AddressManager
.
owner
())
!==
SystemDictator
.
address
)
{
if
(
isLiveDeployer
)
{
console
.
log
(
`Setting AddressManager owner to MSD`
)
await
AddressManager
.
transferOwnership
(
SystemDictator
.
address
)
}
else
{
const
tx
=
await
AddressManager
.
populateTransaction
.
transferOwnership
(
SystemDictator
.
address
)
console
.
log
(
`Please transfer AddressManager owner to MSD`
)
console
.
log
(
`AddressManager address:
${
AddressManager
.
address
}
`
)
console
.
log
(
`MSD address:
${
SystemDictator
.
address
}
`
)
printJsonTransaction
(
tx
)
printCastCommand
(
tx
)
await
printTenderlySimulationLink
(
SystemDictator
.
provider
,
tx
)
}
await
doOwnershipTransfer
({
isLiveDeployer
,
proxy
:
AddressManager
,
name
:
'
AddressManager
'
,
transferFunc
:
'
transferOwnership
'
,
dictator
:
SystemDictator
,
})
// Wait for the ownership transfer to complete.
await
awaitCondition
(
...
...
@@ -124,22 +128,13 @@ const deployFn: DeployFunction = async (hre) => {
from
:
ethers
.
constants
.
AddressZero
,
}))
!==
SystemDictator
.
address
)
{
if
(
isLiveDeployer
)
{
console
.
log
(
`Setting L1StandardBridge owner to MSD`
)
await
L1StandardBridgeProxyWithSigner
.
setOwner
(
SystemDictator
.
address
)
}
else
{
const
tx
=
await
L1StandardBridgeProxy
.
populateTransaction
.
setOwner
(
SystemDictator
.
address
)
console
.
log
(
`Please transfer L1StandardBridge (proxy) owner to MSD`
)
console
.
log
(
`L1StandardBridgeProxy address:
${
L1StandardBridgeProxy
.
address
}
`
)
console
.
log
(
`MSD address:
${
SystemDictator
.
address
}
`
)
printJsonTransaction
(
tx
)
printCastCommand
(
tx
)
await
printTenderlySimulationLink
(
SystemDictator
.
provider
,
tx
)
}
await
doOwnershipTransfer
({
isLiveDeployer
,
proxy
:
L1StandardBridgeProxyWithSigner
,
name
:
'
L1StandardBridgeProxy
'
,
transferFunc
:
'
setOwner
'
,
dictator
:
SystemDictator
,
})
// Wait for the ownership transfer to complete.
await
awaitCondition
(
...
...
@@ -163,20 +158,13 @@ const deployFn: DeployFunction = async (hre) => {
from
:
ethers
.
constants
.
AddressZero
,
}))
!==
SystemDictator
.
address
)
{
if
(
isLiveDeployer
)
{
console
.
log
(
`Setting L1ERC721Bridge owner to MSD`
)
await
L1ERC721BridgeProxyWithSigner
.
changeAdmin
(
SystemDictator
.
address
)
}
else
{
const
tx
=
await
L1ERC721BridgeProxy
.
populateTransaction
.
changeAdmin
(
SystemDictator
.
address
)
console
.
log
(
`Please transfer L1ERC721Bridge (proxy) owner to MSD`
)
console
.
log
(
`L1ERC721BridgeProxy address:
${
L1ERC721BridgeProxy
.
address
}
`
)
console
.
log
(
`MSD address:
${
SystemDictator
.
address
}
`
)
printJsonTransaction
(
tx
)
printCastCommand
(
tx
)
await
printTenderlySimulationLink
(
SystemDictator
.
provider
,
tx
)
}
await
doOwnershipTransfer
({
isLiveDeployer
,
proxy
:
L1ERC721BridgeProxyWithSigner
,
name
:
'
L1ERC721BridgeProxy
'
,
transferFunc
:
'
changeAdmin
'
,
dictator
:
SystemDictator
,
})
// Wait for the ownership transfer to complete.
await
awaitCondition
(
...
...
packages/contracts-bedrock/src/deploy-utils.ts
View file @
df38d134
...
...
@@ -322,6 +322,38 @@ export const printJsonTransaction = (tx: ethers.PopulatedTransaction): void => {
)
}
/**
* Mini helper for transferring a Proxy to the MSD
*
* @param opts Options for executing the step.
* @param opts.isLiveDeployer True if the deployer is live.
* @param opts.proxy proxy contract.
* @param opts.dictator dictator contract.
*/
export
const
doOwnershipTransfer
=
async
(
opts
:
{
isLiveDeployer
?:
boolean
proxy
:
ethers
.
Contract
name
:
string
transferFunc
:
string
dictator
:
ethers
.
Contract
}):
Promise
<
void
>
=>
{
if
(
opts
.
isLiveDeployer
)
{
await
opts
.
proxy
[
opts
.
transferFunc
](
opts
.
dictator
.
address
)
}
else
{
const
tx
=
await
opts
.
proxy
.
populateTransaction
[
opts
.
transferFunc
](
opts
.
dictator
.
address
)
console
.
log
(
`
Please transfer
${
opts
.
name
}
(proxy) owner to MSD
-
${
opts
.
name
}
address:
${
opts
.
proxy
.
address
}
- MSD address:
${
opts
.
dictator
.
address
}
`
)
printJsonTransaction
(
tx
)
printCastCommand
(
tx
)
await
printTenderlySimulationLink
(
opts
.
dictator
.
provider
,
tx
)
}
}
/**
* Mini helper for checking if the current step is a target step.
*
...
...
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