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
7746080f
Commit
7746080f
authored
Apr 03, 2023
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
contracts-bedrock: fixup new hh deploy config usage
parent
2efd7f3a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
43 deletions
+58
-43
106-SequencerFeeVaultImpl.ts
...ges/contracts-bedrock/deploy/106-SequencerFeeVaultImpl.ts
+1
-1
107-BaseFeeVaultImpl.ts
packages/contracts-bedrock/deploy/107-BaseFeeVaultImpl.ts
+1
-1
108-L1FeeVaultImpl.ts
packages/contracts-bedrock/deploy/108-L1FeeVaultImpl.ts
+1
-1
deploy-utils.ts
packages/contracts-bedrock/src/deploy-utils.ts
+55
-40
No files found.
packages/contracts-bedrock/deploy/106-SequencerFeeVaultImpl.ts
View file @
7746080f
...
@@ -7,7 +7,7 @@ import { assertContractVariable, deploy } from '../src/deploy-utils'
...
@@ -7,7 +7,7 @@ import { assertContractVariable, deploy } from '../src/deploy-utils'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
l1
=
hre
.
network
.
companionNetworks
[
'
l1
'
]
const
l1
=
hre
.
network
.
companionNetworks
[
'
l1
'
]
const
deployConfig
=
hre
.
deployConfig
.
getDeployConfig
(
l1
)
const
deployConfig
=
hre
.
getDeployConfig
(
l1
)
const
sequencerFeeVaultRecipient
=
deployConfig
.
sequencerFeeVaultRecipient
const
sequencerFeeVaultRecipient
=
deployConfig
.
sequencerFeeVaultRecipient
if
(
sequencerFeeVaultRecipient
===
ethers
.
constants
.
AddressZero
)
{
if
(
sequencerFeeVaultRecipient
===
ethers
.
constants
.
AddressZero
)
{
...
...
packages/contracts-bedrock/deploy/107-BaseFeeVaultImpl.ts
View file @
7746080f
...
@@ -7,7 +7,7 @@ import { assertContractVariable, deploy } from '../src/deploy-utils'
...
@@ -7,7 +7,7 @@ import { assertContractVariable, deploy } from '../src/deploy-utils'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
l1
=
hre
.
network
.
companionNetworks
[
'
l1
'
]
const
l1
=
hre
.
network
.
companionNetworks
[
'
l1
'
]
const
deployConfig
=
hre
.
deployConfig
.
getDeployConfig
(
l1
)
const
deployConfig
=
hre
.
getDeployConfig
(
l1
)
const
baseFeeVaultRecipient
=
deployConfig
.
baseFeeVaultRecipient
const
baseFeeVaultRecipient
=
deployConfig
.
baseFeeVaultRecipient
if
(
baseFeeVaultRecipient
===
ethers
.
constants
.
AddressZero
)
{
if
(
baseFeeVaultRecipient
===
ethers
.
constants
.
AddressZero
)
{
...
...
packages/contracts-bedrock/deploy/108-L1FeeVaultImpl.ts
View file @
7746080f
...
@@ -7,7 +7,7 @@ import { assertContractVariable, deploy } from '../src/deploy-utils'
...
@@ -7,7 +7,7 @@ import { assertContractVariable, deploy } from '../src/deploy-utils'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
l1
=
hre
.
network
.
companionNetworks
[
'
l1
'
]
const
l1
=
hre
.
network
.
companionNetworks
[
'
l1
'
]
const
deployConfig
=
hre
.
deployConfig
.
getDeployConfig
(
l1
)
const
deployConfig
=
hre
.
getDeployConfig
(
l1
)
const
l1FeeVaultRecipient
=
deployConfig
.
l1FeeVaultRecipient
const
l1FeeVaultRecipient
=
deployConfig
.
l1FeeVaultRecipient
if
(
l1FeeVaultRecipient
===
ethers
.
constants
.
AddressZero
)
{
if
(
l1FeeVaultRecipient
===
ethers
.
constants
.
AddressZero
)
{
...
...
packages/contracts-bedrock/src/deploy-utils.ts
View file @
7746080f
...
@@ -44,6 +44,15 @@ export const deploy = async ({
...
@@ -44,6 +44,15 @@ export const deploy = async ({
// 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.
let
result
:
Deployment
|
DeployResult
=
await
hre
.
deployments
.
getOrNull
(
name
)
let
result
:
Deployment
|
DeployResult
=
await
hre
.
deployments
.
getOrNull
(
name
)
// Wrap in a try/catch in case there is not a deployConfig for the current network.
let
numDeployConfirmations
:
number
try
{
numDeployConfirmations
=
hre
.
deployConfig
.
numDeployConfirmations
}
catch
(
e
)
{
numDeployConfirmations
=
1
}
if
(
result
)
{
if
(
result
)
{
console
.
log
(
`skipping
${
name
}
, using existing at
${
result
.
address
}
`
)
console
.
log
(
`skipping
${
name
}
, using existing at
${
result
.
address
}
`
)
}
else
{
}
else
{
...
@@ -52,7 +61,7 @@ export const deploy = async ({
...
@@ -52,7 +61,7 @@ export const deploy = async ({
from
:
deployer
,
from
:
deployer
,
args
,
args
,
log
:
true
,
log
:
true
,
waitConfirmations
:
hre
.
deployConfig
.
numDeployConfirmations
,
waitConfirmations
:
numDeployConfirmations
,
})
})
console
.
log
(
`Deployed
${
name
}
at
${
result
.
address
}
`
)
console
.
log
(
`Deployed
${
name
}
at
${
result
.
address
}
`
)
// Only wait for the transaction if it was recently deployed in case the
// Only wait for the transaction if it was recently deployed in case the
...
@@ -68,7 +77,7 @@ export const deploy = async ({
...
@@ -68,7 +77,7 @@ export const deploy = async ({
// Create the contract object to return.
// Create the contract object to return.
const
created
=
asAdvancedContract
({
const
created
=
asAdvancedContract
({
confirmations
:
hre
.
deployConfig
.
numDeployConfirmations
,
confirmations
:
numDeployConfirmations
,
contract
:
new
Contract
(
contract
:
new
Contract
(
result
.
address
,
result
.
address
,
iface
!==
undefined
iface
!==
undefined
...
@@ -122,41 +131,41 @@ export const asAdvancedContract = (opts: {
...
@@ -122,41 +131,41 @@ export const asAdvancedContract = (opts: {
// Override each function call to also `.wait()` so as to simplify the deploy scripts' syntax.
// Override each function call to also `.wait()` so as to simplify the deploy scripts' syntax.
for
(
const
fnName
of
Object
.
keys
(
contract
.
functions
))
{
for
(
const
fnName
of
Object
.
keys
(
contract
.
functions
))
{
const
fn
=
contract
[
fnName
].
bind
(
contract
)
const
fn
=
contract
[
fnName
].
bind
(
contract
)
;
(
contract
as
any
)[
fnName
]
=
async
(...
args
:
any
)
=>
{
;
(
contract
as
any
)[
fnName
]
=
async
(...
args
:
any
)
=>
{
// We want to use the configured gas price but we need to set the gas price to zero if we're
// We want to use the configured gas price but we need to set the gas price to zero if we're
// triggering a static function.
// triggering a static function.
let
gasPrice
=
opts
.
gasPrice
let
gasPrice
=
opts
.
gasPrice
if
(
contract
.
interface
.
getFunction
(
fnName
).
constant
)
{
if
(
contract
.
interface
.
getFunction
(
fnName
).
constant
)
{
gasPrice
=
0
gasPrice
=
0
}
}
// Now actually trigger the transaction (or call).
// Now actually trigger the transaction (or call).
const
tx
=
await
fn
(...
args
,
{
const
tx
=
await
fn
(...
args
,
{
gasPrice
,
gasPrice
,
})
})
// Meant for static calls, we don't need to wait for anything, we get the result right away.
// Meant for static calls, we don't need to wait for anything, we get the result right away.
if
(
typeof
tx
!==
'
object
'
||
typeof
tx
.
wait
!==
'
function
'
)
{
if
(
typeof
tx
!==
'
object
'
||
typeof
tx
.
wait
!==
'
function
'
)
{
return
tx
return
tx
}
}
// Wait for the transaction to be included in a block and wait for the specified number of
// Wait for the transaction to be included in a block and wait for the specified number of
// deployment confirmations.
// deployment confirmations.
const
maxTimeout
=
120
const
maxTimeout
=
120
let
timeout
=
0
let
timeout
=
0
while
(
true
)
{
while
(
true
)
{
await
sleep
(
1000
)
await
sleep
(
1000
)
const
receipt
=
await
contract
.
provider
.
getTransactionReceipt
(
tx
.
hash
)
const
receipt
=
await
contract
.
provider
.
getTransactionReceipt
(
tx
.
hash
)
if
(
receipt
===
null
)
{
if
(
receipt
===
null
)
{
timeout
++
timeout
++
if
(
timeout
>
maxTimeout
)
{
if
(
timeout
>
maxTimeout
)
{
throw
new
Error
(
'
timeout exceeded waiting for txn to be mined
'
)
throw
new
Error
(
'
timeout exceeded waiting for txn to be mined
'
)
}
}
else
if
(
receipt
.
confirmations
>=
(
opts
.
confirmations
||
0
))
{
return
tx
}
}
}
else
if
(
receipt
.
confirmations
>=
(
opts
.
confirmations
||
0
))
{
return
tx
}
}
}
}
}
}
}
return
contract
return
contract
...
@@ -199,8 +208,15 @@ export const getContractFromArtifact = async (
...
@@ -199,8 +208,15 @@ export const getContractFromArtifact = async (
}
}
}
}
let
numDeployConfirmations
:
number
try
{
numDeployConfirmations
=
hre
.
deployConfig
.
numDeployConfirmations
}
catch
(
e
)
{
numDeployConfirmations
=
1
}
return
asAdvancedContract
({
return
asAdvancedContract
({
confirmations
:
hre
.
deployConfig
.
numDeployConfirmations
,
confirmations
:
numDeployConfirmations
,
contract
:
new
hre
.
ethers
.
Contract
(
contract
:
new
hre
.
ethers
.
Contract
(
artifact
.
address
,
artifact
.
address
,
iface
,
iface
,
...
@@ -385,14 +401,13 @@ export const getTenderlySimulationLink = async (
...
@@ -385,14 +401,13 @@ export const getTenderlySimulationLink = async (
tx
:
ethers
.
PopulatedTransaction
tx
:
ethers
.
PopulatedTransaction
):
Promise
<
string
>
=>
{
):
Promise
<
string
>
=>
{
if
(
process
.
env
.
TENDERLY_PROJECT
&&
process
.
env
.
TENDERLY_USERNAME
)
{
if
(
process
.
env
.
TENDERLY_PROJECT
&&
process
.
env
.
TENDERLY_USERNAME
)
{
return
`https://dashboard.tenderly.co/
${
process
.
env
.
TENDERLY_PROJECT
}
/
${
return
`https://dashboard.tenderly.co/
${
process
.
env
.
TENDERLY_PROJECT
}
/
${
process
.
env
.
TENDERLY_USERNAME
process
.
env
.
TENDERLY_USERNAME
}
/simulator/new?
${
new
URLSearchParams
({
}
/simulator/new?
${
new
URLSearchParams
({
network
:
(
await
provider
.
getNetwork
()).
chainId
.
toString
(),
network
:
(
await
provider
.
getNetwork
()).
chainId
.
toString
(),
contractAddress
:
tx
.
to
,
contractAddress
:
tx
.
to
,
rawFunctionInput
:
tx
.
data
,
rawFunctionInput
:
tx
.
data
,
from
:
tx
.
from
,
from
:
tx
.
from
,
}).
toString
()}
`
}).
toString
()}
`
}
}
}
}
...
...
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