-
Notifications
You must be signed in to change notification settings - Fork 19
Sepolia TokenStaking proxy deploy, ExtendedTokenStaking upgrade, and operator setup tooling #176
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
Open
lionakhnazarov
wants to merge
21
commits into
main
Choose a base branch
from
feat/testnet4-deployment-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
61e6a88
Adds new functionality for application approval and authorization inc…
lionakhnazarov f7f93f8
Restrict application approval to governance only in TokenStaking
lionakhnazarov 2117bae
Merge branch 'main' into feat/testnet4-deployment-support
lionakhnazarov e75cf76
Update GitHub Actions workflows to use Node.js v4 and enable Corepack…
lionakhnazarov 8aede8d
Merge branch 'feat/testnet4-deployment-support' of github.com:thresho…
lionakhnazarov 31c1b2e
Update Yarn configuration and package manager version
lionakhnazarov b5a532f
Update GitHub Actions workflows to reference local reusable Solidity …
lionakhnazarov d4d62b0
fix(scripts): harden operator key management security
piotr-roslaniec 42ca14f
fix(scripts): pass signing keys via ETH_PRIVATE_KEY env var, not CLI …
piotr-roslaniec 2347611
fix(deploy): remove hardcoded proxy kind and deduplicate fs import
piotr-roslaniec 300b1ad
fix(deployments): restore deleted mainnet TokenStaking.json
piotr-roslaniec ea8ae81
fix(TokenStaking): add zero-address guard to increaseAuthorization
piotr-roslaniec 1e32bf1
Merge pull request #177 from threshold-network/fix/testnet4-security-…
lionakhnazarov b524ca4
Merge branch 'main' into feat/testnet4-deployment-support
lrsaturnino 0889e0a
Enhance deployment scripts and update .gitignore for operator setup
lionakhnazarov ead0615
Merge branch 'feat/testnet4-deployment-support' of github.com:thresho…
lionakhnazarov 8d3c75c
Enhance operator setup scripts to handle private keys securely
lionakhnazarov 71fd589
Improve private key handling in operator setup script
lionakhnazarov b993dde
Enhance operator setup script with T token minting and validation
lionakhnazarov ec06657
Enhance operator setup script with T token balance checks and minting…
lionakhnazarov 0e9702d
Update deployment configurations and enhance operator setup script
lionakhnazarov 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,82 @@ | ||
| import { HardhatRuntimeEnvironment } from "hardhat/types" | ||
| import { DeployFunction } from "hardhat-deploy/types" | ||
|
|
||
| import { ethers, upgrades } from "hardhat" | ||
|
|
||
| /** | ||
| * Upgrades TokenStaking proxy to ExtendedTokenStaking implementation. | ||
| * ExtendedTokenStaking adds the stake() function required for native T staking. | ||
| * The base TokenStaking does not have stake() - it only supports legacy KEEP/NU | ||
| * migrations. Run this on sepolia (or other testnets) where operators need to | ||
| * stake T directly. | ||
| * | ||
| * From repo root (syncs deployments, upgrades, copies ABI to tbtc-v2): | ||
| * bash scripts/upgrade-token-staking-sepolia.sh | ||
|
lionakhnazarov marked this conversation as resolved.
Outdated
|
||
| */ | ||
| const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
| const { deployments, getNamedAccounts } = hre | ||
| const { log } = deployments | ||
| const { deployer } = await getNamedAccounts() | ||
|
|
||
| if (hre.network.name !== "sepolia") { | ||
| log("Skipping TokenStaking upgrade (only for sepolia)") | ||
| return | ||
| } | ||
|
|
||
| let proxyAddress: string | ||
| const existing = await deployments.getOrNull("TokenStaking") | ||
| if (existing) { | ||
| proxyAddress = existing.address | ||
| } else { | ||
| // 07_deploy_token_staking saves to TokenStaking.json in deployments dir | ||
| const fs = require("fs") | ||
| const deploymentPath = `deployments/${hre.network.name}/TokenStaking.json` | ||
|
lionakhnazarov marked this conversation as resolved.
|
||
| if (!fs.existsSync(deploymentPath)) { | ||
| log("TokenStaking not deployed, skipping upgrade") | ||
| return | ||
| } | ||
| const deployment = JSON.parse(fs.readFileSync(deploymentPath, "utf8")) | ||
| proxyAddress = deployment.address | ||
| } | ||
|
|
||
| log(`Upgrading TokenStaking at ${proxyAddress} to ExtendedTokenStaking`) | ||
|
|
||
| const T = await deployments.get("T") | ||
|
|
||
| const ExtendedTokenStaking = await ethers.getContractFactory( | ||
| "ExtendedTokenStaking" | ||
| ) | ||
|
|
||
| const upgraded = await upgrades.upgradeProxy( | ||
| proxyAddress, | ||
| ExtendedTokenStaking, | ||
| { | ||
| constructorArgs: [T.address], | ||
| kind: "transparent", | ||
| } | ||
| ) | ||
| await upgraded.deployed() | ||
|
|
||
| log(`Upgraded TokenStaking to ExtendedTokenStaking at ${upgraded.address}`) | ||
|
|
||
| // Update deployment JSON with new ABI (includes stake) | ||
| const implementationInterface = upgraded.interface | ||
| const jsonAbi = implementationInterface.format(ethers.utils.FormatTypes.json) | ||
| const tokenStakingDeployment = { | ||
| address: upgraded.address, | ||
| abi: JSON.parse(jsonAbi as string), | ||
| } | ||
| const fs = require("fs") | ||
| const deploymentsDir = `deployments/${hre.network.name}` | ||
| fs.writeFileSync( | ||
| `${deploymentsDir}/TokenStaking.json`, | ||
| JSON.stringify(tokenStakingDeployment, null, 2), | ||
| "utf8" | ||
| ) | ||
| log(`Updated ${deploymentsDir}/TokenStaking.json with ExtendedTokenStaking ABI`) | ||
| } | ||
|
|
||
| export default func | ||
|
|
||
| func.tags = ["TokenStakingUpgrade", "UpgradeTokenStaking"] | ||
| func.dependencies = ["T"] | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.