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
9195dcf2
Unverified
Commit
9195dcf2
authored
Jan 07, 2022
by
Mark Tyneway
Committed by
GitHub
Jan 07, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1992 from ethereum-optimism/feat/hh-gas-oracle
feat(contracts): add in better gas oracle management
parents
9246754a
279603e5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
9 deletions
+61
-9
shaggy-brooms-shave.md
.changeset/shaggy-brooms-shave.md
+5
-0
l2-gasprice.ts
packages/contracts/tasks/l2-gasprice.ts
+56
-9
No files found.
.changeset/shaggy-brooms-shave.md
0 → 100644
View file @
9195dcf2
---
'
@eth-optimism/contracts'
:
patch
---
Update hardhat task for managing the gas oracle
packages/contracts/tasks/l2-gasprice.ts
View file @
9195dcf2
...
@@ -7,8 +7,25 @@ import { predeploys } from '../src/predeploys'
...
@@ -7,8 +7,25 @@ import { predeploys } from '../src/predeploys'
import
{
getContractDefinition
}
from
'
../src/contract-defs
'
import
{
getContractDefinition
}
from
'
../src/contract-defs
'
task
(
'
set-l2-gasprice
'
)
task
(
'
set-l2-gasprice
'
)
.
addOptionalParam
(
'
l2GasPrice
'
,
'
Gas Price to set on L2
'
,
0
,
types
.
int
)
.
addOptionalParam
(
'
l2GasPrice
'
,
'
Gas Price to set on L2
'
,
undefined
,
types
.
int
)
.
addOptionalParam
(
'
transactionGasPrice
'
,
'
tx.gasPrice
'
,
undefined
,
types
.
int
)
.
addOptionalParam
(
'
transactionGasPrice
'
,
'
tx.gasPrice
'
,
undefined
,
types
.
int
)
.
addOptionalParam
(
'
overhead
'
,
'
amortized additional gas used by each batch that users must pay for
'
,
undefined
,
types
.
int
)
.
addOptionalParam
(
'
scalar
'
,
'
amount to scale up the gas to charge
'
,
undefined
,
types
.
int
)
.
addOptionalParam
(
.
addOptionalParam
(
'
contractsRpcUrl
'
,
'
contractsRpcUrl
'
,
'
Sequencer HTTP Endpoint
'
,
'
Sequencer HTTP Endpoint
'
,
...
@@ -42,10 +59,18 @@ task('set-l2-gasprice')
...
@@ -42,10 +59,18 @@ task('set-l2-gasprice')
throw
new
Error
(
`Incorrect key. Owner
${
owner
}
, Signer
${
addr
}
`
)
throw
new
Error
(
`Incorrect key. Owner
${
owner
}
, Signer
${
addr
}
`
)
}
}
// List the current values
const
gasPrice
=
await
GasPriceOracle
.
callStatic
.
gasPrice
()
const
gasPrice
=
await
GasPriceOracle
.
callStatic
.
gasPrice
()
cons
ole
.
log
(
`Gas Price is currently
${
gasPrice
.
toString
()}
`
)
cons
t
scalar
=
await
GasPriceOracle
.
callStatic
.
scalar
(
)
cons
ole
.
log
(
`Setting Gas Price to
${
args
.
l2GasPrice
}
`
)
cons
t
overhead
=
await
GasPriceOracle
.
callStatic
.
overhead
(
)
console
.
log
(
'
Current values:
'
)
console
.
log
(
`Gas Price:
${
gasPrice
.
toString
()}
`
)
console
.
log
(
`Scalar:
${
scalar
.
toString
()}
`
)
console
.
log
(
`Overhead:
${
overhead
.
toString
()}
`
)
if
(
args
.
l2GasPrice
!==
undefined
)
{
console
.
log
(
`Setting gas price to
${
args
.
l2GasPrice
}
`
)
const
tx
=
await
GasPriceOracle
.
connect
(
signer
).
setGasPrice
(
const
tx
=
await
GasPriceOracle
.
connect
(
signer
).
setGasPrice
(
args
.
l2GasPrice
,
args
.
l2GasPrice
,
{
gasPrice
:
args
.
transactionGasPrice
}
{
gasPrice
:
args
.
transactionGasPrice
}
...
@@ -53,4 +78,26 @@ task('set-l2-gasprice')
...
@@ -53,4 +78,26 @@ task('set-l2-gasprice')
const
receipt
=
await
tx
.
wait
()
const
receipt
=
await
tx
.
wait
()
console
.
log
(
`Success -
${
receipt
.
transactionHash
}
`
)
console
.
log
(
`Success -
${
receipt
.
transactionHash
}
`
)
}
if
(
args
.
scalar
!==
undefined
)
{
console
.
log
(
`Setting scalar to
${
args
.
scalar
}
`
)
const
tx
=
await
GasPriceOracle
.
connect
(
signer
).
setScalar
(
args
.
scalar
,
{
gasPrice
:
args
.
transactionGasPrice
,
})
const
receipt
=
await
tx
.
wait
()
console
.
log
(
`Success -
${
receipt
.
transactionHash
}
`
)
}
if
(
args
.
overhead
!==
undefined
)
{
console
.
log
(
`Setting overhead to
${
args
.
overhead
}
`
)
const
tx
=
await
GasPriceOracle
.
connect
(
signer
).
setOverhead
(
args
.
overhead
,
{
gasPrice
:
args
.
transactionGasPrice
}
)
const
receipt
=
await
tx
.
wait
()
console
.
log
(
`Success -
${
receipt
.
transactionHash
}
`
)
}
})
})
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