-
Notifications
You must be signed in to change notification settings - Fork 2
/
MultisigAdmin.tsx
119 lines (114 loc) · 4.01 KB
/
MultisigAdmin.tsx
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import React, { useEffect, useState } from "react";
import Page from "../../layouts/Page";
import { Col, Row, Nav, Tab, Button, Container } from "react-bootstrap";
import { useHistory, useParams } from "react-router-dom";
import { useWorkhard } from "../../providers/WorkhardProvider";
import { prefix } from "../../utils/utils";
import { FatherSays } from "../../components/views/FatherSays";
import { SetEmission } from "../../components/contracts/vision-emitter/SetEmission";
import { MultisigProposal } from "./tabs/MultisigProposal";
import { getNetworkName } from "@workhard/protocol";
import { useWeb3React } from "@web3-react/core";
import { providers } from "ethers";
import { ProjectDetails } from "./tabs/ProjectDetails";
import { SerHelpPlz } from "../../components/views/HelpSer";
export const MultisigAdmin = () => {
const history = useHistory();
const { chainId } = useWeb3React<providers.Web3Provider>();
const { subtab } = useParams<{ subtab?: string }>();
const workhardCtx = useWorkhard();
const { daoId } = workhardCtx || { daoId: 0 };
const [tabKey, setTabKey] = useState<string>(subtab || "project-details");
const fetching = (
<Page>
<FatherSays say={`Loading...`} />
</Page>
);
const getGnosisLink = () => {
let hostname: string;
if (!chainId) return undefined;
if (getNetworkName(chainId) === "rinkeby") {
hostname = `rinkeby.gnosis-safe.io`;
} else if (getNetworkName(chainId) === "mainnet") {
hostname = `gnosis-safe.io`;
} else {
return undefined;
}
const multisig = workhardCtx?.dao.multisig.address;
return `https://${hostname}/app/#/safes/${multisig}/transactions`;
};
const fetched = (
<Page>
<Tab.Container activeKey={tabKey} onSelect={(k) => k && setTabKey(k)}>
<Row>
<Col sm={3}>
<Nav
variant="pills"
className="flex-column"
defaultActiveKey={"project-details"}
>
<Nav.Item>
<Nav.Link eventKey="project-details">Project details</Nav.Link>
</Nav.Item>
<Nav.Item>
<Nav.Link eventKey="emission">Emission setting</Nav.Link>
</Nav.Item>
<Nav.Item>
<Nav.Link eventKey="transaction">Multisig transaction</Nav.Link>
</Nav.Item>
</Nav>
<hr />
<Button
variant="outline-info"
as={"a"}
href={getGnosisLink()}
target="_blank"
>
Go to Gnosis Safe
</Button>
</Col>
<Col sm={9}>
<Tab.Content>
<Tab.Pane
eventKey="project-details"
onEnter={() => {
history.push(prefix(daoId, "/multisig/project-details"));
}}
>
<ProjectDetails />
</Tab.Pane>
<Tab.Pane
eventKey="emission"
onEnter={() => {
history.push(prefix(daoId, "/multisig/emission"));
}}
>
<SetEmission />
</Tab.Pane>
<Tab.Pane
eventKey="transaction"
onEnter={() => {
history.push(prefix(daoId, "/multisig/transaction"));
}}
>
<MultisigProposal />
</Tab.Pane>
</Tab.Content>
<hr />
<Container>
<SerHelpPlz>
<p>
Here, you are scheduling a governance transaction to the
timelock contract using Gnosis Multisig Wallet. Confirm the
scheduling on Gnosis and go to transaction tab in Gov menu.
You will be able to execute them after the timelock delay.
</p>
</SerHelpPlz>
</Container>
</Col>
</Row>
</Tab.Container>
</Page>
);
return !!workhardCtx ? fetched : fetching;
};