Skip to content

Commit

Permalink
add 1.3.0 deployment script
Browse files Browse the repository at this point in the history
  • Loading branch information
simonDos committed Jul 15, 2024
1 parent db50cb8 commit 0aadab1
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
45 changes: 45 additions & 0 deletions script/1.3.0/UpgradeEmissionManager.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;

import {Script, stdJson, console2 as console} from "forge-std/Script.sol";

import {
ProxyAdmin,
TransparentUpgradeableProxy,
ITransparentUpgradeableProxy
} from "openzeppelin-contracts/contracts/proxy/transparent/ProxyAdmin.sol";
import {DefaultEmissionManager} from "../../src/DefaultEmissionManager.sol";

contract UpgradeEmissionManager is Script {
using stdJson for string;

function run() public {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");

string memory input = vm.readFile("script/1.2.0/input.json");
string memory chainIdSlug = string(abi.encodePacked('["', vm.toString(block.chainid), '"]'));
address emProxyAddress = input.readAddress(string.concat(chainIdSlug, ".emissionManagerProxy"));
address emProxyAdmin = input.readAddress(string.concat(chainIdSlug, ".emProxyAdmin"));

vm.startBroadcast(deployerPrivateKey);

DefaultEmissionManager emProxy = DefaultEmissionManager(emProxyAddress);

address migration = address(emProxy.migration());
address stakeManager = emProxy.stakeManager();
address treasury = emProxy.treasury();

DefaultEmissionManager newEmImpl = new DefaultEmissionManager(migration, stakeManager, treasury);

vm.stopBroadcast();

bytes memory payload = abi.encodeWithSelector(
ProxyAdmin.upgrade.selector,
ITransparentUpgradeableProxy(address(emProxy)),
address(newEmImpl)
);

console.log("Send this payload to: ", emProxyAdmin);
console.logBytes(payload);
}
}
10 changes: 10 additions & 0 deletions script/1.3.0/input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"1": {
"emissionManagerProxy": "0xbC9f74b3b14f460a6c47dCdDFd17411cBc7b6c53",
"emProxyAdmin": "0xEBea33f2c92D03556b417F4F572B2FbbE62C39c3"
},
"11155111": {
"emissionManagerProxy": "0x20393fF3B3C38b72a16eB7d7A474cd38ABD8Ff27",
"emProxyAdmin": "0x28cDCE6FfE44D03da1F7b15b474a0e72243873F2"
}
}

0 comments on commit 0aadab1

Please sign in to comment.