Skip to content

Commit

Permalink
refactor to keep manager types and reduce diff
Browse files Browse the repository at this point in the history
  • Loading branch information
neokry committed Oct 18, 2023
1 parent 57c2543 commit 8f46256
Show file tree
Hide file tree
Showing 53 changed files with 664 additions and 1,861 deletions.
92 changes: 0 additions & 92 deletions script/DeployMetadataUpgrade.s.sol

This file was deleted.

4 changes: 3 additions & 1 deletion script/DeployNewDAO.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";

import { IManager } from "../src/manager/IManager.sol";
import { IPartialMirrorToken } from "../src/token/partial-mirror/IPartialMirrorToken.sol";
import { IPropertyMetadata } from "../src/metadata/property/interfaces/IPropertyMetadata.sol";
import { IBaseMetadata } from "../src/token/metadata/interfaces/IBaseMetadata.sol";
import { IAuction } from "../src/auction/IAuction.sol";
import { IGovernor } from "../src/governance/governor/IGovernor.sol";
import { ITreasury } from "../src/governance/treasury/ITreasury.sol";
import { MerkleReserveMinter } from "../src/minters/MerkleReserveMinter.sol";

contract SetupDaoScript is Script {
/*
using Strings for uint256;
string configFile;
Expand Down Expand Up @@ -102,4 +103,5 @@ contract SetupDaoScript is Script {
vm.stopBroadcast();
}
*/
}
103 changes: 0 additions & 103 deletions script/DeployTokenUpgrade.s.sol

This file was deleted.

24 changes: 8 additions & 16 deletions script/DeployV2Core.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";

import { IManager, Manager } from "../src/manager/Manager.sol";
import { IToken, Token } from "../src/token/default/Token.sol";
import { PartialMirrorToken } from "../src/token/partial-mirror/PartialMirrorToken.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 { PropertyMetadata } from "../src/metadata/property/PropertyMetadata.sol";
import { PropertyMetadataTypesV1 } from "../src/metadata/property/types/PropertyMetadataTypesV1.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";
import { ProtocolRewards } from "../src/rewards/ProtocolRewards.sol";

Expand Down Expand Up @@ -41,7 +42,7 @@ contract DeployContracts is Script {
vm.startBroadcast(deployerAddress);

// Deploy root manager implementation + proxy
address managerImpl0 = address(new Manager());
address managerImpl0 = address(new Manager(address(0), address(0), address(0), address(0), address(0), address(0)));

Manager manager = Manager(address(new ERC1967Proxy(managerImpl0, abi.encodeWithSignature("initialize(address)", deployerAddress))));

Expand All @@ -50,8 +51,10 @@ contract DeployContracts is Script {
// Deploy standard token implementation
address tokenImpl = address(new Token(address(manager)));

address mirrorTokenImpl = address(new PartialMirrorToken(address(manager)));

// Deploy metadata renderer implementation
address metadataRendererImpl = address(new PropertyMetadata(address(manager)));
address metadataRendererImpl = address(new MetadataRenderer(address(manager)));

// Deploy auction house implementation
address auctionImpl = address(new Auction(address(manager), address(rewards), weth));
Expand All @@ -62,21 +65,10 @@ contract DeployContracts is Script {
// Deploy governor implementation
address governorImpl = address(new Governor(address(manager)));

address managerImpl = address(new Manager());
address managerImpl = address(new Manager(tokenImpl, mirrorTokenImpl, metadataRendererImpl, auctionImpl, treasuryImpl, governorImpl));

manager.upgradeTo(managerImpl);

// Register implementations
manager.registerImplementation(manager.IMPLEMENTATION_TYPE_TOKEN(), tokenImpl);

manager.registerImplementation(manager.IMPLEMENTATION_TYPE_METADATA(), metadataRendererImpl);

manager.registerImplementation(manager.IMPLEMENTATION_TYPE_AUCTION(), auctionImpl);

manager.registerImplementation(manager.IMPLEMENTATION_TYPE_GOVERNOR(), governorImpl);

manager.registerImplementation(manager.IMPLEMENTATION_TYPE_TREASURY(), treasuryImpl);

vm.stopBroadcast();

string memory filePath = string(abi.encodePacked("deploys/", chainID.toString(), ".version2_core.txt"));
Expand Down
10 changes: 0 additions & 10 deletions script/DeployV2New.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { PartialMirrorToken } from "../src/token/partial-mirror/PartialMirrorTok
import { ERC1967Proxy } from "../src/lib/proxy/ERC1967Proxy.sol";
import { ERC721RedeemMinter } from "../src/minters/ERC721RedeemMinter.sol";
import { MerkleReserveMinter } from "../src/minters/MerkleReserveMinter.sol";
import { MediaMetadata } from "../src/metadata/media/MediaMetadata.sol";

contract DeployContracts is Script {
using Strings for uint256;
Expand Down Expand Up @@ -49,11 +48,6 @@ contract DeployContracts is Script {

address merkleMinter = address(new MerkleReserveMinter(manager));

address mediaMetadata = address(new MediaMetadata(address(manager)));

// Register implementations
manager.registerImplementation(manager.IMPLEMENTATION_TYPE_TOKEN(), mirrorTokenImpl);

vm.stopBroadcast();

string memory filePath = string(abi.encodePacked("deploys/", chainID.toString(), ".version2_new.txt"));
Expand All @@ -62,7 +56,6 @@ contract DeployContracts is Script {
vm.writeLine(filePath, string(abi.encodePacked("Mirror Token implementation: ", addressToString(mirrorTokenImpl))));
vm.writeLine(filePath, string(abi.encodePacked("ERC721 Redeem Minter: ", addressToString(erc721Minter))));
vm.writeLine(filePath, string(abi.encodePacked("Merkle Reserve Minter: ", addressToString(merkleMinter))));
vm.writeLine(filePath, string(abi.encodePacked("Media Metadata Renderer: ", addressToString(mediaMetadata))));

console2.log("~~~~~~~~~~ MIRROR TOKEN IMPL ~~~~~~~~~~~");
console2.logAddress(mirrorTokenImpl);
Expand All @@ -72,9 +65,6 @@ contract DeployContracts is Script {

console2.log("~~~~~~~~~~ MERKLE RESERVE MINTER ~~~~~~~~~~~");
console2.logAddress(merkleMinter);

console2.log("~~~~~~~~~~ MEDIA METADATA RENDERER ~~~~~~~~~~~");
console2.logAddress(mediaMetadata);
}

function addressToString(address _addr) private pure returns (string memory) {
Expand Down
Loading

0 comments on commit 8f46256

Please sign in to comment.