-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: updating deployment scripts to change owner in staking contracts #194
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
scripts/deployment/l2/deploy_21_22_service_staking_change_ownerships.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/*global process*/ | ||
|
||
const { ethers } = require("hardhat"); | ||
const { LedgerSigner } = require("@anders-t/ethers-ledger"); | ||
|
||
async function main() { | ||
const fs = require("fs"); | ||
const globalsFile = "globals.json"; | ||
const dataFromJSON = fs.readFileSync(globalsFile, "utf8"); | ||
let parsedData = JSON.parse(dataFromJSON); | ||
const useLedger = parsedData.useLedger; | ||
const derivationPath = parsedData.derivationPath; | ||
const providerName = parsedData.providerName; | ||
const gasPriceInGwei = parsedData.gasPriceInGwei; | ||
const stakingVerifierAddress = parsedData.stakingVerifierAddress; | ||
const stakingFactoryAddress = parsedData.stakingFactoryAddress; | ||
const bridgeMediatorAddress = parsedData.bridgeMediatorAddress; | ||
|
||
let networkURL = parsedData.networkURL; | ||
if (providerName === "mainnet") { | ||
if (!process.env.ALCHEMY_API_KEY_MAINNET) { | ||
console.log("set ALCHEMY_API_KEY_MAINNET env variable"); | ||
} | ||
networkURL += process.env.ALCHEMY_API_KEY_MAINNET; | ||
} | ||
if (providerName === "polygon") { | ||
if (!process.env.ALCHEMY_API_KEY_MATIC) { | ||
console.log("set ALCHEMY_API_KEY_MATIC env variable"); | ||
} | ||
networkURL += process.env.ALCHEMY_API_KEY_MATIC; | ||
} else if (providerName === "polygonAmoy") { | ||
if (!process.env.ALCHEMY_API_KEY_AMOY) { | ||
console.log("set ALCHEMY_API_KEY_AMOY env variable"); | ||
return; | ||
} | ||
networkURL += process.env.ALCHEMY_API_KEY_AMOY; | ||
} | ||
|
||
const provider = new ethers.providers.JsonRpcProvider(networkURL); | ||
const signers = await ethers.getSigners(); | ||
|
||
let EOA; | ||
if (useLedger) { | ||
EOA = new LedgerSigner(provider, derivationPath); | ||
} else { | ||
EOA = signers[0]; | ||
} | ||
// EOA address | ||
const deployer = await EOA.getAddress(); | ||
console.log("EOA is:", deployer); | ||
|
||
// Get all the contracts | ||
const stakingVerifier = await ethers.getContractAt("StakingVerifier", stakingVerifierAddress); | ||
const stakingFactory = await ethers.getContractAt("StakingFactory", stakingFactoryAddress); | ||
|
||
// Gas pricing | ||
const gasPrice = ethers.utils.parseUnits(gasPriceInGwei, "gwei"); | ||
|
||
// Transaction signing and execution | ||
// 21. EOA to transfer ownership rights of StakingVerifier to BridgeMediator calling `changeOwner(BridgeMediator)`; | ||
console.log("21. You are signing the following transaction: StakingVerifier.connect(EOA).changeOwner()"); | ||
let result = await stakingVerifier.connect(EOA).changeOwner(bridgeMediatorAddress, { gasPrice }); | ||
// Transaction details | ||
console.log("Contract address:", stakingVerifierAddress); | ||
console.log("Transaction:", result.hash); | ||
|
||
// 22. EOA to transfer ownership rights of StakingFactory to BridgeMediator calling `changeOwner(BridgeMediator)`; | ||
console.log("22. You are signing the following transaction: StakingFactory.connect(EOA).changeOwner()"); | ||
result = await stakingFactory.connect(EOA).changeOwner(bridgeMediatorAddress, { gasPrice }); | ||
// Transaction details | ||
console.log("Contract address:", stakingFactoryAddress); | ||
console.log("Transaction:", result.hash); | ||
} | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,8 @@ | |
"derivationPath": "m/44'/60'/2'/0/0", | ||
"providerName": "mainnet", | ||
"networkURL": "https://eth-mainnet.g.alchemy.com/v2/", | ||
"gasPriceInGwei": "15", | ||
"gasPriceInGwei": "30", | ||
"bridgeMediatorAddress": "0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is the timelock? |
||
"serviceRegistryAddress": "0x48b6af7B12C71f09e2fC8aF4855De4Ff54e775cA", | ||
"serviceRegistryTokenUtilityAddress": "0x3Fb926116D454b95c669B6Bf2E7c3bad8d19affA", | ||
"olasAddress": "0x0001A500A6B18995B03f44bb040A5fFc28E45CB0", | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correcting a wrong link