Skip to content

Commit

Permalink
update upgrade script to work with new changes to BaseYnEigenScript
Browse files Browse the repository at this point in the history
  • Loading branch information
danoctavian committed Sep 20, 2024
1 parent a2284e5 commit 155392e
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion script/upgrades/GenerateYnLSDeUpgradeTxData.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,62 @@ import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.s

import {BaseYnEigenScript} from "script/ynEigen/BaseYnEigenScript.s.sol";

/**
* @title GenerateYnLSDeUpgradeTxData
* @dev This script generates the transaction data needed to upgrade a specific contract in the YnLSDe system.
*
* USAGE:
* --------
* To run this script, use the following command in your terminal:
*
* TOKEN=[token name] CONTRACT_TO_UPGRADE=[contract identifier] NEW_IMPLEMENTATION=[implementation address] forge script script/upgrades/GenerateYnLSDeUpgradeTxData.s.sol --legacy --rpc-url [rpc url]
*
*
* Where:
* - TOKEN: The name of the token (e.g., ynLSDe)
* - CONTRACT_TO_UPGRADE: The name of the contract to be upgraded (e.g., rateProvider)
* - NEW_IMPLEMENTATION: The address of the new implementation contract
*
*
*
* EXAMPLE:
* --------
* # Upgrade rateProvider of ynLSDe on Holesky to the given implementation
* TOKEN=ynLSDe CONTRACT_TO_UPGRADE=rateProvider NEW_IMPLEMENTATION=0x48c3dfd4d14e7899c4adbf8e2d5aef6af585d305 forge script script/upgrades/GenerateYnLSDeUpgradeTxData.s.sol --legacy --rpc-url https://rpc.ankr.com/eth_holesky
*
* This command will:
* 1. Set the token name to 'ynLSDe'
* 2. Specify 'rateProvider' as the contract to upgrade
* 3. Set the new implementation address to 0x48c3dfd4d14e7899c4adbf8e2d5aef6af585d305
* 4. Use the Holesky testnet RPC URL for execution
*
* The script will then generate and display the necessary transaction data for the upgrade process.
* --------
*/

contract GenerateYnLSDeUpgradeTxData is BaseYnEigenScript {
Deployment deployment;

string internal _tokenName;

function tokenName() internal view override returns (string memory) {
return _tokenName;
}

function run() external {
deployment = loadDeployment();

console.log("=== Upgrade Information ===");
console.log("Current Block Number: %s", block.number);
console.log("Current Chain ID: %s", block.chainid);

_tokenName = vm.envString("TOKEN");
string memory contractToUpgrade = vm.envString("CONTRACT_TO_UPGRADE");
address newImplementation = vm.envAddress("NEW_IMPLEMENTATION");

console.log("Token Name: %s", _tokenName);

deployment = loadDeployment();

console.log("=== Contract Upgrade Details ===");
console.log("Contract to upgrade: %s", contractToUpgrade);
console.log("Contract address: %s", vm.toString(getProxyAddress(contractToUpgrade)));
Expand Down

0 comments on commit 155392e

Please sign in to comment.