Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added public/legal/tosDao.pdf
Binary file not shown.
2 changes: 2 additions & 0 deletions src/constants/deployments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface Contracts {
wyUNA: string
lexCharter: string
orCharter: string
tosDao?: string
subgraph?: string
}

Expand Down Expand Up @@ -141,6 +142,7 @@ export const deployments: { [key: number]: Contracts } = {
wyUNA: '0x73Af00b92073D93b47e1077f796A3D6A12F63909',
lexCharter: '0xa958f8D815a037E8eDe8194DAD70f9A3f3f94041',
orCharter: '0x5228eBc680BA2Ac70A8dB9FBF01CEAaC9Dd9b2Ea',
tosDao: '0x5228eBc680BA2Ac70A8dB9FBF01CEAaC9Dd9b2Ea',
subgraph: 'https://api.thegraph.com/subgraphs/name/nerderlyne/wrappr-goerli',
},
// Q Testnet
Expand Down
39 changes: 28 additions & 11 deletions src/minter/Confirm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,22 @@ export default function Confirm({ store, setStore, setView }: Props) {
const { isConnected, address } = useAccount()
const { chain } = useNetwork()
const contractAddress = deployments[1][(store.juris + store.entity) as keyof typeof deployments[1]] as string
const termsAddress = deployments[5][store.juris as keyof typeof deployments[1]] as string

const { writeAsync } = useContractWrite({
mode: 'recklesslyUnprepared',
addressOrName: contractAddress,
contractInterface: WRAPPR,
functionName: 'mint',
})

const { writeAsync: writeAsync2 } = useContractWrite({
mode: 'recklesslyUnprepared',
addressOrName: termsAddress,
contractInterface: WRAPPR,
functionName: 'mint',
})

const { writeAsync: writeAsyncQtest } = useContractWrite({
mode: 'recklesslyUnprepared',
addressOrName: deployments[35443][(store.juris + store.entity) as keyof typeof deployments[35443]] as string,
Expand Down Expand Up @@ -89,21 +98,21 @@ export default function Confirm({ store, setStore, setView }: Props) {
})
setLoading(false)
}

// creating agreement
let agreement = getAgreement(store.juris + store.entity)
let agreement
if (store.entity == 'Terms') {
agreement = getAgreement(store.juris)
} else {
agreement = getAgreement(store.juris + store.entity)
}

try {
setMessage({
text: 'Creating agreement...',
icon: <MdConstruction />,
})
const res = await createAgreement(
store.juris + store.entity,
store.name,
tokenId.toString(),
store.mission,
store.jurisdiction,
chain.id.toString(),
)
const res = await createAgreement(tokenId.toString(), chain.id.toString(), store)

if (typeof res === 'string') {
agreement = res
Expand Down Expand Up @@ -162,6 +171,10 @@ export default function Confirm({ store, setStore, setView }: Props) {
},
})
}
} else if (store.entity === 'Terms') {
res = await writeAsync2({
recklesslySetUnpreparedArgs: [address, tokenId, 1, ethers.constants.HashZero, tokenURI, address],
})
} else {
if (chain.id == 35443) {
res = await writeAsyncQtest({
Expand Down Expand Up @@ -230,7 +243,11 @@ export default function Confirm({ store, setStore, setView }: Props) {
<IconArrowLeft />
</Button>
</Stack>
<PDFViewer src={`/legal/${store.juris + store.entity}.pdf`} />
{store.entity == 'Terms' ? (
<PDFViewer src={`/legal/${store.juris}.pdf`} />
) : (
<PDFViewer src={`/legal/${store.juris + store.entity}.pdf`} />
)}
<Box
display="flex"
alignItems={'center'}
Expand All @@ -241,7 +258,7 @@ export default function Confirm({ store, setStore, setView }: Props) {
>
<Checkbox
variant="transparent"
label={<Text>I have read and accept the terms of this agreement.</Text>}
label={<Text>I have read and reviewed this agreement.</Text>}
onCheckedChange={() => setChecked(!checked)}
></Checkbox>
{isConnected ? (
Expand Down
9 changes: 9 additions & 0 deletions src/minter/choice/Entity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ export default function Entity({ choice, setChoice, setView }: Props) {
>
Charter
</Button>
<Button
tone="foreground"
suffix={<IconChevronRight />}
width="3/4"
justifyContent="space-between"
onClick={() => setEntity('Terms')}
>
Terms
</Button>
</Box>
</Box>
</Box>
Expand Down
46 changes: 44 additions & 2 deletions src/minter/choice/Juris.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ export default function Juris({ choice, setChoice, setView, setScreen }: Props)
'Your DAO Charter will be drafted after minting. This is a simple membership agreement signable with DAO vote or key-signature.',
link: 'https://docs.wrappr.wtf/how-to/charter/#%F0%9F%93%9C-dao-charter',
},
Terms: {
description: 'Terms selected will be drafted after minting.',
link: 'https://docs.wrappr.wtf/how-to/',
},
}

return (
Expand Down Expand Up @@ -92,11 +96,25 @@ export default function Juris({ choice, setChoice, setView, setScreen }: Props)
<IconArrowLeft />
</Box>
<Text size="headingOne" align="left" weight="semiBold" color="foreground">
Select Jurisdiction
{choice.entity.toLowerCase() !== 'terms' ? 'Select Jurisdiction' : 'Select Terms'}
</Text>
</Stack>
<Box className={styles.actionCards}>
{choice.entity.toLowerCase() !== 'charter'
{choice.entity.toLowerCase() == 'terms'
? terms.map(({ text, set }) => (
<Button
// size="small"
key={text}
tone="foreground"
suffix={<IconChevronRight />}
width="3/4"
justifyContent="space-between"
onClick={() => setJuris(set)}
>
{text}
</Button>
))
: choice.entity.toLowerCase() !== 'charter'
? entity.map(({ text, set }) => (
<Button
key={text}
Expand Down Expand Up @@ -161,3 +179,27 @@ const charter = [
learn: 'https://docs.wrappr.wtf/how-to/charter/#%F0%9F%8D%8A-orange-charter',
},
]

const terms = [
{
text: 'DAO Terms of Service',
icon: <span className="text-xl">🦍</span>,
description: 'Set basic terms for your organization as standardized by LexPunk Army',
set: 'tosDao',
learn: 'https://docs.wrappr.wtf/how-to/charter/#%F0%9F%A6%8D-lexpunk-dao-charter',
},
{
text: 'Privacy Policy',
icon: <span className="text-xl">🍊</span>,
description: 'Set basic terms for your organization as standardized by Orange DAO',
set: 'privacy',
learn: 'https://docs.wrappr.wtf/how-to/charter/#%F0%9F%8D%8A-orange-charter',
},
{
text: 'Website Terms of Service',
icon: <span className="text-xl">🍊</span>,
description: 'Set basic terms for your organization as standardized by Orange DAO',
set: 'tosWeb',
learn: 'https://docs.wrappr.wtf/how-to/charter/#%F0%9F%8D%8A-orange-charter',
},
]
151 changes: 151 additions & 0 deletions src/minter/form/TosDao.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
import { useForm } from 'react-hook-form'
import { zodResolver } from '@hookform/resolvers/zod'
import * as z from 'zod'
import { Box, Button, Input, Stack, Textarea, IconChevronRight } from '@kalidao/reality'
import { StoreT } from '../types'
import { useNetwork, useAccount } from 'wagmi'
import { useConnectModal } from '@rainbow-me/rainbowkit'
import { DateInput } from '@design/DateInput'
import { useState } from 'react'

type TosDao = {
date: string
dao_address: string
dao_name: string
entity_name: string
email: string
privacy_url: string
jurisdiction: string
}

const schema = z.object({
dao_address: z.string().min(1, { message: 'An address is required' }),
dao_name: z.string().min(1, { message: 'A name is required' }),
entity_name: z.string().min(1, { message: 'A mission is required' }),
email: z.string().min(1, { message: 'A mission is required' }),
privacy_url: z.string().min(1, { message: 'A mission is required' }),
jurisdiction: z.string().min(1, { message: 'A jurisdiction is required' }),
})

type Props = {
store: StoreT
setStore: React.Dispatch<React.SetStateAction<StoreT>>
setView: React.Dispatch<React.SetStateAction<number>>
}

export default function TosDao({ store, setStore, setView }: Props) {
const { address, isConnected, isConnecting, isDisconnected } = useAccount()
const { chain } = useNetwork()
const [date, setDate] = useState<string>('')
const { openConnectModal } = useConnectModal()
const {
register,
handleSubmit,
control,
formState: { errors, isSubmitting },
} = useForm<TosDao>({
resolver: zodResolver(schema),
})

console.log(store)
const handleDate = (e: React.ChangeEvent<HTMLInputElement>) => {
e.preventDefault()
let _date = e.target.value

_date = (Date.parse(_date) / 1000).toString()
setDate(_date)
}

const onSubmit = (data: TosDao) => {
const { dao_address, dao_name, entity_name, email, privacy_url, jurisdiction } = data

setStore({
...store,
date: date,
name: dao_name,
dao_address: dao_address,
entity_name: entity_name,
email: email,
privacy_url: privacy_url,
jurisdiction: jurisdiction,
})

setView(2)
}

return (
<Box as="form" onSubmit={handleSubmit(onSubmit)} className="flex-col space-y-4">
<Stack>
<Input
type="text"
{...register('dao_address')}
id="dao_address"
placeholder="0x0000000000000000000000000000000000000000"
required
label="DAO Address"
description=""
/>
<Input
type="text"
{...register('dao_name')}
id="dao_name"
placeholder=""
required
label="DAO Name"
description=""
/>
<Input
type="text"
{...register('entity_name')}
id="entity_name"
placeholder=""
required
label="Name of Legal Entity"
description=""
/>
<Input type="email" {...register('email')} id="email" placeholder=" " required label="Email" description="" />
<Input
type="text"
{...register('privacy_url')}
id="privacy_url"
placeholder=" "
required
label="Link to Privacy Policy"
description=""
/>
<Input
type="text"
{...register('jurisdiction')}
id="jurisdiction"
placeholder=" "
required
label="Jurisdiction"
description=""
/>
<DateInput label="Date" onChange={handleDate} />
{!isConnected && openConnectModal ? (
<Button
tone="foreground"
suffix={<IconChevronRight />}
width="full"
justifyContent="space-between"
onClick={openConnectModal}
>
Login
</Button>
) : (
<Button
tone="foreground"
suffix={<IconChevronRight />}
width="full"
justifyContent="space-between"
type="submit"
loading={isSubmitting}
>
Review Document
</Button>
)}
</Stack>
</Box>
)
}
29 changes: 28 additions & 1 deletion src/minter/form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,15 @@ interface Form {
}

export default function Form({ store, setStore, setView }: Props) {
const choice: string = store?.juris + store?.entity
let choice: string

if (store?.entity == 'Terms') {
choice = store?.juris
} else {
choice = store?.juris + store?.entity
}

console.log(choice)
const form: { [key: string]: Form } = {
deLLC: {
heading: 'Delaware LLC',
Expand Down Expand Up @@ -58,6 +65,25 @@ export default function Form({ store, setStore, setView }: Props) {
link: 'https://docs.wrappr.wtf/how-to/charter/#lexpunk-dao-charter',
component: <Charter store={store} setStore={setStore} setView={setView} />,
},
tosDao: {
heading: 'DAO Terms of Service',
description: 'A terms of service suitable for DAOs developing full-stack solution.',
link: 'https://docs.wrappr.wtf/how-to/charter/#lexpunk-dao-charter',
component: <TosDao store={store} setStore={setStore} setView={setView} />,
},
privacy: {
heading: 'Privacy Policy',
description: '.',
link: 'https://docs.wrappr.wtf/how-to/charter/#lexpunk-dao-charter',
component: <Charter store={store} setStore={setStore} setView={setView} />,
},
tosWeb: {
heading: 'Website Terms of Service',
description:
'A simple membership agreement for DAOs with emphasis on social structure and regular cadence. Based on Orange DAO.',
link: 'https://docs.wrappr.wtf/how-to/charter/#lexpunk-dao-charter',
component: <Charter store={store} setStore={setStore} setView={setView} />,
},
}

return (
Expand Down Expand Up @@ -108,3 +134,4 @@ export default function Form({ store, setStore, setView }: Props) {
import LLC from './LLC'
import Charter from './Charter'
import UNA from './UNA'
import TosDao from './TosDao'
5 changes: 5 additions & 0 deletions src/minter/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ export type StoreT = {
agreement: string
uri: string
txHash: string
date: string
dao_address: string
entity_name: string
email: string
privacy_url: string
}
Loading