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
5d0d7ec6
Unverified
Commit
5d0d7ec6
authored
Dec 03, 2021
by
Kelvin Fichter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update whitelist task for multiple addresses
parent
b9ee2d7f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
9 deletions
+49
-9
whitelist.ts
packages/contracts/tasks/whitelist.ts
+49
-9
No files found.
packages/contracts/tasks/whitelist.ts
View file @
5d0d7ec6
'
use strict
'
'
use strict
'
import
fs
from
'
fs
'
import
{
ethers
}
from
'
ethers
'
import
{
ethers
}
from
'
ethers
'
import
{
task
}
from
'
hardhat/config
'
import
{
task
}
from
'
hardhat/config
'
import
*
as
types
from
'
hardhat/internal/core/params/argumentTypes
'
import
*
as
types
from
'
hardhat/internal/core/params/argumentTypes
'
...
@@ -10,7 +11,19 @@ import { predeploys } from '../src/predeploys'
...
@@ -10,7 +11,19 @@ import { predeploys } from '../src/predeploys'
// Add accounts the the OVM_DeployerWhitelist
// Add accounts the the OVM_DeployerWhitelist
// npx hardhat whitelist --address 0x..
// npx hardhat whitelist --address 0x..
task
(
'
whitelist
'
)
task
(
'
whitelist
'
)
.
addParam
(
'
address
'
,
'
Address to whitelist
'
,
undefined
,
types
.
string
)
.
addOptionalParam
(
'
address
'
,
'
Address to whitelist
'
,
undefined
,
types
.
string
)
.
addOptionalParam
(
'
addressFile
'
,
'
File containing addresses to whitelist separated by a newline
'
,
undefined
,
types
.
string
)
.
addOptionalParam
(
'
whitelistMode
'
,
'
"enable" if you want to add the address(es) from the whitelist, "disable" if you want remove the address(es) from the whitelist
'
,
'
enable
'
,
types
.
string
)
.
addOptionalParam
(
'
transactionGasPrice
'
,
'
tx.gasPrice
'
,
undefined
,
types
.
int
)
.
addOptionalParam
(
'
transactionGasPrice
'
,
'
tx.gasPrice
'
,
undefined
,
types
.
int
)
.
addOptionalParam
(
.
addOptionalParam
(
'
useLedger
'
,
'
useLedger
'
,
...
@@ -38,11 +51,23 @@ task('whitelist')
...
@@ -38,11 +51,23 @@ task('whitelist')
)
)
.
addOptionalParam
(
.
addOptionalParam
(
'
contractAddress
'
,
'
contractAddress
'
,
'
Address of
Ownable
contract
'
,
'
Address of
DeployerWhitelist
contract
'
,
predeploys
.
OVM_DeployerWhitelist
,
predeploys
.
OVM_DeployerWhitelist
,
types
.
string
types
.
string
)
)
.
setAction
(
async
(
args
)
=>
{
.
setAction
(
async
(
args
)
=>
{
if
(
args
.
whitelistMode
!==
'
enable
'
&&
args
.
whitelistMode
!==
'
disable
'
)
{
throw
new
Error
(
`Whitelist mode must be either "enable" or "disable"`
)
}
if
(
args
.
address
===
undefined
&&
args
.
addressPath
===
undefined
)
{
throw
new
Error
(
`Must provide either address or address-path`
)
}
if
(
args
.
address
!==
undefined
&&
args
.
addressPath
!==
undefined
)
{
throw
new
Error
(
`Cannot provide both address and address-path`
)
}
const
provider
=
new
ethers
.
providers
.
JsonRpcProvider
(
args
.
contractsRpcUrl
)
const
provider
=
new
ethers
.
providers
.
JsonRpcProvider
(
args
.
contractsRpcUrl
)
let
signer
:
ethers
.
Signer
let
signer
:
ethers
.
Signer
if
(
!
args
.
useLedger
)
{
if
(
!
args
.
useLedger
)
{
...
@@ -72,11 +97,26 @@ task('whitelist')
...
@@ -72,11 +97,26 @@ task('whitelist')
throw
new
Error
(
`Incorrect key. Owner
${
owner
}
, Signer
${
addr
}
`
)
throw
new
Error
(
`Incorrect key. Owner
${
owner
}
, Signer
${
addr
}
`
)
}
}
const
res
=
await
deployerWhitelist
.
setWhitelistedDeployer
(
const
addresses
=
[]
args
.
address
,
if
(
args
.
address
!==
undefined
)
{
true
,
addresses
.
push
(
args
.
address
)
{
gasPrice
:
args
.
transactionGasPrice
}
}
else
{
)
const
addressFile
=
fs
.
readFileSync
(
args
.
addressPath
,
'
utf8
'
)
await
res
.
wait
()
for
(
const
line
of
addressFile
.
split
(
'
\n
'
))
{
console
.
log
(
`Whitelisted
${
args
.
address
}
`
)
if
(
line
!==
''
)
{
addresses
.
push
(
line
)
}
}
}
for
(
const
address
of
addresses
)
{
console
.
log
(
`Changing whitelist status for address:
${
address
}
`
)
console
.
log
(
`New whitelist status:
${
args
.
whitelistMode
}
`
)
const
res
=
await
deployerWhitelist
.
setWhitelistedDeployer
(
address
,
args
.
whitelistMode
===
'
enable
'
?
true
:
false
,
{
gasPrice
:
args
.
transactionGasPrice
}
)
await
res
.
wait
()
}
})
})
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