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
b1683505
Unverified
Commit
b1683505
authored
Jun 16, 2023
by
OptimismBot
Committed by
GitHub
Jun 16, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6045 from ethereum-optimism/block-is-hotz
fix(sdk): mul gas by 1.5
parents
994a7da1
caf00b7f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
8 deletions
+65
-8
tasty-seahorses-add.md
.changeset/tasty-seahorses-add.md
+5
-0
cross-chain-messenger.ts
packages/sdk/src/cross-chain-messenger.ts
+60
-8
No files found.
.changeset/tasty-seahorses-add.md
0 → 100644
View file @
b1683505
---
'
@eth-optimism/contracts-bedrock'
:
minor
---
Fix issue with deposits running out of gas
packages/sdk/src/cross-chain-messenger.ts
View file @
b1683505
...
@@ -1611,7 +1611,7 @@ export class CrossChainMessenger {
...
@@ -1611,7 +1611,7 @@ export class CrossChainMessenger {
recipient
?:
AddressLike
recipient
?:
AddressLike
signer
?:
Signer
signer
?:
Signer
l2GasLimit
?:
NumberLike
l2GasLimit
?:
NumberLike
overrides
?:
Overrides
overrides
?:
Call
Overrides
}
}
):
Promise
<
TransactionResponse
>
{
):
Promise
<
TransactionResponse
>
{
return
(
opts
?.
signer
||
this
.
l1Signer
).
sendTransaction
(
return
(
opts
?.
signer
||
this
.
l1Signer
).
sendTransaction
(
...
@@ -1868,13 +1868,27 @@ export class CrossChainMessenger {
...
@@ -1868,13 +1868,27 @@ export class CrossChainMessenger {
recipient
?:
AddressLike
recipient
?:
AddressLike
l2GasLimit
?:
NumberLike
l2GasLimit
?:
NumberLike
overrides
?:
PayableOverrides
overrides
?:
PayableOverrides
}
},
isEstimatingGas
:
boolean
=
false
):
Promise
<
TransactionRequest
>
=>
{
):
Promise
<
TransactionRequest
>
=>
{
const
getOpts
=
async
()
=>
{
if
(
isEstimatingGas
)
{
return
opts
}
const
gasEstimation
=
await
this
.
estimateGas
.
depositETH
(
amount
,
opts
)
return
{
...
opts
,
overrides
:
{
...
opts
?.
overrides
,
gasLimit
:
gasEstimation
.
add
(
gasEstimation
.
div
(
2
)),
},
}
}
return
this
.
bridges
.
ETH
.
populateTransaction
.
deposit
(
return
this
.
bridges
.
ETH
.
populateTransaction
.
deposit
(
ethers
.
constants
.
AddressZero
,
ethers
.
constants
.
AddressZero
,
predeploys
.
OVM_ETH
,
predeploys
.
OVM_ETH
,
amount
,
amount
,
opts
await
getOpts
()
)
)
},
},
...
@@ -1943,11 +1957,48 @@ export class CrossChainMessenger {
...
@@ -1943,11 +1957,48 @@ export class CrossChainMessenger {
opts
?:
{
opts
?:
{
recipient
?:
AddressLike
recipient
?:
AddressLike
l2GasLimit
?:
NumberLike
l2GasLimit
?:
NumberLike
overrides
?:
Overrides
overrides
?:
CallOverrides
}
},
isEstimatingGas
:
boolean
=
false
):
Promise
<
TransactionRequest
>
=>
{
):
Promise
<
TransactionRequest
>
=>
{
const
bridge
=
await
this
.
getBridgeForTokenPair
(
l1Token
,
l2Token
)
const
bridge
=
await
this
.
getBridgeForTokenPair
(
l1Token
,
l2Token
)
return
bridge
.
populateTransaction
.
deposit
(
l1Token
,
l2Token
,
amount
,
opts
)
// we need extra buffer for gas limit
const
getOpts
=
async
()
=>
{
if
(
isEstimatingGas
)
{
return
opts
}
// if we don't include the users address the estimation will fail from lack of allowance
if
(
!
ethers
.
Signer
.
isSigner
(
this
.
l1SignerOrProvider
))
{
throw
new
Error
(
'
unable to deposit without an l1 signer
'
)
}
const
from
=
(
this
.
l1SignerOrProvider
as
Signer
).
getAddress
()
const
gasEstimation
=
await
this
.
estimateGas
.
depositERC20
(
l1Token
,
l2Token
,
amount
,
{
...
opts
,
overrides
:
{
...
opts
?.
overrides
,
from
:
opts
?.
overrides
?.
from
??
from
,
},
}
)
return
{
...
opts
,
overrides
:
{
...
opts
?.
overrides
,
gasLimit
:
gasEstimation
.
add
(
gasEstimation
.
div
(
2
)),
from
:
opts
?.
overrides
?.
from
??
from
,
},
}
}
return
bridge
.
populateTransaction
.
deposit
(
l1Token
,
l2Token
,
amount
,
await
getOpts
()
)
},
},
/**
/**
...
@@ -2086,7 +2137,7 @@ export class CrossChainMessenger {
...
@@ -2086,7 +2137,7 @@ export class CrossChainMessenger {
}
}
):
Promise
<
BigNumber
>
=>
{
):
Promise
<
BigNumber
>
=>
{
return
this
.
l1Provider
.
estimateGas
(
return
this
.
l1Provider
.
estimateGas
(
await
this
.
populateTransaction
.
depositETH
(
amount
,
opts
)
await
this
.
populateTransaction
.
depositETH
(
amount
,
opts
,
true
)
)
)
},
},
...
@@ -2166,7 +2217,8 @@ export class CrossChainMessenger {
...
@@ -2166,7 +2217,8 @@ export class CrossChainMessenger {
l1Token
,
l1Token
,
l2Token
,
l2Token
,
amount
,
amount
,
opts
opts
,
true
)
)
)
)
},
},
...
...
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