Skip to content

Commit

Permalink
🚀 Upgrade deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
Flocqst committed Nov 19, 2024
1 parent fdeceb4 commit b47fcb1
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 42 deletions.
51 changes: 51 additions & 0 deletions scripts/Upgrade.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.19;

import {Script, console} from "forge-std/Script.sol";
import {RewardEscrowV2} from "../contracts/RewardEscrowV2.sol";
import {StakingRewardsV2} from "../contracts/StakingRewardsV2.sol";
import {OptimismParameters} from "scripts/utils/parameters/OptimismParameters.sol";

/// @dev steps to upgrade RewardEscrowV2 on Optimism:
/// (1) ensure the .env file contains the following variables:
/// - DEPLOYER_PRIVATE_KEY - the private key of the deployer
/// - ETHERSCAN_API_KEY - the API key of the Optimism Etherscan account (a normal etherscan API key will not work)
/// - ARCHIVE_NODE_URL_L2 - the archive node URL of the Optimism network
/// (2) load the variables in the .env file via `source .env`
/// (3) run `forge script scripts/Upgrade.s.sol:UpgradeRewardEscrowV2 --rpc-url $ARCHIVE_NODE_URL_L2 --etherscan-api-key $ETHERSCAN_API_KEY --broadcast --verify -vvvv``
/// (4) Call upgradeTo() on the proxy with the new implementation address
contract UpgradeRewardEscrowV2 is Script, OptimismParameters {
function run() public {
uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);

RewardEscrowV2 rewardEscrowImplementation = new RewardEscrowV2(KWENTA_TOKEN, STAKING_REWARDS_NOTIFIER);

vm.stopBroadcast();
}
}


/// @dev steps to upgrade StakingRewardsV2 on Optimism:
/// (1) ensure the .env file contains the following variables:
/// - DEPLOYER_PRIVATE_KEY - the private key of the deployer
/// - ETHERSCAN_API_KEY - the API key of the Optimism Etherscan account (a normal etherscan API key will not work)
/// - ARCHIVE_NODE_URL_L2 - the archive node URL of the Optimism network
/// (2) load the variables in the .env file via `source .env`
/// (3) run `forge script scripts/Upgrade.s.sol:UpgradeStakingRewardsV2 --rpc-url $ARCHIVE_NODE_URL_L2 --etherscan-api-key $ETHERSCAN_API_KEY --broadcast --verify -vvvv``
/// (4) Call upgradeTo() on the proxy with the new implementation address
contract UpgradeStakingRewardsV2 is Script, OptimismParameters {
function run() public {
uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);

StakingRewardsV2 stakingRewardsV2Implementation = new StakingRewardsV2(
KWENTA_TOKEN,
USDC_TOKEN,
REWARD_ESCROW_V2,
STAKING_REWARDS_NOTIFIER
);

vm.stopBroadcast();
}
}
42 changes: 0 additions & 42 deletions scripts/UpgradeRewardEscrowV2.s.sol

This file was deleted.

12 changes: 12 additions & 0 deletions scripts/utils/parameters/OptimismParameters.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.19;

contract OptimismParameters {
address public constant KWENTA_TOKEN = 0x920Cf626a271321C151D027030D5d08aF699456b;

address public constant STAKING_REWARDS_NOTIFIER = 0xb176DaD2916db0905cd2D65ed54FDC3a878aFFe4;

address public constant REWARD_ESCROW_V2 = 0xb2a20fCdc506a685122847b21E34536359E94C56;

address public constant USDC_TOKEN = 0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85;
}

0 comments on commit b47fcb1

Please sign in to comment.