-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8dfc127
Showing
21 changed files
with
8,437 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>DAOhaus React Vite Starter</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script> | ||
window.global = window; | ||
</script> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "daohaus-vite-starter", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"preview": "vite preview" | ||
}, | ||
"dependencies": { | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"@daohaus/ui": "0.0.25", | ||
"@daohaus/moloch-v3-data": "0.0.2", | ||
"@daohaus/moloch-v3-context": "0.0.1", | ||
"@daohaus/connect": "0.0.4", | ||
"@daohaus/tx-builder": "0.0.2", | ||
"@daohaus/form-builder": "0.0.2" | ||
|
||
}, | ||
"devDependencies": { | ||
"@types/react": "^18.0.22", | ||
"@types/react-dom": "^18.0.7", | ||
"@vitejs/plugin-react": "^2.2.0", | ||
"typescript": "^4.6.4", | ||
"vite": "^3.2.0" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#root { | ||
max-width: 1280px; | ||
margin: 0 auto; | ||
padding: 2rem; | ||
text-align: center; | ||
} | ||
|
||
.logo { | ||
height: 6em; | ||
padding: 1.5em; | ||
will-change: filter; | ||
} | ||
.logo:hover { | ||
filter: drop-shadow(0 0 2em #646cffaa); | ||
} | ||
.logo.react:hover { | ||
filter: drop-shadow(0 0 2em #61dafbaa); | ||
} | ||
|
||
@keyframes logo-spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
|
||
@media (prefers-reduced-motion: no-preference) { | ||
a:nth-of-type(2) .logo { | ||
animation: logo-spin infinite 20s linear; | ||
} | ||
} | ||
|
||
.card { | ||
padding: 2em; | ||
} | ||
|
||
.read-the-docs { | ||
color: #888; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { useState } from 'react'; | ||
|
||
function App() { | ||
return <div>shit</div>; | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Link } from '@daohaus/ui'; | ||
import { | ||
Routes as RoutesDom, | ||
Route, | ||
Outlet, | ||
useLocation, | ||
useParams, | ||
useNavigate, | ||
matchPath, | ||
} from 'react-router-dom'; | ||
import { DaoContainer } from './components/DaoContainer'; | ||
import { DaoScopedPage } from './pages/DaoScopedPage'; | ||
|
||
export const Routes = () => { | ||
return ( | ||
<RoutesDom> | ||
<Route | ||
path="/" | ||
element={ | ||
<Link href="molochv3/0x5/0x643e8e197de8760a23c64cf78bef7047084d5408"> | ||
DAO | ||
</Link> | ||
} | ||
/> | ||
<Route path="molochv3/:daochain/:daoid" element={<DaoContainer />}> | ||
<Route index element={<DaoScopedPage />} /> | ||
</Route> | ||
</RoutesDom> | ||
); | ||
}; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { LOCAL_ABI } from '@daohaus/abis'; | ||
import { ContractLego, CONTRACTS } from '@daohaus/utils'; | ||
|
||
export const CONTRACT: Record<string, ContractLego> = { | ||
POSTER: { | ||
type: 'static', | ||
contractName: 'Poster', | ||
abi: LOCAL_ABI.POSTER, | ||
targetAddress: { | ||
'0x1': '0x000000000000cd17345801aa8147b8d3950260ff', | ||
'0x5': '0x000000000000cd17345801aa8147b8d3950260ff', | ||
'0x64': '0x000000000000cd17345801aa8147b8d3950260ff', | ||
}, | ||
}, | ||
ERC_20: { | ||
type: 'static', | ||
contractName: 'ERC20', | ||
abi: LOCAL_ABI.ERC20, | ||
targetAddress: '.tokenAddress', | ||
}, | ||
ERC_20_FUNDING: { | ||
type: 'static', | ||
contractName: 'ERC20', | ||
abi: LOCAL_ABI.ERC20, | ||
targetAddress: '.formValues.paymentTokenAddress', | ||
}, | ||
CURRENT_DAO: { | ||
type: 'static', | ||
contractName: 'Current DAO (Baal)', | ||
abi: LOCAL_ABI.BAAL, | ||
targetAddress: '.daoId', | ||
}, | ||
TRIBUTE_MINION: { | ||
type: 'static', | ||
contractName: 'Tribute Minion', | ||
abi: LOCAL_ABI.TRIBUTE_MINION, | ||
targetAddress: CONTRACTS.TRIBUTE_MINION, | ||
}, | ||
SHARES_ERC20: { | ||
type: 'static', | ||
contractName: 'SHARES_ERC20', | ||
abi: LOCAL_ABI.SHARES, | ||
targetAddress: '.dao.sharesAddress', | ||
}, | ||
LOOT_ERC20: { | ||
type: 'static', | ||
contractName: 'LOOT_ERC20', | ||
abi: LOCAL_ABI.LOOT, | ||
targetAddress: '.dao.sharesAddress', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { FieldLego } from '@daohaus/form-builder'; | ||
|
||
export const FIELD: Record<string, FieldLego> = { | ||
TITLE: { | ||
id: 'title', | ||
type: 'input', | ||
label: 'Proposal Title', | ||
placeholder: 'Enter title', | ||
}, | ||
DESCRIPTION: { | ||
id: 'description', | ||
type: 'textarea', | ||
label: 'Description', | ||
placeholder: 'Enter description', | ||
}, | ||
LINK: { | ||
id: 'link', | ||
type: 'input', | ||
label: 'Link', | ||
placeholder: 'http://', | ||
expectType: 'url', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { FormLego } from '@daohaus/form-builder'; | ||
import { FIELD } from './fields'; | ||
import { TX } from './tx'; | ||
|
||
export const FORM: Record<string, FormLego> = { | ||
SIGNAL: { | ||
id: 'SIGNAL', | ||
title: 'Signal Form', | ||
subtitle: 'Signal Proposal', | ||
description: 'Ratify on-chain using a DAO proposal.', | ||
requiredFields: { title: true, description: true }, | ||
log: true, | ||
tx: TX.POST_SIGNAL, | ||
fields: [ | ||
FIELD.TITLE, | ||
FIELD.DESCRIPTION, | ||
FIELD.LINK, | ||
// ...PROPOSAL_SETTINGS_FIELDS, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { POSTER_TAGS } from '@daohaus/utils'; | ||
import { buildMultiCallTX } from '@daohaus/tx-builder'; | ||
import { CONTRACT } from './contract'; | ||
|
||
export enum ProposalTypeIds { | ||
Signal = 'SIGNAL', | ||
IssueSharesLoot = 'ISSUE', | ||
AddShaman = 'ADD_SHAMAN', | ||
TransferErc20 = 'TRANSFER_ERC20', | ||
TransferNetworkToken = 'TRANSFER_NETWORK_TOKEN', | ||
UpdateGovSettings = 'UPDATE_GOV_SETTINGS', | ||
UpdateTokenSettings = 'TOKEN_SETTINGS', | ||
TokensForShares = 'TOKENS_FOR_SHARES', | ||
GuildKick = 'GUILDKICK', | ||
WalletConnect = 'WALLETCONNECT', | ||
} | ||
|
||
export const TX = { | ||
POST_SIGNAL: buildMultiCallTX({ | ||
id: 'POST_SIGNAL', | ||
JSONDetails: { | ||
type: 'JSONDetails', | ||
jsonSchema: { | ||
title: `.formValues.title`, | ||
description: `.formValues.description`, | ||
contentURI: `.formValues.link`, | ||
contentURIType: { type: 'static', value: 'url' }, | ||
proposalType: { type: 'static', value: ProposalTypeIds.Signal }, | ||
}, | ||
}, | ||
actions: [ | ||
{ | ||
contract: CONTRACT.POSTER, | ||
method: 'post', | ||
args: [ | ||
{ | ||
type: 'JSONDetails', | ||
jsonSchema: { | ||
title: `.formValues.title`, | ||
description: `.formValues.description`, | ||
contentURI: `.formValues.link`, | ||
contentURIType: { type: 'static', value: 'url' }, | ||
proposalType: { type: 'static', value: ProposalTypeIds.Signal }, | ||
}, | ||
}, | ||
{ type: 'static', value: POSTER_TAGS.signalProposal }, | ||
], | ||
}, | ||
], | ||
}), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { | ||
Routes as RoutesDom, | ||
Route, | ||
Outlet, | ||
useLocation, | ||
useParams, | ||
useNavigate, | ||
matchPath, | ||
} from 'react-router-dom'; | ||
|
||
import { | ||
HausConnectProvider, | ||
HausLayout, | ||
useHausConnect, | ||
} from '@daohaus/connect'; | ||
import { useEffect, useLayoutEffect, useState } from 'react'; | ||
import { TXBuilder } from '@daohaus/tx-builder'; | ||
import { DaoContextProvider, useDao } from '@daohaus/moloch-v3-context'; | ||
|
||
export const DaoContainer = () => { | ||
const { daochain, daoid } = useParams(); | ||
const { address } = useHausConnect(); | ||
|
||
return ( | ||
<DaoContextProvider | ||
address={address} | ||
daoid={daoid} | ||
daochain={daochain} | ||
graphApiKeys={{ '0x1': import.meta.env['VITE_GRAPH_API_KEY_MAINNET'] }} | ||
> | ||
<Dao /> | ||
</DaoContextProvider> | ||
); | ||
}; | ||
|
||
export const Dao = () => { | ||
const location = useLocation(); | ||
const { provider } = useHausConnect(); | ||
const { dao } = useDao(); | ||
const { daochain, daoid } = useParams(); | ||
|
||
console.log('dao', dao); | ||
|
||
return ( | ||
<TXBuilder | ||
chainId={daochain} | ||
provider={provider} | ||
safeId={dao?.safeAddress} | ||
daoId={daoid} | ||
appState={{ dao }} | ||
> | ||
<HausLayout | ||
pathname={location.pathname} | ||
navLinks={[ | ||
{ label: 'Home', href: `/` }, | ||
{ label: 'DAO-Scoped', href: `/${daochain}/${daoid}` }, | ||
]} | ||
> | ||
<Outlet /> | ||
</HausLayout> | ||
</TXBuilder> | ||
); | ||
}; |
Oops, something went wrong.