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
23103d90
Unverified
Commit
23103d90
authored
Jul 13, 2021
by
Mark Tyneway
Committed by
GitHub
Jul 13, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1268 from ethereum-optimism/feat/set-gpo-task
feat: set owner task
parents
cbd4e854
4736eb2e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 additions
and
5 deletions
+85
-5
thirty-eagles-reply.md
.changeset/thirty-eagles-reply.md
+5
-0
hardhat.config.ts
packages/contracts/hardhat.config.ts
+1
-0
package.json
packages/contracts/package.json
+5
-4
set-owner.ts
packages/contracts/tasks/set-owner.ts
+73
-0
yarn.lock
yarn.lock
+1
-1
No files found.
.changeset/thirty-eagles-reply.md
0 → 100644
View file @
23103d90
---
'
@eth-optimism/contracts'
:
patch
---
Add a task for setting the gas price oracle
packages/contracts/hardhat.config.ts
View file @
23103d90
...
...
@@ -15,6 +15,7 @@ import '@typechain/hardhat'
import
'
@eth-optimism/hardhat-ovm
'
import
'
./tasks/deploy
'
import
'
./tasks/l2-gasprice
'
import
'
./tasks/set-owner
'
import
'
hardhat-gas-reporter
'
// Load environment variables from .env
...
...
packages/contracts/package.json
View file @
23103d90
...
...
@@ -53,6 +53,7 @@
"@ethersproject/abstract-provider"
:
"^5.0.8"
,
"@ethersproject/abstract-signer"
:
"^5.1.0"
,
"@ethersproject/contracts"
:
"^5.0.5"
,
"@ethersproject/hardware-wallets"
:
"^5.4.0"
,
"glob"
:
"^7.1.6"
},
"devDependencies"
:
{
...
...
@@ -76,19 +77,19 @@
"@types/yargs"
:
"^16.0.1"
,
"@typescript-eslint/eslint-plugin"
:
"^4.26.0"
,
"@typescript-eslint/parser"
:
"^4.26.0"
,
"babel-eslint"
:
"^10.1.0"
,
"buffer-xor"
:
"^2.0.2"
,
"chai"
:
"^4.3.1"
,
"copyfiles"
:
"^2.3.0"
,
"directory-tree"
:
"^2.2.7"
,
"dotenv"
:
"^8.2.0"
,
"babel-eslint"
:
"^10.1.0"
,
"eslint"
:
"^7.27.0"
,
"eslint-plugin-prettier"
:
"^3.4.0"
,
"eslint-config-prettier"
:
"^8.3.0"
,
"eslint-plugin-ban"
:
"^1.5.2"
,
"eslint-plugin-import"
:
"^2.23.4"
,
"eslint-plugin-jsdoc"
:
"^35.1.2"
,
"eslint-plugin-prefer-arrow"
:
"^1.2.3"
,
"eslint-plugin-prettier"
:
"^3.4.0"
,
"eslint-plugin-react"
:
"^7.24.0"
,
"eslint-plugin-unicorn"
:
"^32.0.1"
,
"ethereum-waffle"
:
"^3.3.0"
,
...
...
@@ -97,21 +98,21 @@
"hardhat"
:
"^2.2.1"
,
"hardhat-deploy"
:
"^0.7.4"
,
"hardhat-gas-reporter"
:
"^1.0.4"
,
"lint-staged"
:
"11.0.0"
,
"lodash"
:
"^4.17.20"
,
"merkle-patricia-tree"
:
"^4.0.0"
,
"merkletreejs"
:
"^0.2.12"
,
"mkdirp"
:
"^1.0.4"
,
"mocha"
:
"^8.3.0"
,
"prettier"
:
"^2.2.1"
,
"lint-staged"
:
"11.0.0"
,
"random-bytes-seed"
:
"^1.0.3"
,
"rlp"
:
"^2.2.6"
,
"solhint"
:
"^3.3.6"
,
"solidity-coverage"
:
"^0.7.16"
,
"ts-generator"
:
"0.0.8"
,
"ts-node"
:
"^9.1.1"
,
"typescript"
:
"^4.2.3"
,
"typechain"
:
"2.0.0"
,
"typescript"
:
"^4.2.3"
,
"yargs"
:
"^16.2.0"
},
"peerDependencies"
:
{
...
...
packages/contracts/tasks/set-owner.ts
0 → 100644
View file @
23103d90
/* Imports: External */
import
{
ethers
}
from
'
ethers
'
import
{
LedgerSigner
}
from
'
@ethersproject/hardware-wallets
'
import
{
task
}
from
'
hardhat/config
'
import
*
as
types
from
'
hardhat/internal/core/params/argumentTypes
'
import
{
predeploys
}
from
'
../src/predeploys
'
import
{
getContractFactory
}
from
'
../src/contract-defs
'
task
(
'
set-owner
'
)
.
addParam
(
'
owner
'
,
'
the new oracle address
'
,
0
,
types
.
string
)
.
addOptionalParam
(
'
transactionGasPrice
'
,
'
tx.gasPrice
'
,
undefined
,
types
.
int
)
.
addOptionalParam
(
'
useLedger
'
,
'
use a ledger for signing
'
,
false
,
types
.
boolean
)
.
addOptionalParam
(
'
ledgerPath
'
,
'
ledger key derivation path
'
,
ethers
.
utils
.
defaultPath
,
types
.
string
)
.
addOptionalParam
(
'
contractsRpcUrl
'
,
'
Sequencer HTTP Endpoint
'
,
process
.
env
.
CONTRACTS_RPC_URL
,
types
.
string
)
.
addOptionalParam
(
'
contractsDeployerKey
'
,
'
Private Key
'
,
process
.
env
.
CONTRACTS_DEPLOYER_KEY
,
types
.
string
)
.
addOptionalParam
(
'
contractAddress
'
,
'
Address of Ownable contract
'
,
predeploys
.
OVM_GasPriceOracle
,
types
.
string
)
.
setAction
(
async
(
args
,
hre
:
any
,
runSuper
)
=>
{
const
provider
=
new
ethers
.
providers
.
JsonRpcProvider
(
args
.
contractsRpcUrl
)
let
signer
:
ethers
.
Signer
if
(
!
args
.
useLedger
)
{
signer
=
new
ethers
.
Wallet
(
args
.
contractsDeployerKey
).
connect
(
provider
)
}
else
{
signer
=
new
LedgerSigner
(
provider
,
'
default
'
,
args
.
ledgerPath
)
}
const
Ownable
=
getContractFactory
(
'
Ownable
'
)
.
attach
(
args
.
contractAddress
)
.
connect
(
provider
)
const
addr
=
await
signer
.
getAddress
()
console
.
log
(
`Using signer
${
addr
}
`
)
const
owner
=
await
Ownable
.
callStatic
.
owner
()
if
(
owner
!==
addr
)
{
throw
new
Error
(
`Incorrect key. Owner
${
owner
}
, Signer
${
addr
}
`
)
}
console
.
log
(
`Owner is currently
${
owner
.
toString
()}
`
)
console
.
log
(
`Setting owner to
${
args
.
owner
}
`
)
const
tx
=
await
Ownable
.
connect
(
signer
).
transferOwnership
(
args
.
owner
,
{
gasPrice
:
args
.
transactionGasPrice
}
)
const
receipt
=
await
tx
.
wait
()
console
.
log
(
`Success -
${
receipt
.
transactionHash
}
`
)
})
yarn.lock
View file @
23103d90
...
...
@@ -753,7 +753,7 @@
"@ethersproject/properties" "^5.4.0"
"@ethersproject/transactions" "^5.4.0"
"@ethersproject/hardware-wallets@^5.0.8":
"@ethersproject/hardware-wallets@^5.0.8"
, "@ethersproject/hardware-wallets@^5.4.0"
:
version "5.4.0"
resolved "https://registry.yarnpkg.com/@ethersproject/hardware-wallets/-/hardware-wallets-5.4.0.tgz#bce275b395e26b6f50481095331157614490a473"
integrity sha512-Ea4ymm4etZoSWy93OcEGZkuVqyYdl/RjMlaXY6yQIYjsGi75sm4apbTiBA8DA9uajkv1FVakJZEBBTaVGgnBLA==
...
...
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