Skip to content

Commit d8c5ce6

Browse files
committed
call it Escrow Delegate
1 parent 76449e7 commit d8c5ce6

File tree

7 files changed

+35
-33
lines changed

7 files changed

+35
-33
lines changed

apps/web/src/data/contract/requests/getDAOAddresses.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { AddressType, CHAIN_ID } from 'src/typings'
55
import { unpackOptionalArray } from 'src/utils/helpers'
66

77
import { managerAbi } from '../abis'
8-
import { getDaoMultiSig } from './getDAOMultisig'
8+
import { getEscrowDelegate } from './getEscrowDelegate'
99

1010
const getDAOAddresses = async (chainId: CHAIN_ID, tokenAddress: AddressType) => {
1111
const addresses = await readContract({
@@ -18,7 +18,7 @@ const getDAOAddresses = async (chainId: CHAIN_ID, tokenAddress: AddressType) =>
1818

1919
const [metadata, auction, treasury, governor] = unpackOptionalArray(addresses, 4)
2020

21-
const multiSig = await getDaoMultiSig(treasury as AddressType, chainId)
21+
const escrowDelegate = await getEscrowDelegate(treasury as AddressType, chainId)
2222

2323
const hasMissingAddresses = Object.values(addresses).includes(NULL_ADDRESS)
2424
if (hasMissingAddresses) return null
@@ -29,7 +29,7 @@ const getDAOAddresses = async (chainId: CHAIN_ID, tokenAddress: AddressType) =>
2929
governor,
3030
metadata,
3131
treasury,
32-
multiSig,
32+
escrowDelegate,
3333
})
3434

3535
return {
@@ -38,7 +38,7 @@ const getDAOAddresses = async (chainId: CHAIN_ID, tokenAddress: AddressType) =>
3838
governor,
3939
metadata,
4040
treasury,
41-
multiSig,
41+
escrowDelegate,
4242
}
4343
}
4444

apps/web/src/data/contract/requests/getDAOMultisig.ts renamed to apps/web/src/data/contract/requests/getEscrowDelegate.ts

+15-16
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ interface DecodedData {
2424

2525
const ATTESTATION_SCHEMA_UID = `0x1289c5f988998891af7416d83820c40ba1c6f5ba31467f2e611172334dc53a0e`
2626
const SMART_INVOICE_MULTISIG = `0x503a5161D1c5D9d82BF35a4c80DA0C3Ad72d9244` // TODO: replace with actual multisig address
27-
const BUILDER_DAO_TREASURY= `0xcf325a4c78912216249b818521b0798a0f904c10`
27+
const BUILDER_DAO_TREASURY = `0xcf325a4c78912216249b818521b0798a0f904c10`
2828
const BUILDER_DAO_OPS_MULTISIG = `0x58eAEfBEd9EEFbC564E302D0AfAE0B113E42eAb3`
2929

3030
const ATTESTATION_URL: Record<CHAIN_ID, string> = {
@@ -39,7 +39,7 @@ const ATTESTATION_URL: Record<CHAIN_ID, string> = {
3939
[CHAIN_ID.FOUNDRY]: '',
4040
}
4141

42-
export async function getDaoMultiSig(
42+
export async function getEscrowDelegate(
4343
daoTreasuryAddress: string,
4444
chainId: CHAIN_ID
4545
): Promise<string | null> {
@@ -53,20 +53,19 @@ export async function getDaoMultiSig(
5353
return null
5454
}
5555

56-
const multiSigIssuerPriorityOrder = [
56+
const attestationIssuerPriorityOrder = [
5757
checksumAddress(daoTreasuryAddress),
5858
checksumAddress(BUILDER_DAO_TREASURY),
59-
checksumAddress(BUILDER_DAO_OPS_MULTISIG),
60-
checksumAddress(SMART_INVOICE_MULTISIG)
61-
];
62-
59+
checksumAddress(BUILDER_DAO_OPS_MULTISIG),
60+
checksumAddress(SMART_INVOICE_MULTISIG),
61+
]
6362

6463
const query = `
6564
query Attestations {
6665
attestations(
6766
where: {
6867
schemaId: { equals: "${ATTESTATION_SCHEMA_UID}" }
69-
attester: { in: ["${multiSigIssuerPriorityOrder.join('","')}"] }
68+
attester: { in: ["${attestationIssuerPriorityOrder.join('","')}"] }
7069
recipient: { equals: "${checksumAddress(daoTreasuryAddress)}" }
7170
}
7271
) {
@@ -77,7 +76,6 @@ export async function getDaoMultiSig(
7776
}
7877
`
7978

80-
8179
try {
8280
const response = await axios.post<AttestationResponse>(
8381
attestationUrl,
@@ -91,11 +89,10 @@ export async function getDaoMultiSig(
9189

9290
const attestations = response?.data?.data?.attestations
9391

94-
9592
// Sort attestations based on priority order
9693
const sortedAttestations = attestations.sort((a, b) => {
97-
const indexA = multiSigIssuerPriorityOrder.indexOf(a.attester as `0x${string}`)
98-
const indexB = multiSigIssuerPriorityOrder.indexOf(b.attester as `0x${string}`)
94+
const indexA = attestationIssuerPriorityOrder.indexOf(a.attester as `0x${string}`)
95+
const indexB = attestationIssuerPriorityOrder.indexOf(b.attester as `0x${string}`)
9996
return indexA - indexB
10097
})
10198

@@ -105,14 +102,16 @@ export async function getDaoMultiSig(
105102

106103
try {
107104
// Get the first attestation from priority
108-
const decodedData = JSON.parse(sortedAttestations[0].decodedDataJson) as DecodedData[]
105+
const decodedData = JSON.parse(
106+
sortedAttestations[0].decodedDataJson
107+
) as DecodedData[]
109108

110-
const multisigAddress = decodedData[0]?.value?.value
111-
if (!multisigAddress || !isAddress(multisigAddress)) {
109+
const escrowDelegateAddress = decodedData[0]?.value?.value
110+
if (!escrowDelegateAddress || !isAddress(escrowDelegateAddress)) {
112111
return null
113112
}
114113

115-
return multisigAddress
114+
return escrowDelegateAddress
116115
} catch (parseError) {
117116
console.error('Error parsing attestation data:', parseError)
118117
return null

apps/web/src/modules/create-proposal/components/TransactionForm/Escrow/EscrowForm.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const EscrowForm: React.FC<EscrowFormProps> = ({
120120

121121
const { formValues, setFormValues } = useEscrowFormStore()
122122
const {
123-
addresses: { multiSig, treasury },
123+
addresses: { escrowDelegate, treasury },
124124
} = useDaoStore()
125125

126126
const handleSubmit = useCallback(
@@ -157,7 +157,7 @@ const EscrowForm: React.FC<EscrowFormProps> = ({
157157
<Formik
158158
initialValues={{
159159
...formValues,
160-
clientAddress: multiSig || treasury || '',
160+
clientAddress: escrowDelegate || treasury || '',
161161
}}
162162
validationSchema={EscrowFormSchema}
163163
onSubmit={handleSubmit}
@@ -192,7 +192,7 @@ const EscrowForm: React.FC<EscrowFormProps> = ({
192192
'The wallet address to which funds will be released on milestone completions.'
193193
}
194194
/>
195-
{!multiSig && (
195+
{!escrowDelegate && (
196196
<SmartInput
197197
type={TEXT}
198198
formik={formik}

apps/web/src/modules/dao/components/SmartContracts.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ export const SmartContracts = () => {
8989
<ContractLink title="Governor" address={addresses.governor} />
9090
<ContractLink title="Treasury" address={addresses.treasury} />
9191
<ContractLink title="Metadata" address={addresses.metadata} />
92-
{addresses?.multiSig && (
93-
<ContractLink title="MultiSig" address={addresses.multiSig} />
92+
{addresses?.escrowDelegate && (
93+
<ContractLink title="Escrow Delegate" address={addresses.escrowDelegate} />
9494
)}
9595
</Flex>
9696
</Flex>

apps/web/src/modules/dao/stores/useDaoStore.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export interface DaoContractAddresses {
1616
auction?: AddressType
1717
treasury?: AddressType
1818
governor?: AddressType
19-
multiSig?: AddressType
19+
escrowDelegate?: AddressType
2020
}
2121

2222
export interface DaoContracts {
@@ -39,7 +39,7 @@ export const useDaoStore = create<DaoStoreProps>((set) => ({
3939
auction: undefined,
4040
treasury: undefined,
4141
governor: undefined,
42-
multiSig: undefined,
42+
escrowDelegate: undefined,
4343
},
4444
setAddresses: (addresses: DaoContractAddresses) => set({ addresses }),
4545
}))

apps/web/src/pages/dao/[network]/[token]/[tokenId].tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { CACHE_TIMES } from 'src/constants/cacheTimes'
1111
import { PUBLIC_ALL_CHAINS, PUBLIC_DEFAULT_CHAINS } from 'src/constants/defaultChains'
1212
import { CAST_ENABLED } from 'src/constants/farcasterEnabled'
1313
import { SUCCESS_MESSAGES } from 'src/constants/messages'
14-
import { getDaoMultiSig } from 'src/data/contract/requests/getDAOMultisig'
14+
import { getEscrowDelegate } from 'src/data/contract/requests/getEscrowDelegate'
1515
import { SDK } from 'src/data/subgraph/client'
1616
import { TokenWithDaoQuery } from 'src/data/subgraph/sdk.generated'
1717
import { useVotes } from 'src/hooks'
@@ -213,7 +213,7 @@ export const getServerSideProps: GetServerSideProps = async ({
213213
auctionAddress,
214214
} = token.dao
215215

216-
const multiSigAddress = (await getDaoMultiSig(
216+
const escrowDelegateAddress = (await getEscrowDelegate(
217217
treasuryAddress,
218218
chain.id
219219
)) as AddressType
@@ -224,7 +224,7 @@ export const getServerSideProps: GetServerSideProps = async ({
224224
treasury: treasuryAddress,
225225
governor: governorAddress,
226226
auction: auctionAddress,
227-
multiSig: multiSigAddress,
227+
escrowDelegate: escrowDelegateAddress,
228228
}
229229

230230
const daoOgMetadata: DaoOgMetadata = {

apps/web/src/pages/dao/[network]/[token]/vote/[id].tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Meta } from 'src/components/Meta'
1111
import { CACHE_TIMES } from 'src/constants/cacheTimes'
1212
import { PUBLIC_DEFAULT_CHAINS } from 'src/constants/defaultChains'
1313
import SWR_KEYS from 'src/constants/swrKeys'
14-
import { getDaoMultiSig } from 'src/data/contract/requests/getDAOMultisig'
14+
import { getEscrowDelegate } from 'src/data/contract/requests/getEscrowDelegate'
1515
import { SDK } from 'src/data/subgraph/client'
1616
import {
1717
formatAndFetchState,
@@ -212,7 +212,10 @@ export const getServerSideProps: GetServerSideProps = async ({ params, req, res
212212
auctionAddress,
213213
} = data.dao
214214

215-
const multiSigAddress = (await getDaoMultiSig(treasuryAddress, chain.id)) as AddressType
215+
const escrowDelegateAddress = (await getEscrowDelegate(
216+
treasuryAddress,
217+
chain.id
218+
)) as AddressType
216219

217220
const ogMetadata: ProposalOgMetadata = {
218221
proposal: {
@@ -233,7 +236,7 @@ export const getServerSideProps: GetServerSideProps = async ({ params, req, res
233236
governor: governorAddress,
234237
treasury: treasuryAddress,
235238
auction: auctionAddress,
236-
multiSig: multiSigAddress,
239+
escrowDelegate: escrowDelegateAddress,
237240
}
238241

239242
const ogImageURL = `${protocol}://${

0 commit comments

Comments
 (0)