From 49ad323f7f82213643eb3ed71c64867982f2e881 Mon Sep 17 00:00:00 2001 From: skuhlmann Date: Tue, 12 Mar 2024 10:27:03 -0600 Subject: [PATCH 1/7] example subgraph --- apps/moloch-v3-subgraph/schema.graphql | 2 ++ apps/moloch-v3-subgraph/src/baal-mapping.ts | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/apps/moloch-v3-subgraph/schema.graphql b/apps/moloch-v3-subgraph/schema.graphql index a178d4e0..3bc87d6a 100644 --- a/apps/moloch-v3-subgraph/schema.graphql +++ b/apps/moloch-v3-subgraph/schema.graphql @@ -199,6 +199,7 @@ type Proposal @entity { contentURIType: String "votes scoped to this proposal" votes: [Vote!] @derivedFrom(field: "proposal") + record: Record } type Vote @entity { @@ -230,6 +231,7 @@ type Record @entity { contentType: String! content: String! queryType: String + proposals: [Proposal!] @derivedFrom(field: "record") } type Member @entity { diff --git a/apps/moloch-v3-subgraph/src/baal-mapping.ts b/apps/moloch-v3-subgraph/src/baal-mapping.ts index c98596ad..429ceeee 100644 --- a/apps/moloch-v3-subgraph/src/baal-mapping.ts +++ b/apps/moloch-v3-subgraph/src/baal-mapping.ts @@ -259,6 +259,11 @@ export function handleSubmitProposal(event: SubmitProposal): void { if (contentURIType.error == 'none') { proposal.contentURIType = contentURIType.data; } + + const duceContentId = getStringFromJson(object, 'duceContentId'); + if (duceContentId.error == 'none') { + proposal.record = duceContentId.data; + } } proposal.save(); From e5a56d904c620161d3a2c4a80eff690f45ee1722 Mon Sep 17 00:00:00 2001 From: skuhlmann Date: Tue, 12 Mar 2024 10:40:07 -0600 Subject: [PATCH 2/7] comment out due to type issue --- apps/moloch-v3-subgraph/schema.graphql | 1 + apps/moloch-v3-subgraph/src/baal-mapping.ts | 2 +- apps/moloch-v3-subgraph/src/util/parser.ts | 6 ++++++ libs/moloch-v3-legos/src/tx.ts | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/moloch-v3-subgraph/schema.graphql b/apps/moloch-v3-subgraph/schema.graphql index 3bc87d6a..87a54f1d 100644 --- a/apps/moloch-v3-subgraph/schema.graphql +++ b/apps/moloch-v3-subgraph/schema.graphql @@ -232,6 +232,7 @@ type Record @entity { content: String! queryType: String proposals: [Proposal!] @derivedFrom(field: "record") + parentId: String } type Member @entity { diff --git a/apps/moloch-v3-subgraph/src/baal-mapping.ts b/apps/moloch-v3-subgraph/src/baal-mapping.ts index 429ceeee..cde68d4d 100644 --- a/apps/moloch-v3-subgraph/src/baal-mapping.ts +++ b/apps/moloch-v3-subgraph/src/baal-mapping.ts @@ -260,7 +260,7 @@ export function handleSubmitProposal(event: SubmitProposal): void { proposal.contentURIType = contentURIType.data; } - const duceContentId = getStringFromJson(object, 'duceContentId'); + const duceContentId = getStringFromJson(object, 'duceRecordId'); if (duceContentId.error == 'none') { proposal.record = duceContentId.data; } diff --git a/apps/moloch-v3-subgraph/src/util/parser.ts b/apps/moloch-v3-subgraph/src/util/parser.ts index 59398365..5ad2d34b 100644 --- a/apps/moloch-v3-subgraph/src/util/parser.ts +++ b/apps/moloch-v3-subgraph/src/util/parser.ts @@ -200,6 +200,12 @@ export function createDaoDatabaseRecord( entity.contentType = 'json'; entity.content = event.params.content; + // connect to parent record - for comments + const parentId = getStringFromJson(object, 'parentId'); + if (parentId.error == 'none') { + entity.parentId = parentId; + } + const table = getStringFromJson(object, 'table'); if (table.error != 'none') { return false; diff --git a/libs/moloch-v3-legos/src/tx.ts b/libs/moloch-v3-legos/src/tx.ts index eff1a954..bed766aa 100644 --- a/libs/moloch-v3-legos/src/tx.ts +++ b/libs/moloch-v3-legos/src/tx.ts @@ -267,6 +267,7 @@ export const TX: Record = { description: '.formValues.description', contentURI: `.formValues.link`, contentURIType: { type: 'static', value: 'url' }, + // duceRecordId: 'duceRecordId', proposalType: { type: 'static', value: ProposalTypeIds.TransferNetworkToken, From 8a9186e05d62f099976acc5c10eef64af55ce205 Mon Sep 17 00:00:00 2001 From: skuhlmann Date: Tue, 12 Mar 2024 11:05:26 -0600 Subject: [PATCH 3/7] deploy sepolia graph --- apps/moloch-v3-subgraph/src/baal-mapping.ts | 6 +-- apps/moloch-v3-subgraph/src/util/parser.ts | 2 +- apps/moloch-v3-subgraph/subgraph.yaml | 42 ++++++++++----------- libs/moloch-v3-legos/src/tx.ts | 2 +- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/apps/moloch-v3-subgraph/src/baal-mapping.ts b/apps/moloch-v3-subgraph/src/baal-mapping.ts index cde68d4d..99411d14 100644 --- a/apps/moloch-v3-subgraph/src/baal-mapping.ts +++ b/apps/moloch-v3-subgraph/src/baal-mapping.ts @@ -260,9 +260,9 @@ export function handleSubmitProposal(event: SubmitProposal): void { proposal.contentURIType = contentURIType.data; } - const duceContentId = getStringFromJson(object, 'duceRecordId'); - if (duceContentId.error == 'none') { - proposal.record = duceContentId.data; + const relatedRecordId = getStringFromJson(object, 'relatedRecordId'); + if (relatedRecordId.error == 'none') { + proposal.record = relatedRecordId.data; } } diff --git a/apps/moloch-v3-subgraph/src/util/parser.ts b/apps/moloch-v3-subgraph/src/util/parser.ts index 5ad2d34b..f2310e54 100644 --- a/apps/moloch-v3-subgraph/src/util/parser.ts +++ b/apps/moloch-v3-subgraph/src/util/parser.ts @@ -203,7 +203,7 @@ export function createDaoDatabaseRecord( // connect to parent record - for comments const parentId = getStringFromJson(object, 'parentId'); if (parentId.error == 'none') { - entity.parentId = parentId; + entity.parentId = parentId.data; } const table = getStringFromJson(object, 'table'); diff --git a/apps/moloch-v3-subgraph/subgraph.yaml b/apps/moloch-v3-subgraph/subgraph.yaml index bb3808b0..ee9e87e7 100644 --- a/apps/moloch-v3-subgraph/subgraph.yaml +++ b/apps/moloch-v3-subgraph/subgraph.yaml @@ -6,14 +6,14 @@ schema: dataSources: - kind: ethereum/contract name: BaalSummonerV2 - network: base + network: sepolia source: - address: '0x22e0382194AC1e9929E023bBC2fD2BA6b778E098' + address: '0xB2B3909661552942AE1115E9Fc99dF0BC93d71d0' abi: BaalSummonerV2 - startBlock: 7428979 + startBlock: 4816767 mapping: kind: ethereum/events - apiVersion: 0.0.5 + apiVersion: 0.0.6 language: wasm/assemblyscript entities: - Dao @@ -32,14 +32,14 @@ dataSources: file: ./src/baal-summoner-mapping.ts - kind: ethereum/contract name: VaultSummoner - network: base + network: sepolia source: - address: '0x2eF2fC8a18A914818169eFa183db480d31a90c5D' + address: '0x763f5c2E59f997A6cC48Bf1228aBf61325244702' abi: VaultSummoner - startBlock: 7428979 + startBlock: 4816767 mapping: kind: ethereum/events - apiVersion: 0.0.5 + apiVersion: 0.0.6 language: wasm/assemblyscript entities: - Dao @@ -54,14 +54,14 @@ dataSources: file: ./src/vault-summoner-mapping.ts - kind: ethereum/contract name: Poster - network: base + network: sepolia source: address: '0x000000000000cd17345801aa8147b8d3950260ff' abi: Poster - startBlock: 7428979 + startBlock: 4816767 mapping: kind: ethereum/events - apiVersion: 0.0.5 + apiVersion: 0.0.6 language: wasm/assemblyscript entities: - Post @@ -75,14 +75,14 @@ dataSources: file: ./src/poster-mapping.ts - kind: ethereum/contract name: TributeMinion - network: base + network: sepolia source: - address: '0x00768B047f73D88b6e9c14bcA97221d6E179d468' + address: '0xdb4D89F2199b9Cf451B7Ff4bdC94b1c96De4bdD0' abi: TributeMinion - startBlock: 7428979 + startBlock: 4816767 mapping: kind: ethereum/events - apiVersion: 0.0.5 + apiVersion: 0.0.6 language: wasm/assemblyscript entities: - Proposal @@ -100,12 +100,12 @@ dataSources: templates: - kind: ethereum/contract name: BaalTemplate - network: base + network: sepolia source: abi: Baal mapping: kind: ethereum/events - apiVersion: 0.0.5 + apiVersion: 0.0.6 language: wasm/assemblyscript file: ./src/baal-mapping.ts entities: @@ -149,12 +149,12 @@ templates: handler: handleLockManager - kind: ethereum/contract name: SharesTemplate - network: base + network: sepolia source: abi: Shares mapping: kind: ethereum/events - apiVersion: 0.0.5 + apiVersion: 0.0.6 language: wasm/assemblyscript file: ./src/token-mapping.ts entities: @@ -172,12 +172,12 @@ templates: handler: handleSharesTransfer - kind: ethereum/contract name: LootTemplate - network: base + network: sepolia source: abi: Loot mapping: kind: ethereum/events - apiVersion: 0.0.5 + apiVersion: 0.0.6 language: wasm/assemblyscript file: ./src/token-mapping.ts entities: diff --git a/libs/moloch-v3-legos/src/tx.ts b/libs/moloch-v3-legos/src/tx.ts index bed766aa..7bcb7b45 100644 --- a/libs/moloch-v3-legos/src/tx.ts +++ b/libs/moloch-v3-legos/src/tx.ts @@ -267,7 +267,7 @@ export const TX: Record = { description: '.formValues.description', contentURI: `.formValues.link`, contentURIType: { type: 'static', value: 'url' }, - // duceRecordId: 'duceRecordId', + // relatedRecordId: 'relatedRecordId', proposalType: { type: 'static', value: ProposalTypeIds.TransferNetworkToken, From 78e30902d7956abe3fb4ef04c6d7d716f62dcff7 Mon Sep 17 00:00:00 2001 From: skuhlmann Date: Sun, 31 Mar 2024 12:17:11 -0600 Subject: [PATCH 4/7] review proposal-record mappings --- apps/moloch-v3-subgraph/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/moloch-v3-subgraph/README.md b/apps/moloch-v3-subgraph/README.md index b3a41d2e..f0ad4c3f 100644 --- a/apps/moloch-v3-subgraph/README.md +++ b/apps/moloch-v3-subgraph/README.md @@ -36,7 +36,7 @@ To generate subgraph code, run the following command: `nx run moloch-v3-subgraph:graph-deploy --name=hausdao/daohaus-v3-optimism --network=optimism` `nx run moloch-v3-subgraph:graph-deploy --name=hausdao/daohaus-v3-arbitrum --network=arbitrum-one` `nx run moloch-v3-subgraph:graph-deploy --name=hausdao/daohaus-v3-polygon --network=matic` -`nx run moloch-v3-subgraph:graph-deploy --name=hausdao/daohaus-v3-sepolia --network=sepolia` +`nx run moloch-v3-subgraph:graph-deploy --name=hausdao/daohaus-v3-sepolia-2 --network=sepolia` ### mainnet and gnosis chain deployment to studio From cfa5f8795dbfc7ce025088c02ae3ebccbd05bffa Mon Sep 17 00:00:00 2001 From: skuhlmann Date: Sun, 31 Mar 2024 12:19:49 -0600 Subject: [PATCH 5/7] cleanup --- libs/moloch-v3-legos/src/tx.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/moloch-v3-legos/src/tx.ts b/libs/moloch-v3-legos/src/tx.ts index 7bcb7b45..eff1a954 100644 --- a/libs/moloch-v3-legos/src/tx.ts +++ b/libs/moloch-v3-legos/src/tx.ts @@ -267,7 +267,6 @@ export const TX: Record = { description: '.formValues.description', contentURI: `.formValues.link`, contentURIType: { type: 'static', value: 'url' }, - // relatedRecordId: 'relatedRecordId', proposalType: { type: 'static', value: ProposalTypeIds.TransferNetworkToken, From 4084b68d90e88c5d549ac7627aa6780fb782af4c Mon Sep 17 00:00:00 2001 From: vani11aa Date: Sat, 27 Apr 2024 16:28:41 -0400 Subject: [PATCH 6/7] fix link overflow --- .../src/components/ProposalCard/ProposalCardOverview.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/moloch-v3-macro-ui/src/components/ProposalCard/ProposalCardOverview.tsx b/libs/moloch-v3-macro-ui/src/components/ProposalCard/ProposalCardOverview.tsx index a114c000..db7053bd 100644 --- a/libs/moloch-v3-macro-ui/src/components/ProposalCard/ProposalCardOverview.tsx +++ b/libs/moloch-v3-macro-ui/src/components/ProposalCard/ProposalCardOverview.tsx @@ -35,6 +35,7 @@ const OverviewBox = styled.div<{ $allowLinks?: boolean }>` } .description { margin-bottom: auto; + word-break: break-word; } @media ${widthQuery.md} { .description { From cfd34f6b5f4dcedde41b6e7d7859f86ef59a2c24 Mon Sep 17 00:00:00 2001 From: skuhlmann Date: Thu, 2 May 2024 16:31:49 -0600 Subject: [PATCH 7/7] updates endpoints and api keys --- apps/admin/src/components/HomeDashboard.tsx | 6 ++---- apps/summon-safe/src/utils/graphql.ts | 7 ++----- libs/keychain-utils/src/endpoints.ts | 17 +++++++++++------ libs/moloch-v3-fields/src/utils/fieldHelpers.ts | 10 ++++++---- yarn.lock | 5 +++++ 5 files changed, 26 insertions(+), 19 deletions(-) diff --git a/apps/admin/src/components/HomeDashboard.tsx b/apps/admin/src/components/HomeDashboard.tsx index 5721ca3d..cbab545b 100644 --- a/apps/admin/src/components/HomeDashboard.tsx +++ b/apps/admin/src/components/HomeDashboard.tsx @@ -11,6 +11,7 @@ import { widthQuery, } from '@daohaus/ui'; import { + GRAPH_API_KEYS, HAUS_NETWORK_DATA, isValidNetwork, ValidNetwork, @@ -52,10 +53,7 @@ export const HomeDashboard = () => { daoFilter: { name_contains_nocase: debouncedSearchTerm }, memberFilter: getDelegateFilter(filterDelegate, address), ordering: SORT_FIELDS[sortBy].ordering, - graphApiKeys: { - '0x1': process.env['NX_GRAPH_API_KEY_MAINNET'], - '0x64': process.env['NX_GRAPH_API_KEY_MAINNET'], - }, + graphApiKeys: GRAPH_API_KEYS, }); if (query.data?.daos && shouldUpdate) { setDaoData(query.data.daos); diff --git a/apps/summon-safe/src/utils/graphql.ts b/apps/summon-safe/src/utils/graphql.ts index 483d8e64..4e170907 100644 --- a/apps/summon-safe/src/utils/graphql.ts +++ b/apps/summon-safe/src/utils/graphql.ts @@ -1,4 +1,4 @@ -import { ValidNetwork } from '@daohaus/keychain-utils'; +import { GRAPH_API_KEYS, ValidNetwork } from '@daohaus/keychain-utils'; import { listDaos } from '@daohaus/moloch-v3-data'; export const fetchDaos = async ( @@ -8,10 +8,7 @@ export const fetchDaos = async ( const query = await listDaos({ networkId, filter: { safeAddress }, - graphApiKeys: { - '0x1': process.env.NX_GRAPH_API_KEY_MAINNET, - '0x64': process.env.NX_GRAPH_API_KEY_MAINNET, - }, + graphApiKeys: GRAPH_API_KEYS, }); if (query.error) { console.error('An error has occurred', query.error); diff --git a/libs/keychain-utils/src/endpoints.ts b/libs/keychain-utils/src/endpoints.ts index 7209fa7d..e2d05a28 100644 --- a/libs/keychain-utils/src/endpoints.ts +++ b/libs/keychain-utils/src/endpoints.ts @@ -6,17 +6,17 @@ export const ENDPOINTS: KeychainList = { 'https://gateway.thegraph.com/api/[api-key]/subgraphs/id/GfHFdFmiSwW1PKtnDhhcxhArwtTjVuMnXxQ5XcETF1bP', '0x5': 'https://api.thegraph.com/subgraphs/name/hausdao/daohaus-v3-goerli', '0x64': - 'https://gateway.thegraph.com/api/[api-key]/subgraphs/id/5oXHJGgAWTSEXHK5FGf7mcxYtk6rSz7MJV5ccvGfoW6q', + 'https://gateway-arbitrum.network.thegraph.com/api/[api-key]/subgraphs/id/6x9FK3iuhVFaH9sZ39m8bKB5eckax8sjxooBPNKWWK8r', '0x89': - 'https://api.thegraph.com/subgraphs/name/hausdao/daohaus-v3-polygon', + 'https://gateway-arbitrum.network.thegraph.com/api/[api-key]/subgraphs/id/A4su27JYXR5TkPZmiFHzzqMJnmYttfU3FyrdNBDnnu8T', '0xa': - 'https://api.thegraph.com/subgraphs/name/hausdao/daohaus-v3-optimism', + 'https://gateway-arbitrum.network.thegraph.com/api/[api-key]/subgraphs/id/CgH5vtz9CJPdcSmD3XEh8fCVDjQjnRwrSawg71T1ySXW', '0xa4b1': - 'https://api.thegraph.com/subgraphs/name/hausdao/daohaus-v3-arbitrum', + 'https://gateway-arbitrum.network.thegraph.com/api/[api-key]/subgraphs/id/GPACxuMWrrPSEJpFqupnePJNMfuArpFabrXLnWvXU2bp', '0xaa36a7': - 'https://api.thegraph.com/subgraphs/name/hausdao/daohaus-v3-sepolia-2', + 'https://gateway-arbitrum.network.thegraph.com/api/[api-key]/subgraphs/id/3k93SNY5Y1r4YYWEuPY9mpCm2wnGoYDKRtk82QZJ3Kvw', '0x2105': - 'https://api.studio.thegraph.com/query/36740/daohaus-v3-base/version/latest', + 'https://gateway-arbitrum.network.thegraph.com/api/[api-key]/subgraphs/id/7yh4eHJ4qpHEiLPAk9BXhL5YgYrTrRE6gWy8x4oHyAqW', }, EXPLORER: { '0x1': 'https://etherscan.io', @@ -133,6 +133,11 @@ export const HAUS_RPC = { export const GRAPH_API_KEYS = { '0x1': process.env['NX_GRAPH_API_KEY_MAINNET'], '0x64': process.env['NX_GRAPH_API_KEY_MAINNET'], + '0xaa36a7': process.env['NX_GRAPH_API_KEY_MAINNET'], + '0x2105': process.env['NX_GRAPH_API_KEY_MAINNET'], + '0xa4b1': process.env['NX_GRAPH_API_KEY_MAINNET'], + '0x89': process.env['NX_GRAPH_API_KEY_MAINNET'], + '0xa': process.env['NX_GRAPH_API_KEY_MAINNET'], }; export type PinataApiKeys = { diff --git a/libs/moloch-v3-fields/src/utils/fieldHelpers.ts b/libs/moloch-v3-fields/src/utils/fieldHelpers.ts index 02706acb..b0331a87 100644 --- a/libs/moloch-v3-fields/src/utils/fieldHelpers.ts +++ b/libs/moloch-v3-fields/src/utils/fieldHelpers.ts @@ -1,4 +1,8 @@ -import { HAUS_NETWORK_DATA, ValidNetwork } from '@daohaus/keychain-utils'; +import { + GRAPH_API_KEYS, + HAUS_NETWORK_DATA, + ValidNetwork, +} from '@daohaus/keychain-utils'; import { findMember, FindMemberQuery, @@ -155,9 +159,7 @@ export const isActiveMember = async ({ networkId: daochain, dao: daoid, memberAddress: address.toLowerCase(), - graphApiKeys: { - '0x1': process.env['NX_GRAPH_API_KEY_MAINNET'], - }, + graphApiKeys: GRAPH_API_KEYS, }); if ( diff --git a/yarn.lock b/yarn.lock index 03c31834..7df920bd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10513,6 +10513,11 @@ dotenv@^16.0.0: resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.1.tgz#369034de7d7e5b120972693352a3bf112172cc3e" integrity sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ== +dotenv@^16.4.5: + version "16.4.5" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.5.tgz#cdd3b3b604cb327e286b4762e13502f717cb099f" + integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg== + dotenv@^8.0.0: version "8.6.0" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.6.0.tgz#061af664d19f7f4d8fc6e4ff9b584ce237adcb8b"