Skip to content

Commit 5818dec

Browse files
tynesmergify[bot]
andauthored
contracts: gas oracle script (#2425)
Create a simple script that can set the config for the `OVM_GasPriceOracle` using `cast`. Using the `hardhat` task requires 4gb+ of memory when running. Also remove the `set-l2-gasprice` hardhat task that does the same functionality Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 83ce16a commit 5818dec

4 files changed

Lines changed: 49 additions & 104 deletions

File tree

.changeset/smart-foxes-shop.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@eth-optimism/contracts': patch
3+
---
4+
5+
Remove l2 gas price hardhat task
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
RPC_URL=${RPC_URL:-http://localhost:8545}
6+
OVM_GAS_ORACLE=0x420000000000000000000000000000000000000F
7+
8+
function send_tx() {
9+
cast send --rpc-url $RPC_URL \
10+
--private-key $PRIVATE_KEY \
11+
--legacy \
12+
--gas-price 0 \
13+
$OVM_GAS_ORACLE \
14+
$1 \
15+
$2
16+
}
17+
18+
function call() {
19+
cast call --rpc-url $RPC_URL \
20+
$OVM_GAS_ORACLE \
21+
$1
22+
}
23+
24+
echo "Scalar: $(call 'scalar()(uint256)')"
25+
echo "L2 gas price: $(call 'gasPrice()(uint256)')"
26+
echo "Overhead: $(call 'overhead()(uint256)')"
27+
28+
if [[ ! -z $PRIVATE_KEY ]]; then
29+
if [[ ! -z $SCALAR ]]; then
30+
echo "Setting scalar to $SCALAR"
31+
send_tx 'setScalar(uint256)' $SCALAR
32+
fi
33+
34+
if [[ ! -z $OVERHEAD ]]; then
35+
echo "Setting overhead to $OVERHEAD"
36+
send_tx 'setOverhead(uint256)' $OVERHEAD
37+
fi
38+
39+
if [[ ! -z $L2_GAS_PRICE ]]; then
40+
echo "Setting L2 gas price to $L2_GAS_PRICE"
41+
send_tx 'setGasPrice(uint256)' $L2_GAS_PRICE
42+
fi
43+
fi
44+

packages/contracts/tasks/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export * from './l2-gasprice'
21
export * from './set-owner'
32
export * from './take-dump'
43
export * from './validate-address-dictator'

packages/contracts/tasks/l2-gasprice.ts

Lines changed: 0 additions & 103 deletions
This file was deleted.

0 commit comments

Comments
 (0)