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
88998fda
Commit
88998fda
authored
Jun 23, 2023
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
contracts-bedrock: delete dead tasks
parent
2bea306a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
0 additions
and
421 deletions
+0
-421
accounts.ts
packages/contracts-bedrock/tasks/accounts.ts
+0
-10
forge-verify.ts
packages/contracts-bedrock/tasks/forge-verify.ts
+0
-128
index.ts
packages/contracts-bedrock/tasks/index.ts
+0
-5
rekey.ts
packages/contracts-bedrock/tasks/rekey.ts
+0
-24
update-dynamic-oracle-config.ts
...s/contracts-bedrock/tasks/update-dynamic-oracle-config.ts
+0
-98
watch.ts
packages/contracts-bedrock/tasks/watch.ts
+0
-156
No files found.
packages/contracts-bedrock/tasks/accounts.ts
deleted
100644 → 0
View file @
2bea306a
import
{
task
}
from
'
hardhat/config
'
import
'
@nomiclabs/hardhat-ethers
'
task
(
'
accounts
'
,
'
Prints the list of accounts
'
,
async
(
_
,
hre
)
=>
{
const
accounts
=
await
hre
.
ethers
.
getSigners
()
for
(
const
account
of
accounts
)
{
console
.
log
(
account
.
address
)
}
})
packages/contracts-bedrock/tasks/forge-verify.ts
deleted
100644 → 0
View file @
2bea306a
import
{
spawn
as
spawn
}
from
'
child_process
'
import
{
task
,
types
}
from
'
hardhat/config
'
import
*
as
foundryup
from
'
@foundry-rs/easy-foundryup
'
import
'
hardhat-deploy
'
import
{
ethers
}
from
'
ethers
'
interface
ForgeVerifyArgs
{
chainId
:
string
compilerVersion
:
string
constructorArgs
:
string
optimizerRuns
:
number
contractAddress
:
string
contractName
:
string
etherscanApiKey
:
string
}
const
verifyArgs
=
(
opts
:
ForgeVerifyArgs
):
string
[]
=>
{
const
allArgs
:
string
[]
=
[]
if
(
!
opts
.
chainId
)
{
throw
new
Error
(
`No chain-id provided`
)
}
allArgs
.
push
(
`--chain`
,
opts
.
chainId
)
if
(
opts
.
compilerVersion
)
{
allArgs
.
push
(
'
--compiler-version
'
,
opts
.
compilerVersion
)
}
if
(
opts
.
constructorArgs
)
{
allArgs
.
push
(
'
--constructor-args
'
,
opts
.
constructorArgs
)
}
if
(
typeof
opts
.
optimizerRuns
===
'
number
'
)
{
allArgs
.
push
(
'
--num-of-optimizations
'
,
opts
.
optimizerRuns
.
toString
())
}
allArgs
.
push
(
'
--watch
'
)
if
(
!
opts
.
contractAddress
)
{
throw
new
Error
(
'
No contract address provided
'
)
}
allArgs
.
push
(
opts
.
contractAddress
)
if
(
!
opts
.
contractName
)
{
throw
new
Error
(
'
No contract name provided
'
)
}
allArgs
.
push
(
opts
.
contractName
)
if
(
!
opts
.
etherscanApiKey
)
{
throw
new
Error
(
'
No Etherscan API key provided
'
)
}
allArgs
.
push
(
opts
.
etherscanApiKey
)
return
allArgs
}
const
spawnVerify
=
async
(
opts
:
ForgeVerifyArgs
):
Promise
<
boolean
>
=>
{
const
args
=
[
'
verify-contract
'
,
...
verifyArgs
(
opts
)]
const
forgeCmd
=
await
foundryup
.
getForgeCommand
()
return
new
Promise
((
resolve
)
=>
{
const
process
=
spawn
(
forgeCmd
,
args
,
{
stdio
:
'
inherit
'
,
})
process
.
on
(
'
exit
'
,
(
code
)
=>
{
resolve
(
code
===
0
)
})
})
}
task
(
'
forge-contract-verify
'
,
'
Verify contracts using forge
'
)
.
addOptionalParam
(
'
contract
'
,
'
Name of the contract to verify
'
,
''
,
types
.
string
)
.
addOptionalParam
(
'
etherscanApiKey
'
,
'
Etherscan API key
'
,
process
.
env
.
ETHERSCAN_API_KEY
,
types
.
string
)
.
setAction
(
async
(
args
,
hre
)
=>
{
const
deployments
=
await
hre
.
deployments
.
all
()
if
(
args
.
contract
!==
''
)
{
if
(
!
deployments
[
args
.
contract
])
{
throw
new
Error
(
`Contract
${
args
.
contract
}
not found in
${
hre
.
network
}
deployments`
)
}
}
for
(
const
[
contract
,
deployment
]
of
Object
.
entries
(
deployments
))
{
if
(
args
.
contract
!==
''
&&
args
.
contract
!==
contract
)
{
continue
}
const
chainId
=
await
hre
.
getChainId
()
const
contractAddress
=
deployment
.
address
const
etherscanApiKey
=
args
.
etherscanApiKey
let
metadata
=
deployment
.
metadata
as
any
// Handle double nested JSON stringify
while
(
typeof
metadata
===
'
string
'
)
{
metadata
=
JSON
.
parse
(
metadata
)
as
any
}
const
contractName
=
Object
.
values
(
metadata
.
settings
.
compilationTarget
)[
0
].
toString
()
const
compilerVersion
=
metadata
.
compiler
.
version
const
iface
=
new
ethers
.
utils
.
Interface
(
deployment
.
abi
)
const
constructorArgs
=
iface
.
encodeDeploy
(
deployment
.
args
)
const
optimizerRuns
=
metadata
.
settings
.
optimizer
const
success
=
await
spawnVerify
({
chainId
,
compilerVersion
,
constructorArgs
,
optimizerRuns
,
contractAddress
,
contractName
,
etherscanApiKey
,
})
if
(
success
)
{
console
.
log
(
`Contract verification successful for
${
contractName
}
`
)
}
else
{
console
.
log
(
`Contract verification unsuccesful for
${
contractName
}
`
)
}
}
})
packages/contracts-bedrock/tasks/index.ts
View file @
88998fda
import
'
./deposits
'
import
'
./rekey
'
import
'
./check-op-node
'
import
'
./watch
'
import
'
./forge-verify
'
import
'
./validate-spacers
'
import
'
./solidity
'
import
'
./accounts
'
import
'
./check-l2
'
import
'
./update-dynamic-oracle-config
'
import
'
./generate-deploy-config
'
packages/contracts-bedrock/tasks/rekey.ts
deleted
100644 → 0
View file @
2bea306a
import
{
task
}
from
'
hardhat/config
'
import
{
hdkey
}
from
'
ethereumjs-wallet
'
import
*
as
bip39
from
'
bip39
'
task
(
'
rekey
'
,
'
Generates a new set of keys for a test network
'
).
setAction
(
async
()
=>
{
const
mnemonic
=
bip39
.
generateMnemonic
()
const
pathPrefix
=
"
m/44'/60'/0'/0
"
const
labels
=
[
'
Admin
'
,
'
Proposer
'
,
'
Batcher
'
,
'
Sequencer
'
]
const
hdwallet
=
hdkey
.
fromMasterSeed
(
await
bip39
.
mnemonicToSeed
(
mnemonic
))
console
.
log
(
`Mnemonic:
${
mnemonic
}
`
)
for
(
let
i
=
0
;
i
<
labels
.
length
;
i
++
)
{
const
label
=
labels
[
i
]
const
wallet
=
hdwallet
.
derivePath
(
`
${
pathPrefix
}
/
${
i
}
`
).
getWallet
()
const
addr
=
'
0x
'
+
wallet
.
getAddress
().
toString
(
'
hex
'
)
const
pk
=
wallet
.
getPrivateKey
().
toString
(
'
hex
'
)
console
.
log
()
console
.
log
(
`
${
label
}
:
${
addr
}
`
)
console
.
log
(
`Private Key:
${
pk
}
`
)
}
}
)
packages/contracts-bedrock/tasks/update-dynamic-oracle-config.ts
deleted
100644 → 0
View file @
2bea306a
import
readline
from
'
readline
'
import
{
task
,
types
}
from
'
hardhat/config
'
import
{
ethers
,
Wallet
}
from
'
ethers
'
import
{
getContractsFromArtifacts
}
from
'
../src/deploy-utils
'
task
(
'
update-dynamic-oracle-config
'
,
'
Updates the dynamic oracle config.
'
)
.
addParam
(
'
l2OutputOracleStartingTimestamp
'
,
'
Starting timestamp for the L2 output oracle.
'
,
null
,
types
.
int
)
.
addParam
(
'
noSend
'
,
'
Do not send the transaction.
'
,
true
,
types
.
boolean
)
.
addOptionalParam
(
'
privateKey
'
,
'
Private key to send transaction
'
,
process
.
env
.
PRIVATE_KEY
,
types
.
string
)
.
setAction
(
async
(
args
,
hre
)
=>
{
const
{
l2OutputOracleStartingTimestamp
,
noSend
,
privateKey
}
=
args
const
wallet
=
new
Wallet
(
privateKey
,
hre
.
ethers
.
provider
)
const
[
SystemDictator
]
=
await
getContractsFromArtifacts
(
hre
,
[
{
name
:
'
SystemDictatorProxy
'
,
iface
:
'
SystemDictator
'
,
signerOrProvider
:
wallet
,
},
])
const
currStep
=
await
SystemDictator
.
currentStep
()
if
(
currStep
!==
5
)
{
throw
new
Error
(
`Current step is
${
currStep
}
, expected 5`
)
}
if
(
await
SystemDictator
.
dynamicConfigSet
())
{
throw
new
Error
(
'
Dynamic config already set
'
)
}
const
l2OutputOracleStartingBlockNumber
=
hre
.
deployConfig
.
l2OutputOracleStartingBlockNumber
console
.
log
(
`This task will set the L2 output oracle's starting timestamp and block number.`
)
console
.
log
(
`It can only be run once. Please carefully check the values below:`
)
console
.
log
(
`L2OO starting block number:
${
l2OutputOracleStartingBlockNumber
}
`
)
console
.
log
(
`L2OO starting block timestamp:
${
l2OutputOracleStartingTimestamp
}
`
)
await
prompt
(
'
Press enter to continue...
'
)
if
(
noSend
)
{
const
tx
=
await
SystemDictator
.
populateTransaction
.
updateL2OutputOracleDynamicConfig
(
{
l2OutputOracleStartingBlockNumber
,
l2OutputOracleStartingTimestamp
,
}
)
console
.
log
(
`Sending is disabled. Transaction data:`
)
// Need to delete tx.from for Ethers to properly serialize the tx
delete
tx
.
from
console
.
log
(
ethers
.
utils
.
serializeTransaction
(
tx
))
console
.
log
(
`Calldata (for multisigs):`
)
console
.
log
(
tx
.
data
)
}
else
{
console
.
log
(
`Sending transaction...`
)
const
tx
=
await
SystemDictator
.
updateL2OutputOracleDynamicConfig
({
l2OutputOracleStartingBlockNumber
,
l2OutputOracleStartingTimestamp
,
})
console
.
log
(
`Transaction sent with hash
${
tx
.
hash
}
. Waiting for receipt...`
)
const
receipt
=
await
tx
.
wait
(
1
)
console
.
log
(
`Transaction included in block
${
receipt
.
blockNumber
}
`
)
}
})
const
prompt
=
async
(
question
:
string
)
=>
{
const
rl
=
readline
.
createInterface
({
input
:
process
.
stdin
,
output
:
process
.
stdout
,
})
return
new
Promise
<
void
>
((
resolve
)
=>
{
rl
.
question
(
question
,
()
=>
{
rl
.
close
()
resolve
()
})
})
}
packages/contracts-bedrock/tasks/watch.ts
deleted
100644 → 0
View file @
2bea306a
import
{
task
,
types
}
from
'
hardhat/config
'
import
'
@nomiclabs/hardhat-ethers
'
import
'
hardhat-deploy
'
import
{
OpNodeProvider
,
sleep
}
from
'
@eth-optimism/core-utils
'
import
{
predeploys
}
from
'
../src
'
task
(
'
watch
'
,
'
Watch an Optimism System
'
)
.
addParam
(
'
l1ProviderUrl
'
,
'
L1 provider URL.
'
,
'
http://localhost:8545
'
,
types
.
string
)
.
addParam
(
'
l2ProviderUrl
'
,
'
L2 provider URL.
'
,
'
http://localhost:9545
'
,
types
.
string
)
.
addParam
(
'
opNodeProviderUrl
'
,
'
op-node provider URL
'
,
'
http://localhost:7545
'
,
types
.
string
)
.
setAction
(
async
(
args
,
hre
)
=>
{
const
{
utils
}
=
hre
.
ethers
const
l1Provider
=
new
hre
.
ethers
.
providers
.
StaticJsonRpcProvider
(
args
.
l1Provider
)
const
l2Provider
=
new
hre
.
ethers
.
providers
.
StaticJsonRpcProvider
(
args
.
l2ProviderUrl
)
const
contracts
=
{}
const
deployments
=
await
hre
.
deployments
.
all
()
for
(
const
[
contract
,
deployment
]
of
Object
.
entries
(
deployments
))
{
contracts
[
contract
]
=
deployment
.
address
}
console
.
log
(
'
Deployed Contracts
'
)
console
.
table
(
contracts
)
const
opNodeProvider
=
new
OpNodeProvider
(
args
.
opNodeProviderUrl
)
const
opNodeConfig
=
await
opNodeProvider
.
rollupConfig
()
console
.
log
(
'
op-node config
'
)
console
.
table
({
'
layer-one-hash
'
:
opNodeConfig
.
genesis
.
l1
.
hash
,
'
layer-one-number
'
:
opNodeConfig
.
genesis
.
l1
.
number
,
'
layer-two-hash
'
:
opNodeConfig
.
genesis
.
l2
.
hash
,
'
layer-two-number
'
:
opNodeConfig
.
genesis
.
l2
.
number
,
'
layer-two-time
'
:
opNodeConfig
.
genesis
.
l2_time
,
'
block-time
'
:
opNodeConfig
.
block_time
,
'
max-sequencer-drift
'
:
opNodeConfig
.
max_sequencer_drift
,
'
seq-window-size
'
:
opNodeConfig
.
seq_window_size
,
'
channel-timeout
'
:
opNodeConfig
.
channel_timeout
,
'
l1-chain-id
'
:
opNodeConfig
.
l1_chain_id
,
'
l2-chain-id
'
:
opNodeConfig
.
l2_chain_id
,
'
p2p-sequencer-address
'
:
opNodeConfig
.
p2p_sequencer_address
,
'
fee-recipient-address
'
:
opNodeConfig
.
fee_recipient_address
,
'
batch-inbox-address
'
:
opNodeConfig
.
batch_inbox_address
,
'
batch-sender-address
'
:
opNodeConfig
.
batch_sender_address
,
'
deposit-contract-address
'
:
opNodeConfig
.
deposit_contract_address
,
})
const
Deployment__L2OutputOracle
=
await
hre
.
deployments
.
get
(
'
L2OutputOracle
'
)
const
Deployment__L2OutputOracleProxy
=
await
hre
.
deployments
.
get
(
'
L2OutputOracleProxy
'
)
const
L2OutputOracle
=
new
hre
.
ethers
.
Contract
(
Deployment__L2OutputOracleProxy
.
address
,
Deployment__L2OutputOracle
.
abi
,
l1Provider
)
const
proposer
=
await
L2OutputOracle
.
proposer
()
console
.
log
(
`L2OutputOracle proposer
${
proposer
}
`
)
console
.
log
()
setInterval
(
async
()
=>
{
const
latestBlockNumber
=
await
L2OutputOracle
.
latestBlockNumber
()
console
.
log
(
`L2OutputOracle latest block number:
${
latestBlockNumber
.
toString
()}
`
)
console
.
log
()
},
10000
)
l1Provider
.
on
(
'
block
'
,
async
(
num
)
=>
{
const
block
=
await
l1Provider
.
getBlockWithTransactions
(
num
)
for
(
const
txn
of
block
.
transactions
)
{
const
to
=
utils
.
getAddress
(
txn
.
to
||
hre
.
ethers
.
constants
.
AddressZero
)
const
from
=
utils
.
getAddress
(
txn
.
from
)
const
isBatchSender
=
utils
.
getAddress
(
txn
.
from
)
===
utils
.
getAddress
(
opNodeConfig
.
batch_sender_address
)
const
isBatchInbox
=
to
===
utils
.
getAddress
(
opNodeConfig
.
batch_inbox_address
)
const
isOutputOracle
=
to
===
utils
.
getAddress
(
L2OutputOracle
.
address
)
&&
from
===
utils
.
getAddress
(
proposer
)
if
(
isBatchSender
&&
isBatchInbox
)
{
console
.
log
(
'
Batch submitted:
'
)
console
.
log
(
` tx hash:
${
txn
.
hash
}
`
)
console
.
log
(
` tx data:
${
txn
.
data
}
`
)
console
.
log
()
}
if
(
isOutputOracle
)
{
console
.
log
(
'
L2 Output Submitted:
'
)
const
data
=
L2OutputOracle
.
interface
.
parseTransaction
(
txn
)
console
.
log
(
` tx hash:
${
txn
.
hash
}
`
)
console
.
log
(
` output root:
${
data
.
args
.
_outputRoot
}
`
)
console
.
log
(
` l2 blocknum:
${
data
.
args
.
_l2BlockNumber
}
`
)
console
.
log
(
` l1 blockhash:
${
data
.
args
.
_l1Blockhash
}
`
)
console
.
log
(
` l1 blocknum:
${
data
.
args
.
_l1BlockNumber
}
`
)
console
.
log
()
}
}
})
const
L1Block
=
await
hre
.
ethers
.
getContractAt
(
'
L1Block
'
,
predeploys
.
L1Block
)
l2Provider
.
on
(
'
block
'
,
async
(
num
)
=>
{
const
block
=
await
l2Provider
.
getBlockWithTransactions
(
num
)
for
(
const
txn
of
block
.
transactions
)
{
const
to
=
utils
.
getAddress
(
txn
.
to
||
hre
.
ethers
.
constants
.
AddressZero
)
if
(
to
===
utils
.
getAddress
(
predeploys
.
L1Block
))
{
const
data
=
L1Block
.
interface
.
parseTransaction
(
txn
)
console
.
log
(
'
L1Block values updated
'
)
console
.
log
(
` tx hash:
${
txn
.
hash
}
`
)
console
.
log
(
` number:
${
data
.
args
.
_number
}
`
)
console
.
log
(
` timestamp:
${
data
.
args
.
_timestamp
}
`
)
console
.
log
(
` basefee:
${
data
.
args
.
_basefee
}
`
)
console
.
log
(
` hash:
${
data
.
args
.
_hash
}
`
)
console
.
log
(
` sequenceNumber:
${
data
.
args
.
_sequenceNumber
}
`
)
console
.
log
()
}
}
})
setInterval
(
async
()
=>
{
await
sleep
(
100000
)
})
await
sleep
(
100000
)
})
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