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
2ba9a0f8
Unverified
Commit
2ba9a0f8
authored
Jan 13, 2023
by
mergify[bot]
Committed by
GitHub
Jan 13, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4706 from ethereum-optimism/fix/better-logs-deposit-task
sdk: better logs in deposit task
parents
6a5cc4eb
b7ff546d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
1 deletion
+25
-1
deposit-eth.ts
packages/sdk/tasks/deposit-eth.ts
+25
-1
No files found.
packages/sdk/tasks/deposit-eth.ts
View file @
2ba9a0f8
...
@@ -18,6 +18,8 @@ import {
...
@@ -18,6 +18,8 @@ import {
DEFAULT_L2_CONTRACT_ADDRESSES
,
DEFAULT_L2_CONTRACT_ADDRESSES
,
}
from
'
../src
'
}
from
'
../src
'
const
{
formatEther
}
=
utils
task
(
'
deposit-eth
'
,
'
Deposits ether to L2.
'
)
task
(
'
deposit-eth
'
,
'
Deposits ether to L2.
'
)
.
addParam
(
.
addParam
(
'
l2ProviderUrl
'
,
'
l2ProviderUrl
'
,
...
@@ -67,7 +69,7 @@ task('deposit-eth', 'Deposits ether to L2.')
...
@@ -67,7 +69,7 @@ task('deposit-eth', 'Deposits ether to L2.')
if
(
balance
.
eq
(
0
))
{
if
(
balance
.
eq
(
0
))
{
throw
new
Error
(
'
Signer has no balance
'
)
throw
new
Error
(
'
Signer has no balance
'
)
}
}
console
.
log
(
`Signer balance:
${
utils
.
formatEther
(
balance
.
toString
())}
`
)
console
.
log
(
`Signer balance:
${
formatEther
(
balance
.
toString
())}
`
)
const
l2Provider
=
new
providers
.
StaticJsonRpcProvider
(
args
.
l2ProviderUrl
)
const
l2Provider
=
new
providers
.
StaticJsonRpcProvider
(
args
.
l2ProviderUrl
)
...
@@ -216,8 +218,13 @@ task('deposit-eth', 'Deposits ether to L2.')
...
@@ -216,8 +218,13 @@ task('deposit-eth', 'Deposits ether to L2.')
OptimismPortal
.
address
OptimismPortal
.
address
)
)
const
l1BridgeBalanceBefore
=
await
signer
.
provider
.
getBalance
(
L1StandardBridge
.
address
)
// Deposit ETH
// Deposit ETH
console
.
log
(
'
Depositing ETH through StandardBridge
'
)
console
.
log
(
'
Depositing ETH through StandardBridge
'
)
console
.
log
(
`Sending
${
formatEther
(
amount
)}
ether`
)
const
ethDeposit
=
await
messenger
.
depositETH
(
amount
,
{
recipient
:
to
})
const
ethDeposit
=
await
messenger
.
depositETH
(
amount
,
{
recipient
:
to
})
console
.
log
(
`Transaction hash:
${
ethDeposit
.
hash
}
`
)
console
.
log
(
`Transaction hash:
${
ethDeposit
.
hash
}
`
)
const
depositMessageReceipt
=
await
messenger
.
waitForMessageReceipt
(
const
depositMessageReceipt
=
await
messenger
.
waitForMessageReceipt
(
...
@@ -234,6 +241,23 @@ task('deposit-eth', 'Deposits ether to L2.')
...
@@ -234,6 +241,23 @@ task('deposit-eth', 'Deposits ether to L2.')
OptimismPortal
.
address
OptimismPortal
.
address
)
)
const
l1BridgeBalanceAfter
=
await
signer
.
provider
.
getBalance
(
L1StandardBridge
.
address
)
console
.
log
(
`L1StandardBridge balance before:
${
formatEther
(
l1BridgeBalanceBefore
)}
`
)
console
.
log
(
`L1StandardBridge balance after:
${
formatEther
(
l1BridgeBalanceAfter
)}
`
)
console
.
log
(
`OptimismPortal balance before:
${
formatEther
(
opBalanceBefore
)}
`
)
console
.
log
(
`OptimismPortal balance after:
${
formatEther
(
opBalanceAfter
)}
`
)
if
(
!
opBalanceBefore
.
add
(
amount
).
eq
(
opBalanceAfter
))
{
if
(
!
opBalanceBefore
.
add
(
amount
).
eq
(
opBalanceAfter
))
{
throw
new
Error
(
`OptimismPortal balance mismatch`
)
throw
new
Error
(
`OptimismPortal balance mismatch`
)
}
}
...
...
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