Skip to content

Commit

Permalink
T/version1 1 release (#95)
Browse files Browse the repository at this point in the history
* [chore] Bump version to 1.1

* [feat] Deploy Version 1.1 to Goerli

* [feat] Deploy Version 1.1 to Mainnet
  • Loading branch information
tbtstl authored Dec 22, 2022
1 parent d97dc4b commit d31a08f
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 14 deletions.
12 changes: 6 additions & 6 deletions addresses/1.json
Original file line number Diff line number Diff line change
@@ -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"
}
12 changes: 6 additions & 6 deletions addresses/5.json
Original file line number Diff line number Diff line change
@@ -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"
}
6 changes: 6 additions & 0 deletions deploys/1.version1_1.txt
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions deploys/5.version1_1.txt
Original file line number Diff line number Diff line change
@@ -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
95 changes: 95 additions & 0 deletions script/DeployVersion1_1.s.sol
Original file line number Diff line number Diff line change
@@ -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);
}
}
2 changes: 1 addition & 1 deletion src/VersionedContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}
2 changes: 1 addition & 1 deletion test/VersionedContractTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit d31a08f

Please sign in to comment.