-
Notifications
You must be signed in to change notification settings - Fork 7
/
Deployment.s.sol
53 lines (45 loc) · 2.75 KB
/
Deployment.s.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import { console2 } from "forge-std/console2.sol";
import { MCDevKit } from "@devkit/MCDevKit.sol";
import { MCScript } from "@devkit/MCScript.sol";
import { Clone } from "@mc-std/functions/Clone.sol";
import { Initialize } from "bundle/textdao/functions/onlyonce/Initialize.sol";
import { Propose } from "bundle/textdao/functions/Propose.sol";
import { Fork } from "bundle/textdao/functions/Fork.sol";
import { Vote } from "bundle/textdao/functions/Vote.sol";
import { Tally } from "bundle/textdao/functions/Tally.sol";
import { Execute } from "bundle/textdao/functions/Execute.sol";
import { MemberJoinProtected } from "bundle/textdao/functions/protected/MemberJoinProtected.sol";
import { SetConfigsProtected } from "bundle/textdao/functions/protected/SetConfigsProtected.sol";
import { ConfigOverrideProtected } from "bundle/textdao/functions/protected/ConfigOverrideProtected.sol";
import { SaveTextProtected } from "bundle/textdao/functions/protected/SaveTextProtected.sol";
import { TextDAOFacade } from "bundle/textDAO/interfaces/TextDAOFacade.sol";
contract Deployment is MCScript {
function run() public startBroadcastWith("DEPLOYER_PRIV_KEY") {
vm.deal(deployer, 100 ether);
address voteAddr = address(new Vote());
mc.init("textdao");
mc.use("Clone", Clone.clone.selector, address(new Clone()));
mc.use("Initialize", Initialize.initialize.selector, address(new Initialize()));
mc.use("Propose", Propose.propose.selector, address(new Propose()));
mc.use("Fork", Fork.fork.selector, address(new Fork()));
mc.use("VoteHeaders", Vote.voteHeaders.selector, voteAddr);
mc.use("VoteCmds", Vote.voteCmds.selector, voteAddr);
mc.use("Tally", Tally.tally.selector, address(new Tally()));
mc.use("Execute", Execute.execute.selector, address(new Execute()));
mc.use("MemberJoinProtected", MemberJoinProtected.memberJoin.selector, address(new MemberJoinProtected()));
mc.use("SetConfigsProtected", SetConfigsProtected.setProposalsConfig.selector, address(new SetConfigsProtected()));
mc.use("ConfigOverrideProtected", ConfigOverrideProtected.overrideProposalsConfig.selector, address(new ConfigOverrideProtected()));
mc.use("SaveTextProtected", SaveTextProtected.saveText.selector, address(new SaveTextProtected()));
mc.useFacade(address(new TextDAOFacade())); // for Etherscan proxy read/write
address textdao = mc.deploy().toProxyAddress();
bytes memory encodedData = abi.encodePacked("TEXT_DAO_ADDR=", vm.toString(address(textdao)));
vm.writeLine(
string(
abi.encodePacked(vm.projectRoot(), "/.env")
),
string(encodedData)
);
}
}