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
0bb89f9b
Commit
0bb89f9b
authored
Nov 05, 2020
by
Mark Tyneway
Committed by
GitHub
Nov 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
deployer: ledger support, no sequencer private key (#50)
parent
08455c2b
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
488 additions
and
24 deletions
+488
-24
deploy.js
packages/contracts/bin/deploy.js
+25
-10
package.json
packages/contracts/package.json
+1
-0
yarn.lock
packages/contracts/yarn.lock
+462
-14
No files found.
packages/contracts/bin/deploy.js
View file @
0bb89f9b
#!/usr/bin/env node
const
contracts
=
require
(
'
../build/src/contract-deployment/deploy
'
);
const
{
providers
,
Wallet
}
=
require
(
'
ethers
'
);
const
{
providers
,
Wallet
,
utils
}
=
require
(
'
ethers
'
);
const
{
LedgerSigner
}
=
require
(
'
@ethersproject/hardware-wallets
'
);
const
{
JsonRpcProvider
}
=
providers
;
const
env
=
process
.
env
;
const
key
=
env
.
DEPLOYER_PRIVATE_KEY
;
const
sequencerKey
=
env
.
SEQUENCER_PRIVATE_KEY
;
let
SEQUENCER_ADDRESS
=
env
.
SEQUENCER_ADDRESS
;
const
web3Url
=
env
.
L1_NODE_WEB3_URL
||
'
http://127.0.0.1:8545
'
;
const
MIN_TRANSACTION_GAS_LIMIT
=
env
.
MIN_TRANSACTION_GAS_LIMIT
||
0
;
const
MAX_TRANSACTION_GAS_LIMIT
=
env
.
MAX_TRANSACTION_GAS_LIMIT
||
1000000000
;
...
...
@@ -16,17 +18,30 @@ let WHITELIST_OWNER = env.WHITELIST_OWNER;
const
WHITELIST_ALLOW_ARBITRARY_CONTRACT_DEPLOYMENT
=
env
.
WHITELIST_ALLOW_ARBITRARY_CONTRACT_DEPLOYMENT
||
true
;
const
FORCE_INCLUSION_PERIOD_SECONDS
=
env
.
FORCE_INCLUSION_PERIOD_SECONDS
||
(
30
*
60
);
const
CHAIN_ID
=
env
.
CHAIN_ID
||
420
;
// layer 2 chainid
const
USE_LEDGER
=
env
.
USE_LEDGER
||
false
;
const
HD_PATH
=
env
.
HD_PATH
||
utils
.
defaultPath
;
(
async
()
=>
{
if
(
typeof
key
===
'
undefined
'
)
throw
new
Error
(
'
Must pass deployer key as DEPLOYER_PRIVATE_KEY
'
)
;
const
provider
=
new
JsonRpcProvider
(
web3Url
);
let
signer
;
if
(
typeof
sequencerKey
===
'
undefined
'
)
throw
new
Error
(
'
Must pass sequencer key as SEQUENCER_PRIVATE_KEY
'
);
if
(
USE_LEDGER
)
{
signer
=
new
LedgerSigner
(
provider
,
'
default
'
,
HD_PATH
);
}
else
{
if
(
typeof
key
===
'
undefined
'
)
throw
new
Error
(
'
Must pass deployer key as DEPLOYER_PRIVATE_KEY
'
);
signer
=
new
Wallet
(
key
,
provider
);
}
const
provider
=
new
JsonRpcProvider
(
web3Url
);
const
signer
=
new
Wallet
(
key
,
provider
);
const
sequencer
=
new
Wallet
(
sequencerKey
,
provider
);
if
(
SEQUENCER_ADDRESS
)
{
if
(
!
utils
.
isAddress
(
SEQUENCER_ADDRESS
))
throw
new
Error
(
`Invalid Sequencer Address:
${
SEQUENCER_ADDRESS
}
`
)
}
else
{
if
(
!
sequencerKey
)
throw
new
Error
(
'
Must pass sequencer key as SEQUENCER_PRIVATE_KEY
'
);
const
sequencer
=
new
Wallet
(
sequencerKey
,
provider
);
SEQUENCER_ADDRESS
=
await
sequencer
.
getAddress
()
}
if
(
typeof
WHITELIST_OWNER
===
'
undefined
'
)
WHITELIST_OWNER
=
signer
;
...
...
@@ -35,7 +50,7 @@ const CHAIN_ID = env.CHAIN_ID || 420; // layer 2 chainid
deploymentSigner
:
signer
,
transactionChainConfig
:
{
forceInclusionPeriodSeconds
:
FORCE_INCLUSION_PERIOD_SECONDS
,
sequencer
,
sequencer
:
SEQUENCER_ADDRESS
,
},
ovmGlobalContext
:
{
ovmCHAINID
:
CHAIN_ID
...
...
@@ -58,7 +73,7 @@ const CHAIN_ID = env.CHAIN_ID || 420; // layer 2 chainid
const
out
=
{};
out
.
AddressManager
=
AddressManager
.
address
;
out
.
OVM_Sequencer
=
await
sequencer
.
getAddress
()
out
.
OVM_Sequencer
=
SEQUENCER_ADDRESS
;
out
.
Deployer
=
await
signer
.
getAddress
()
for
(
const
[
name
,
contract
]
of
Object
.
entries
(
result
.
contracts
))
{
out
[
name
]
=
contract
.
address
;
...
...
packages/contracts/package.json
View file @
0bb89f9b
...
...
@@ -27,6 +27,7 @@
"deploy"
:
"./bin/deploy.js"
},
"dependencies"
:
{
"@ethersproject/hardware-wallets"
:
"^5.0.8"
,
"ethers"
:
"5.0.0"
},
"devDependencies"
:
{
...
...
packages/contracts/yarn.lock
View file @
0bb89f9b
This diff is collapsed.
Click to expand it.
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