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
bbd6243e
Unverified
Commit
bbd6243e
authored
Jul 13, 2022
by
Mark Tyneway
Committed by
GitHub
Jul 13, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2991 from ethereum-optimism/debug/devnet-ci
contracts-bedrock: better logging in deposit task
parents
f48b2abc
1341ddb9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
4 deletions
+21
-4
deposits.ts
packages/contracts-bedrock/tasks/deposits.ts
+21
-4
No files found.
packages/contracts-bedrock/tasks/deposits.ts
View file @
bbd6243e
...
@@ -66,6 +66,10 @@ task('deposit', 'Deposits funds onto L2.')
...
@@ -66,6 +66,10 @@ task('deposit', 'Deposits funds onto L2.')
const
amountWei
=
utils
.
parseEther
(
amountEth
)
const
amountWei
=
utils
.
parseEther
(
amountEth
)
const
value
=
amountWei
.
add
(
utils
.
parseEther
(
'
0.01
'
))
const
value
=
amountWei
.
add
(
utils
.
parseEther
(
'
0.01
'
))
console
.
log
(
`Depositing
${
amountEth
}
ETH to
${
to
}
`
)
console
.
log
(
`Depositing
${
amountEth
}
ETH to
${
to
}
`
)
const
preL2Balance
=
await
l2Provider
.
getBalance
(
to
)
console
.
log
(
`
${
to
}
has
${
utils
.
formatEther
(
preL2Balance
)}
ETH on L2`
)
// Below adds 0.01 ETH to account for gas.
// Below adds 0.01 ETH to account for gas.
const
tx
=
await
OptimismPortal
.
depositTransaction
(
const
tx
=
await
OptimismPortal
.
depositTransaction
(
to
,
to
,
...
@@ -77,26 +81,39 @@ task('deposit', 'Deposits funds onto L2.')
...
@@ -77,26 +81,39 @@ task('deposit', 'Deposits funds onto L2.')
)
)
console
.
log
(
`Got TX hash
${
tx
.
hash
}
. Waiting...`
)
console
.
log
(
`Got TX hash
${
tx
.
hash
}
. Waiting...`
)
const
receipt
=
await
tx
.
wait
()
const
receipt
=
await
tx
.
wait
()
console
.
log
(
console
.
log
(
`Included in block
${
receipt
.
blockHash
}
`
)
`Included in block
${
receipt
.
blockHash
}
with index
${
receipt
.
logIndex
}
`
)
// find the transaction deposited event and derive
// find the transaction deposited event and derive
// the deposit transaction from it
// the deposit transaction from it
const
event
=
receipt
.
events
.
find
(
const
event
=
receipt
.
events
.
find
(
(
e
:
Event
)
=>
e
.
event
===
'
TransactionDeposited
'
(
e
:
Event
)
=>
e
.
event
===
'
TransactionDeposited
'
)
)
const
l2tx
=
DepositTx
.
fromL1Event
(
event
)
console
.
log
(
`Deposit has log index
${
event
.
logIndex
}
`
)
console
.
log
(
`Deposit has log index
${
event
.
logIndex
}
`
)
const
l2tx
=
DepositTx
.
fromL1Event
(
event
)
const
hash
=
l2tx
.
hash
()
const
hash
=
l2tx
.
hash
()
console
.
log
(
`Waiting for L2 TX hash
${
hash
}
`
)
console
.
log
(
`Waiting for L2 TX hash
${
hash
}
`
)
let
i
=
0
while
(
true
)
{
while
(
true
)
{
const
expected
=
await
l2Provider
.
send
(
'
eth_getTransactionByHash
'
,
[
hash
])
const
expected
=
await
l2Provider
.
send
(
'
eth_getTransactionByHash
'
,
[
hash
])
if
(
expected
)
{
if
(
expected
)
{
console
.
log
(
'
Deposit success
'
)
console
.
log
(
'
Deposit success
'
)
console
.
log
(
JSON
.
stringify
(
expected
,
null
,
2
))
break
break
}
}
const
postL2Balance
=
await
l2Provider
.
getBalance
(
to
)
if
(
postL2Balance
.
gt
(
preL2Balance
))
{
console
.
log
(
`Unexpected balance increase without detecting deposit transaction`
)
}
if
(
i
%
100
===
0
)
{
const
block
=
await
l2Provider
.
getBlock
(
'
latest
'
)
console
.
log
(
`latest block
${
block
.
number
}
:
${
block
.
hash
}
`
)
}
await
sleep
(
500
)
await
sleep
(
500
)
i
++
}
}
})
})
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