Skip to content

Commit

Permalink
fix upgrade script
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0aa0 committed May 31, 2024
1 parent ee752bb commit 50aea9c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@ import {ERC20PresetFixedSupply} from "@openzeppelin/contracts/token/ERC20/preset
import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
import {
ExistingDeploymentParser,
PaymentCoordinator,
IPaymentCoordinator,
RewardsCoordinator,
IRewardsCoordinator,
IPauserRegistry,
IStrategy,
IERC20
} from "eigenlayer-scripts/utils/ExistingDeploymentParser.sol";
import {IRegistryCoordinator} from "eigenlayer-middleware/interfaces/IRegistryCoordinator.sol";
import {IStakeRegistry} from "eigenlayer-middleware/interfaces/IStakeRegistry.sol";

import {EigenDAServiceManager} from "../../../src/core/EigenDAServiceManager.sol";

/**
* @title ServiceManagerBaseUpgrade for Preprod contracts.
* Assumes EOA deploying has permissions to call the proxyAdmin to upgrade.
*
*
* Local Fork: Deploy/Upgrade PaymentCoordinator
* Local Fork: Deploy/Upgrade RewardsCoordinator
* anvil --fork-url $RPC_HOLESKY
* forge script script/deploy/holesky/EigenDASM_PaymentsUpgrade.s.sol:ServiceManagerBaseUpgrade --rpc-url http://127.0.0.1:8545 --private-key $PRIVATE_KEY --broadcast -vvvv --sig "run(string memory deployArg)" upgrade
* forge script script/deploy/holesky/EigenDASM_PaymentsUpgrade.s.sol:ServiceManagerBaseUpgrade --rpc-url http://127.0.0.1:8545 --private-key $PRIVATE_KEY --broadcast -vvvv --sig "run(string memory deployArg)" deploy
* forge script script/deploy/holesky/EigenDASM_PaymentsUpgrade.s.sol:ServiceManagerBaseUpgrade --rpc-url http://127.0.0.1:8545 --private-key $PRIVATE_KEY --broadcast -vvvv --sig "run(string memory deployArg)" payForRange
* forge script script/deploy/holesky/EigenDASM_RewardsUpgrade.s.sol:ServiceManagerBaseUpgrade --rpc-url http://127.0.0.1:8545 --private-key $PRIVATE_KEY --broadcast -vvvv --sig "run(string memory deployArg)" upgrade
* forge script script/deploy/holesky/EigenDASM_RewardsUpgrade.s.sol:ServiceManagerBaseUpgrade --rpc-url http://127.0.0.1:8545 --private-key $PRIVATE_KEY --broadcast -vvvv --sig "run(string memory deployArg)" deploy
* forge script script/deploy/holesky/EigenDASM_RewardsUpgrade.s.sol:ServiceManagerBaseUpgrade --rpc-url http://127.0.0.1:8545 --private-key $PRIVATE_KEY --broadcast -vvvv --sig "run(string memory deployArg)" createAVSRewardsSubmission
*
* Upgrade Holesky testnet: Deploy/Upgrade PaymentCoordinator
* forge script script/deploy/holesky/EigenDASM_PaymentsUpgrade.s.sol:ServiceManagerBaseUpgrade --rpc-url $RPC_HOLESKY --private-key $PRIVATE_KEY --broadcast --verify -vvvv --sig "run(string memory deployArg)" upgrade
* forge script script/deploy/holesky/EigenDASM_PaymentsUpgrade.s.sol:ServiceManagerBaseUpgrade --rpc-url $RPC_HOLESKY --private-key $PRIVATE_KEY --broadcast --verify -vvvv --sig "run(string memory deployArg)" deploy
* forge script script/deploy/holesky/EigenDASM_PaymentsUpgrade.s.sol:ServiceManagerBaseUpgrade --rpc-url $RPC_HOLESKY --private-key $PRIVATE_KEY --broadcast --verify -vvvv --sig "run(string memory deployArg)" payForRange
* Upgrade Holesky testnet: Deploy/Upgrade RewardsCoordinator
* forge script script/deploy/holesky/EigenDASM_RewardsUpgrade.s.sol:ServiceManagerBaseUpgrade --rpc-url $RPC_HOLESKY --private-key $PRIVATE_KEY --broadcast --verify -vvvv --sig "run(string memory deployArg)" upgrade
* forge script script/deploy/holesky/EigenDASM_RewardsUpgrade.s.sol:ServiceManagerBaseUpgrade --rpc-url $RPC_HOLESKY --private-key $PRIVATE_KEY --broadcast --verify -vvvv --sig "run(string memory deployArg)" deploy
* forge script script/deploy/holesky/EigenDASM_RewardsUpgrade.s.sol:ServiceManagerBaseUpgrade --rpc-url $RPC_HOLESKY --private-key $PRIVATE_KEY --broadcast --verify -vvvv --sig "run(string memory deployArg)" createAVSRewardsSubmission
*/
contract ServiceManagerBaseUpgrade is ExistingDeploymentParser {
// Hardcode these values to your needs
Expand Down Expand Up @@ -60,8 +60,8 @@ contract ServiceManagerBaseUpgrade is ExistingDeploymentParser {
_upgradeServiceManager();
} else if (keccak256(abi.encode(deployArg)) == keccak256(abi.encode("deploy"))) {
_deployServiceManager();
} else if (keccak256(abi.encode(deployArg)) == keccak256(abi.encode("payForRange"))) {
_payForRange();
} else if (keccak256(abi.encode(deployArg)) == keccak256(abi.encode("createAVSRewardsSubmission"))) {
_createAVSRewardsSubmission();
}

vm.stopBroadcast();
Expand All @@ -82,7 +82,7 @@ contract ServiceManagerBaseUpgrade is ExistingDeploymentParser {
serviceManagerImplementation = address(
new EigenDAServiceManager(
avsDirectory,
paymentCoordinator,
rewardsCoordinator,
IRegistryCoordinator(registryCoordinator),
IStakeRegistry(stakeRegistry)
)
Expand All @@ -106,7 +106,7 @@ contract ServiceManagerBaseUpgrade is ExistingDeploymentParser {
serviceManagerImplementation = address(
new EigenDAServiceManager(
avsDirectory,
paymentCoordinator,
rewardsCoordinator,
IRegistryCoordinator(registryCoordinator),
IStakeRegistry(stakeRegistry)
)
Expand All @@ -130,19 +130,19 @@ contract ServiceManagerBaseUpgrade is ExistingDeploymentParser {
);
}

/// @notice Example payForRange call with the ServiceManager
function _payForRange() internal {
/// @notice Example createAVSRewardsSubmission call with the ServiceManager
function _createAVSRewardsSubmission() internal {
uint256 mockTokenInitialSupply = 1e30;
address stETHStrategy = 0x5C8b55722f421556a2AAfb7A3EA63d4c3e514312;
address rETHStrategy = 0x87f6C7d24b109919eB38295e3F8298425e6331D9;

IPaymentCoordinator.StrategyAndMultiplier[] memory strategyAndMultipliers = new IPaymentCoordinator.StrategyAndMultiplier[](2);
IRewardsCoordinator.StrategyAndMultiplier[] memory strategyAndMultipliers = new IRewardsCoordinator.StrategyAndMultiplier[](2);
// Strategy addresses must be in ascending order
strategyAndMultipliers[0] = IPaymentCoordinator.StrategyAndMultiplier({
strategyAndMultipliers[0] = IRewardsCoordinator.StrategyAndMultiplier({
strategy: IStrategy(stETHStrategy),
multiplier: 1e18
});
strategyAndMultipliers[1] = IPaymentCoordinator.StrategyAndMultiplier({
strategyAndMultipliers[1] = IRewardsCoordinator.StrategyAndMultiplier({
strategy: IStrategy(rETHStrategy),
multiplier: 1e18
});
Expand All @@ -160,10 +160,10 @@ contract ServiceManagerBaseUpgrade is ExistingDeploymentParser {
// amount <= 1e38 - 1
uint256 amount = 100e18;

// 2. Create range payment input param
IPaymentCoordinator.RangePayment[]
memory rangePayments = new IPaymentCoordinator.RangePayment[](1);
rangePayments[0] = IPaymentCoordinator.RangePayment({
// 2. Create RewardsSubmission input param
IRewardsCoordinator.RewardsSubmission[]
memory rewardsSubmissions = new IRewardsCoordinator.RewardsSubmission[](1);
rewardsSubmissions[0] = IRewardsCoordinator.RewardsSubmission({
strategiesAndMultipliers: strategyAndMultipliers,
token: token,
amount: amount,
Expand All @@ -172,15 +172,15 @@ contract ServiceManagerBaseUpgrade is ExistingDeploymentParser {
});

token.approve(serviceManager, amount);
EigenDAServiceManager(serviceManager).payForRange(rangePayments);
EigenDAServiceManager(serviceManager).createAVSRewardsSubmission(rewardsSubmissions);
}

/// @dev check implementation address set properly
function _verifyUpgrade() internal virtual {
// Preprod PaymentCoordinator
// Preprod RewardsCoordinator
require(
address(paymentCoordinator) == 0xb22Ef643e1E067c994019A4C19e403253C05c2B0,
"ServiceManagerBaseUpgrade: PaymentCoordinator address is incorrect"
address(rewardsCoordinator) == 0xb22Ef643e1E067c994019A4C19e403253C05c2B0,
"ServiceManagerBaseUpgrade: RewardsCoordinator address is incorrect"
);
require(
avsProxyAdmin.getProxyImplementation(
Expand All @@ -193,4 +193,4 @@ contract ServiceManagerBaseUpgrade is ExistingDeploymentParser {
"ServiceManagerBaseUpgrade: deployer address is incorrect"
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
"init_paused_status": 0,
"init_minWithdrawalDelayBlocks": 10
},
"paymentCoordinator": {
"rewardsCoordinator": {
"init_paused_status": 0,
"CALCULATION_INTERVAL_SECONDS": 604800,
"MAX_PAYMENT_DURATION": 6048000,
"MAX_REWARDS_DURATION": 6048000,
"MAX_RETROACTIVE_LENGTH": 7776000,
"MAX_FUTURE_LENGTH": 2592000,
"GENESIS_PAYMENT_TIMESTAMP": 1710979200,
"payment_updater_address": "0x02d9bd32ec711AC8782aEaBF9e1E1309F0965c11",
"GENESIS_REWARDS_TIMESTAMP": 1710979200,
"rewards_updater_address": "0x18a0f92Ad9645385E8A8f3db7d0f6CF7aBBb0aD4",
"activation_delay": 120,
"calculation_interval_seconds": 604800,
"global_operator_commission_bips": 1000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"eigenPodManager": "0xB8d8952f572e67B11e43bC21250967772fa883Ff",
"eigenPodManagerImplementation": "0xc5B857A92245f64e9D90cCc5b096Db82eB77eB5c",
"emptyContract": "0x9690d52B1Ce155DB2ec5eCbF5a262ccCc7B3A6D2",
"paymentCoordinator": "0xb22Ef643e1E067c994019A4C19e403253C05c2B0",
"paymentCoordinatorImplementation": "0xC9366ab4A299e0937EC15A6C256C4481C05A24fD",
"rewardsCoordinator": "0xb22Ef643e1E067c994019A4C19e403253C05c2B0",
"rewardsCoordinatorImplementation": "0x76d4D84c90a2AFf213F7D859d2a288685A1a2Ede",
"slasher": "0x12699471dF8dca329C76D72823B1b79d55709384",
"slasherImplementation": "0x9460fCe11E1e0365419fa860599903B4E5097cf0",
"numStrategiesDeployed": 0,
Expand Down

0 comments on commit 50aea9c

Please sign in to comment.