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
b63f5760
Unverified
Commit
b63f5760
authored
Nov 22, 2022
by
mergify[bot]
Committed by
GitHub
Nov 22, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4028 from ethereum-optimism/sc/ctb-sdk-flakes
fix(sdk): test flakes
parents
085daa6c
69a0602e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
11 deletions
+29
-11
deposit-erc20.ts
packages/sdk/tasks/deposit-erc20.ts
+29
-11
No files found.
packages/sdk/tasks/deposit-erc20.ts
View file @
b63f5760
...
...
@@ -4,11 +4,12 @@ import { task, types } from 'hardhat/config'
import
{
HardhatRuntimeEnvironment
}
from
'
hardhat/types
'
import
'
@nomiclabs/hardhat-ethers
'
import
'
hardhat-deploy
'
import
{
Event
,
Contract
,
Wallet
,
providers
,
utils
}
from
'
ethers
'
import
{
predeploys
,
getContractDefinition
,
}
from
'
@eth-optimism/contracts-bedrock
'
import
{
Event
,
Contract
,
Wallet
,
providers
,
utils
}
from
'
ether
s
'
import
{
sleep
}
from
'
@eth-optimism/core-util
s
'
import
{
CrossChainMessenger
,
...
...
@@ -247,18 +248,35 @@ task('deposit-erc20', 'Deposits WETH9 onto L2.')
await
depositTx
.
wait
()
console
.
log
(
`ERC20 deposited -
${
depositTx
.
hash
}
`
)
const
messageReceipt
=
await
messenger
.
waitForMessageReceipt
(
depositTx
)
if
(
messageReceipt
.
receiptStatus
!==
1
)
{
throw
new
Error
(
'
deposit failed
'
)
}
// Deposit might get reorged, wait 10s and also log for reorgs.
let
prevBlockNumber
=
0
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
const
messageReceipt
=
await
messenger
.
waitForMessageReceipt
(
depositTx
)
if
(
messageReceipt
.
receiptStatus
!==
1
)
{
throw
new
Error
(
'
deposit failed
'
)
}
if
(
i
>
0
&&
messageReceipt
.
transactionReceipt
.
blockNumber
!==
prevBlockNumber
)
{
console
.
log
(
`Block number changed from
${
prevBlockNumber
}
to
${
messageReceipt
.
transactionReceipt
.
blockNumber
}
`
)
}
prevBlockNumber
=
messageReceipt
.
transactionReceipt
.
blockNumber
await
sleep
(
1000
)
const
l2Balance
=
await
OptimismMintableERC20
.
balanceOf
(
address
)
if
(
l2Balance
.
lt
(
utils
.
parseEther
(
'
1
'
)))
{
throw
new
Error
(
'
bad deposit
'
)
const
l2Balance
=
await
OptimismMintableERC20
.
balanceOf
(
address
)
if
(
l2Balance
.
lt
(
utils
.
parseEther
(
'
1
'
)))
{
throw
new
Error
(
'
bad deposit
'
)
}
console
.
log
(
`Deposit success -
${
messageReceipt
.
transactionReceipt
.
transactionHash
}
`
)
}
console
.
log
(
`Deposit success -
${
messageReceipt
.
transactionReceipt
.
transactionHash
}
`
)
console
.
log
(
'
Starting withdrawal
'
)
const
preBalance
=
await
WETH9
.
balanceOf
(
signer
.
address
)
...
...
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