From d31a08fa46259f3a6f70b05ab92fbab05dba6997 Mon Sep 17 00:00:00 2001 From: Tyson Battistella Date: Wed, 21 Dec 2022 16:51:44 -0800 Subject: [PATCH] T/version1 1 release (#95) * [chore] Bump version to 1.1 * [feat] Deploy Version 1.1 to Goerli * [feat] Deploy Version 1.1 to Mainnet --- addresses/1.json | 12 ++-- addresses/5.json | 12 ++-- deploys/1.version1_1.txt | 6 ++ deploys/5.version1_1.txt | 6 ++ script/DeployVersion1_1.s.sol | 95 ++++++++++++++++++++++++++++++++ src/VersionedContract.sol | 2 +- test/VersionedContractTest.t.sol | 2 +- 7 files changed, 121 insertions(+), 14 deletions(-) create mode 100644 deploys/1.version1_1.txt create mode 100644 deploys/5.version1_1.txt create mode 100644 script/DeployVersion1_1.s.sol diff --git a/addresses/1.json b/addresses/1.json index be54f68..1203b0b 100644 --- a/addresses/1.json +++ b/addresses/1.json @@ -1,10 +1,10 @@ { "Manager": "0xd310a3041dfcf14def5ccbc508668974b5da7174", - "ManagerImpl": "0x96d1c6452c7c12a2ae5478f4664835a0eb18f43a", + "ManagerImpl": "0xee5a9dfede69d9c3814531ed0cad5f951cc10742", "WETH": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "Auction": "0x5e97b8cfEa96d7571585f79922d134003BD4Dc60", - "Token": "0xb69dc36182fe5dad045bd4b08ffb042d10d0fb77", - "MetadataRenderer": "0xAc193e2126F0E7734F2aC8DA9D4002935b3c1d75", - "Treasury": "0xc8F8Ac74600D5A1c1ba677B10D1da0E7e806CF23", - "Governor": "0xb42d8E37DCBA5Fe5323C4a6722ba6DEd9E8E84Da" + "Auction": "0x2661fe1a882abfd28ae0c2769a90f327850397c6", + "Token": "0xe6322201ced0a4d6595968411285a39ccf9d5989", + "MetadataRenderer": "0x26f494af990123154e7cc067da7a311b07d54ae1", + "Treasury": "0x0b6d2473f54de3f1d80b27c92b22d13050da289a", + "Governor": "0x9eefef0891b1895af967fe48c5d7d96e984b96a3" } \ No newline at end of file diff --git a/addresses/5.json b/addresses/5.json index 8e4e8b9..041a423 100644 --- a/addresses/5.json +++ b/addresses/5.json @@ -1,10 +1,10 @@ { "Manager": "0x0E9F3382Cf2508E3bc83248B5b4707FbA86D7Ee0", - "ManagerImpl": "0xc20dac0b62b28edde0c44ab1be2206a1c48e6a67", + "ManagerImpl": "0xa9c06ed87cab90e77281f0b163f8a69a38971a3b", "WETH": "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6", - "Auction": "0xaF1927E33474686879C3438d7D22D2929C9F539F", - "Token": "0x6836408a7fa1287f2a2cd3e7dc57dfffd007c7b3", - "MetadataRenderer": "0x1d613CDfBd3bbE7BC7715B90B002Cce1454B8beF", - "Treasury": "0x0a41432aBC5B06e4064Fc7091EbAd8c64a97924A", - "Governor": "0x8dA6F93a088FF6f47B239ed98d11bBAcdf7f888E" + "Auction": "0x5bde6cf41cd7aa5b6e522ffa491f1bf6c6607bd3", + "Token": "0xac193e2126f0e7734f2ac8da9d4002935b3c1d75", + "MetadataRenderer": "0x94d792e07216796cb235e328823199fb8da3c911", + "Treasury": "0x935522cf33ae425187aeec69737bd30ab56bd16e", + "Governor": "0x04b2c0ea4ea3e9c92f0555fd0fb9c9564e25c52e" } \ No newline at end of file diff --git a/deploys/1.version1_1.txt b/deploys/1.version1_1.txt new file mode 100644 index 0000000..aae4fc0 --- /dev/null +++ b/deploys/1.version1_1.txt @@ -0,0 +1,6 @@ +Auction Upgrade implementation: 0x2661fe1a882abfd28ae0c2769a90f327850397c6 +Governor Upgrade implementation: 0x9eefef0891b1895af967fe48c5d7d96e984b96a3 +Treasury Upgrade implementation: 0x0b6d2473f54de3f1d80b27c92b22d13050da289a +Token Upgrade implementation: 0xe6322201ced0a4d6595968411285a39ccf9d5989 +Metadata Upgrade implementation: 0x26f494af990123154e7cc067da7a311b07d54ae1 +Manager implementation: 0xee5a9dfede69d9c3814531ed0cad5f951cc10742 diff --git a/deploys/5.version1_1.txt b/deploys/5.version1_1.txt new file mode 100644 index 0000000..5a37fe6 --- /dev/null +++ b/deploys/5.version1_1.txt @@ -0,0 +1,6 @@ +Auction Upgrade implementation: 0x5bde6cf41cd7aa5b6e522ffa491f1bf6c6607bd3 +Governor Upgrade implementation: 0x04b2c0ea4ea3e9c92f0555fd0fb9c9564e25c52e +Treasury Upgrade implementation: 0x935522cf33ae425187aeec69737bd30ab56bd16e +Token Upgrade implementation: 0xac193e2126f0e7734f2ac8da9d4002935b3c1d75 +Metadata Upgrade implementation: 0x94d792e07216796cb235e328823199fb8da3c911 +Manager implementation: 0xa9c06ed87cab90e77281f0b163f8a69a38971a3b diff --git a/script/DeployVersion1_1.s.sol b/script/DeployVersion1_1.s.sol new file mode 100644 index 0000000..77e6e39 --- /dev/null +++ b/script/DeployVersion1_1.s.sol @@ -0,0 +1,95 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import "forge-std/Script.sol"; +import "forge-std/console2.sol"; +import { Strings } from "@openzeppelin/contracts/utils/Strings.sol"; + +import { IManager, Manager } from "../src/manager/Manager.sol"; +import { IToken, Token } from "../src/token/Token.sol"; +import { MetadataRenderer } from "../src/token/metadata/MetadataRenderer.sol"; +import { IAuction, Auction } from "../src/auction/Auction.sol"; +import { IGovernor, Governor } from "../src/governance/governor/Governor.sol"; +import { ITreasury, Treasury } from "../src/governance/treasury/Treasury.sol"; +import { MetadataRenderer } from "../src/token/metadata/MetadataRenderer.sol"; +import { MetadataRendererTypesV1 } from "../src/token/metadata/types/MetadataRendererTypesV1.sol"; +import { ERC1967Proxy } from "../src/lib/proxy/ERC1967Proxy.sol"; + +contract DeployVersion1_1 is Script { + using Strings for uint256; + + string configFile; + + function _getKey(string memory key) internal returns (address result) { + (result) = abi.decode(vm.parseJson(configFile, key), (address)); + } + + function run() public { + uint256 chainID = vm.envUint("CHAIN_ID"); + console.log("CHAIN_ID", chainID); + uint256 key = vm.envUint("PRIVATE_KEY"); + address deployerAddress = vm.addr(key); + + configFile = vm.readFile(string.concat("./addresses/", Strings.toString(chainID), ".json")); + + address managerProxy = _getKey("Manager"); + address weth = _getKey("WETH"); + + console2.log("~~~~~~~~~~ DEPLOYER ADDRESS ~~~~~~~~~~~"); + console2.logAddress(deployerAddress); + + console2.log("~~~~~~~~~~ MANAGER PROXY ~~~~~~~~~~~"); + console2.logAddress(managerProxy); + + console2.log("~~~~~~~~~~ WETH ADDRESS ~~~~~~~~~~~"); + console2.logAddress(weth); + + vm.startBroadcast(deployerAddress); + + // Get root manager implementation + proxy + Manager manager = Manager(managerProxy); + + // Deploy auction upgrade implementation + address auctionUpgradeImpl = address(new Auction(managerProxy, weth)); + // Deploy governor upgrade implementation + address governorUpgradeImpl = address(new Governor(managerProxy)); + // Deploy treasury upgrade implementation + address treasuryUpgradeImpl = address(new Treasury(managerProxy)); + // Deploy token upgrade implementation + address tokenUpgradeImpl = address(new Token(managerProxy)); + // Deploy metadata upgrade implementation + address metadataUpgradeImpl = address(new MetadataRenderer(managerProxy)); + + address managerImpl = address( + new Manager(tokenUpgradeImpl, metadataUpgradeImpl, auctionUpgradeImpl, treasuryUpgradeImpl, governorUpgradeImpl) + ); + + vm.stopBroadcast(); + + string memory filePath = string(abi.encodePacked("deploys/", chainID.toString(), ".version1_1.txt")); + vm.writeFile(filePath, ""); + vm.writeLine(filePath, string(abi.encodePacked("Auction Upgrade implementation: ", addressToString(auctionUpgradeImpl)))); + vm.writeLine(filePath, string(abi.encodePacked("Governor Upgrade implementation: ", addressToString(governorUpgradeImpl)))); + vm.writeLine(filePath, string(abi.encodePacked("Treasury Upgrade implementation: ", addressToString(treasuryUpgradeImpl)))); + vm.writeLine(filePath, string(abi.encodePacked("Token Upgrade implementation: ", addressToString(tokenUpgradeImpl)))); + vm.writeLine(filePath, string(abi.encodePacked("Metadata Upgrade implementation: ", addressToString(metadataUpgradeImpl)))); + vm.writeLine(filePath, string(abi.encodePacked("Manager implementation: ", addressToString(managerImpl)))); + } + + function addressToString(address _addr) private pure returns (string memory) { + bytes memory s = new bytes(40); + for (uint256 i = 0; i < 20; i++) { + bytes1 b = bytes1(uint8(uint256(uint160(_addr)) / (2**(8 * (19 - i))))); + bytes1 hi = bytes1(uint8(b) / 16); + bytes1 lo = bytes1(uint8(b) - 16 * uint8(hi)); + s[2 * i] = char(hi); + s[2 * i + 1] = char(lo); + } + return string(abi.encodePacked("0x", string(s))); + } + + function char(bytes1 b) private pure returns (bytes1 c) { + if (uint8(b) < 10) return bytes1(uint8(b) + 0x30); + else return bytes1(uint8(b) + 0x57); + } +} diff --git a/src/VersionedContract.sol b/src/VersionedContract.sol index c912642..54ae4a9 100644 --- a/src/VersionedContract.sol +++ b/src/VersionedContract.sol @@ -3,6 +3,6 @@ pragma solidity 0.8.16; abstract contract VersionedContract { function contractVersion() external pure returns (string memory) { - return "1.0.0"; + return "1.1.0"; } } diff --git a/test/VersionedContractTest.t.sol b/test/VersionedContractTest.t.sol index 620e243..87ff276 100644 --- a/test/VersionedContractTest.t.sol +++ b/test/VersionedContractTest.t.sol @@ -7,7 +7,7 @@ import { VersionedContract } from "../src/VersionedContract.sol"; contract MockVersionedContract is VersionedContract {} contract VersionedContractTest is NounsBuilderTest { - string expectedVersion = "1.0.0"; + string expectedVersion = "1.1.0"; function test_Version() public { MockVersionedContract mockContract = new MockVersionedContract();