From 98d50554349d513b1423cdfd0547fde13983ed9b Mon Sep 17 00:00:00 2001 From: Corantin Date: Wed, 18 Dec 2024 12:03:49 -0500 Subject: [PATCH] Have a way show archived pools --- .../[poolId]/[proposalId]/page.tsx | 165 +- .../[garden]/[community]/[poolId]/page.tsx | 22 +- .../[chain]/[garden]/[community]/page.tsx | 42 +- apps/web/components/PoolCard.tsx | 9 +- apps/web/components/PoolHeader.tsx | 12 +- apps/web/components/ProposalCard.tsx | 205 +- apps/web/components/Proposals.tsx | 95 +- pkg/subgraph/.graphclient/index.d.ts | 2 + pkg/subgraph/.graphclient/index.js | 1765 ++++++++--------- .../.graphclient/persisted_operations.json | 2 +- pkg/subgraph/.graphclientrc.yml | 2 +- pkg/subgraph/src/query/queries.graphql | 8 +- 12 files changed, 1155 insertions(+), 1174 deletions(-) diff --git a/apps/web/app/(app)/gardens/[chain]/[garden]/[community]/[poolId]/[proposalId]/page.tsx b/apps/web/app/(app)/gardens/[chain]/[garden]/[community]/[poolId]/[proposalId]/page.tsx index 3e314d1f4..d206bd594 100644 --- a/apps/web/app/(app)/gardens/[chain]/[garden]/[community]/[poolId]/[proposalId]/page.tsx +++ b/apps/web/app/(app)/gardens/[chain]/[garden]/[community]/[poolId]/[proposalId]/page.tsx @@ -23,6 +23,7 @@ import { Button, DisplayNumber, EthAddress, + InfoBox, Statistic, } from "@/components"; import CancelButton from "@/components/CancelButton"; @@ -39,7 +40,7 @@ import { useConvictionRead } from "@/hooks/useConvictionRead"; import { ConditionObject, useDisableButtons } from "@/hooks/useDisableButtons"; import { useMetadataIpfsFetch } from "@/hooks/useIpfsFetch"; import { useSubgraphQuery } from "@/hooks/useSubgraphQuery"; -import { alloABI, safeABI } from "@/src/generated"; +import { alloABI } from "@/src/generated"; import { PoolTypes, ProposalStatus } from "@/types"; import { useErrorDetails } from "@/utils/getErrorName"; @@ -257,13 +258,13 @@ export default function Page({ ); } - const handleRefreshConviction = async (e: React.MouseEvent) => { - e.preventDefault(); - e.stopPropagation(); - setConvictionRefreshing(true); - await triggerConvictionRefetch?.(); - setConvictionRefreshing(false); - }; + // const handleRefreshConviction = async (e: React.MouseEvent) => { + // e.preventDefault(); + // e.stopPropagation(); + // setConvictionRefreshing(true); + // await triggerConvictionRefetch?.(); + // setConvictionRefreshing(false); + // }; const status = ProposalStatus[proposalData.proposalStatus]; return ( @@ -327,81 +328,91 @@ export default function Page({
- {isProposerConnected && proposalStatus === "active" ? - - : - } + {proposalData.strategy.isEnabled && + (isProposerConnected && proposalStatus === "active" ? + + : )}
+ {!proposalData.strategy.isEnabled && ( + + The pool is not enabled. + + )} -
- {status && status !== "active" && status !== "disputed" ? -

- {status === "executed" ? - "Proposal passed and executed successfully!" - : `Proposal has been ${status}.`} -

- : <> -
-

Metrics

- -
-
- -
- {status === "active" && !isSignalingType && ( - - )} + {proposalData.strategy.isEnabled && ( +
+ {status && status !== "active" && status !== "disputed" ? +

+ {status === "executed" ? + "Proposal passed and executed successfully!" + : `Proposal has been ${status}.`} +

+ : <> +
+

Metrics

+
-
- - } -
+
+ +
+ {status === "active" && !isSignalingType && ( + + )} +
+
+ + } + + )} {filteredAndSortedProposalSupporters.length > 0 && ( )} -
- -
)} + {strategyObj.proposals.length && ( +
+ +
+ )} ); } diff --git a/apps/web/app/(app)/gardens/[chain]/[garden]/[community]/page.tsx b/apps/web/app/(app)/gardens/[chain]/[garden]/[community]/page.tsx index cbdab57ad..2b02a4e93 100644 --- a/apps/web/app/(app)/gardens/[chain]/[garden]/[community]/page.tsx +++ b/apps/web/app/(app)/gardens/[chain]/[garden]/[community]/page.tsx @@ -11,7 +11,7 @@ import { Dnum, multiply } from "dnum"; import Image from "next/image"; import Link from "next/link"; import { Address } from "viem"; -import { useAccount, useToken } from "wagmi"; +import { useAccount, useContractRead, useToken } from "wagmi"; import { getCommunityDocument, getCommunityQuery, @@ -38,6 +38,7 @@ import { QUERY_PARAMS } from "@/constants/query-params"; import { useCollectQueryParams } from "@/contexts/collectQueryParams.context"; import { useDisableButtons } from "@/hooks/useDisableButtons"; import { useSubgraphQuery } from "@/hooks/useSubgraphQuery"; +import { safeABI } from "@/src/generated"; import { PoolTypes } from "@/types"; import { fetchIpfs } from "@/utils/ipfsUtils"; import { @@ -68,6 +69,7 @@ export default function Page({ variables: { communityAddr: communityAddr.toLowerCase(), tokenAddr: tokenAddr.toLowerCase(), + showArchived: true, }, changeScope: [ { topic: "community", id: communityAddr }, @@ -76,6 +78,18 @@ export default function Page({ }); const registryCommunity = result?.registryCommunity; + const { data: isCouncilMember } = useContractRead({ + address: registryCommunity?.councilSafe as Address, + abi: safeABI, + functionName: "isOwner", + chainId: Number(chain), + enabled: !!accountAddress, + args: [accountAddress as Address], + onError: () => { + console.error("Error reading isOwner from Coucil Safe"); + }, + }); + let { communityName, members, @@ -144,7 +158,11 @@ export default function Page({ ); const activePools = strategies?.filter((strategy) => strategy?.isEnabled); - const poolsInReview = strategies.filter((strategy) => !strategy.isEnabled); + const poolsInReview = strategies.filter( + (strategy) => !strategy.isEnabled && !strategy.archived, + ); + + const poolsArchived = strategies.filter((strategy) => strategy.archived); // const [tokenDataArray, setTokenDataArray] = useState([]); @@ -376,6 +394,26 @@ export default function Page({ ))} + {(!!isCouncilMember || + accountAddress?.toLowerCase() === + registryCommunity.councilSafe?.toLowerCase() || + localStorage.getItem("showArchived") === "true") && ( +
+

+ Pools archived ({poolsArchived.length}) +

+
+ {poolsArchived.map((pool) => ( + + ))} +
+
+ )}

Covenant

diff --git a/apps/web/components/PoolCard.tsx b/apps/web/components/PoolCard.tsx index 685a3a35f..0fefa34f6 100644 --- a/apps/web/components/PoolCard.tsx +++ b/apps/web/components/PoolCard.tsx @@ -1,6 +1,7 @@ "use client"; import { + ArchiveBoxIcon, BoltIcon, ClockIcon, CurrencyDollarIcon, @@ -28,7 +29,7 @@ type Props = { token: string; pool: Pick< CVStrategy, - "id" | "isEnabled" | "poolAmount" | "poolId" | "metadata" + "id" | "isEnabled" | "poolAmount" | "poolId" | "metadata" | "archived" > & { proposals: Pick[]; config: Pick; @@ -95,8 +96,10 @@ export function PoolCard({ pool, token, chainId }: Props) { {!isEnabled ?
- -
Waiting for approval
+ {pool.archived ? + + : } +
{pool.archived ? "Archived" : "Waiting for approval"}
: - -
Waiting for council approval
+ {isArchived ? + + : } +
+ {isArchived ? + "This pool has been archived" + : "Waiting for council approval"} +
: [0]["tokenData"]; inputHandler: (proposalId: string, value: bigint) => void; }; @@ -60,6 +61,7 @@ export type ProposalCardProps = { export function ProposalCard({ proposalData, strategyConfig, + isPoolEnabled, inputData, stakedFilter, poolToken, @@ -194,118 +196,125 @@ export function ProposalCard({ /> )} - + {isPoolEnabled && ( + + )} {/* support description or slider */} -
-
- {isAllocationView ? -
-
-
- { - inputHandler( - proposalData.id, - BigInt(Math.floor(Number(e.target.value))), - ); - }} - disabled={isProposalEnded} - /> + {isPoolEnabled && ( +
+
+ {isAllocationView ? +
+
+
+ { + inputHandler( + proposalData.id, + BigInt(Math.floor(Number(e.target.value))), + ); + }} + disabled={isProposalEnded} + /> -
- {[...Array(21)].map((_, i) => ( - // eslint-disable-next-line react/no-array-index-key - - | - - ))} +
+ {[...Array(21)].map((_, i) => ( + // eslint-disable-next-line react/no-array-index-key + + | + + ))} +
-
- {isProposalEnded && inputData?.value != 0n && ( - - )} - {inputValue > 0 && ( -
- <> -
-
-

- - {poolWeightAllocatedInProposal} - - /{memberPoolWeight}%{" "} - - ({inputValue}% of your voting weight) - + {isProposalEnded && inputData?.value != 0n && ( + + )} + {inputValue > 0 && ( +

+ <> +
+
+

+ + {poolWeightAllocatedInProposal} + + /{memberPoolWeight}%{" "} + + ({inputValue}% of your voting weight) + +

+ {/*

Support

*/} +
+
+ +
+ )} +
+
+ :
+ {currentConvictionPct != null && + thresholdPct != null && + totalSupportPct != null && ( +
+
+
+

+ Total Support: {totalSupportPct}% of + pool weight.

- {/*

Support

*/}
+
- -
- )} -
-
- :
- {currentConvictionPct != null && - thresholdPct != null && - totalSupportPct != null && ( -
-
-
-

- Total Support: {totalSupportPct}% of - pool weight. -

+
+
- -
-
-
-
- )} -
- } + )} +
+ } +
-
+ )}
- {!isAllocationView && stakedFilter && stakedFilter?.value > 0 && ( -

- Your support: {poolWeightAllocatedInProposal}% -

- )} + {isPoolEnabled && + !isAllocationView && + stakedFilter && + stakedFilter?.value > 0 && ( +

+ Your support: {poolWeightAllocatedInProposal}% +

+ )} {/* TODO: fetch every member stake */} {/* {!isAllocationView &&

3 Supporters

} */} diff --git a/apps/web/components/Proposals.tsx b/apps/web/components/Proposals.tsx index 4d57995db..31b48fe36 100644 --- a/apps/web/components/Proposals.tsx +++ b/apps/web/components/Proposals.tsx @@ -71,7 +71,7 @@ type Stats = { interface ProposalsProps { strategy: Pick< CVStrategy, - "id" | "poolId" | "totalEffectiveActivePoints" | "sybilScorer" + "id" | "poolId" | "totalEffectiveActivePoints" | "sybilScorer" | "isEnabled" > & { registryCommunity: Pick & { garden: Pick; @@ -450,20 +450,23 @@ export function Proposals({ // Render return ( <> - + {strategy.isEnabled && ( + + )}

Proposals

{!!proposals && + strategy.isEnabled && (proposals.length === 0 ?

No submitted proposals to support

: !allocationView && ( @@ -517,6 +520,7 @@ export function Proposals({ alloInfo={alloInfo} inputHandler={inputHandler} tokenData={strategy.registryCommunity.garden} + isPoolEnabled={strategy.isEnabled} /> ))} @@ -552,6 +556,7 @@ export function Proposals({ alloInfo={alloInfo} inputHandler={inputHandler} tokenData={strategy.registryCommunity.garden} + isPoolEnabled={strategy.isEnabled} /> ))} @@ -561,41 +566,43 @@ export function Proposals({ : }
- {allocationView ? -
- - -
- :
-
- - - + {strategy.isEnabled && + (allocationView ? +
+ +
-
- } + :
+
+ + + +
+
)}
); diff --git a/pkg/subgraph/.graphclient/index.d.ts b/pkg/subgraph/.graphclient/index.d.ts index 8df9bbea3..b3304907a 100644 --- a/pkg/subgraph/.graphclient/index.d.ts +++ b/pkg/subgraph/.graphclient/index.d.ts @@ -3539,6 +3539,7 @@ export declare function getBuiltGraphSDK; }>, options?: TOperationContext): Promise; getCommunityCreationData(variables?: Exact<{ [key: string]: never; @@ -3688,6 +3689,7 @@ export type getGardenCommunitiesQuery = { export type getCommunityQueryVariables = Exact<{ communityAddr: Scalars['ID']['input']; tokenAddr: Scalars['ID']['input']; + showArchived?: InputMaybe; }>; export type getCommunityQuery = { registryCommunity?: Maybe<(Pick & { diff --git a/pkg/subgraph/.graphclient/index.js b/pkg/subgraph/.graphclient/index.js index be34218bd..6386d0e63 100644 --- a/pkg/subgraph/.graphclient/index.js +++ b/pkg/subgraph/.graphclient/index.js @@ -1,896 +1,821 @@ -import { gql } from "@graphql-mesh/utils"; -import { PubSub } from "@graphql-mesh/utils"; -import { DefaultLogger } from "@graphql-mesh/utils"; +import { gql } from '@graphql-mesh/utils'; +import { PubSub } from '@graphql-mesh/utils'; +import { DefaultLogger } from '@graphql-mesh/utils'; import MeshCache from "@graphql-mesh/cache-localforage"; -import { fetch as fetchFn } from "@whatwg-node/fetch"; +import { fetch as fetchFn } from '@whatwg-node/fetch'; import GraphqlHandler from "@graphql-mesh/graphql"; import BareMerger from "@graphql-mesh/merger-bare"; -import { printWithCache } from "@graphql-mesh/utils"; -import { usePersistedOperations } from "@graphql-yoga/plugin-persisted-operations"; -import { createMeshHTTPHandler } from "@graphql-mesh/http"; -import { getMesh } from "@graphql-mesh/runtime"; -import { MeshStore, FsStoreStorageAdapter } from "@graphql-mesh/store"; -import { path as pathModule } from "@graphql-mesh/cross-helpers"; +import { printWithCache } from '@graphql-mesh/utils'; +import { usePersistedOperations } from '@graphql-yoga/plugin-persisted-operations'; +import { createMeshHTTPHandler } from '@graphql-mesh/http'; +import { getMesh } from '@graphql-mesh/runtime'; +import { MeshStore, FsStoreStorageAdapter } from '@graphql-mesh/store'; +import { path as pathModule } from '@graphql-mesh/cross-helpers'; import * as importedModule$0 from "./sources/gv2/introspectionSchema.js"; -import { fileURLToPath } from "@graphql-mesh/utils"; -const baseDir = pathModule.join( - pathModule.dirname(fileURLToPath(import.meta.url)), - "..", -); +import { fileURLToPath } from '@graphql-mesh/utils'; +const baseDir = pathModule.join(pathModule.dirname(fileURLToPath(import.meta.url)), '..'); const importFn = (moduleId) => { - const relativeModuleId = ( - pathModule.isAbsolute(moduleId) - ? pathModule.relative(baseDir, moduleId) - : moduleId - ) - .split("\\") - .join("/") - .replace(baseDir + "/", ""); - switch (relativeModuleId) { - case ".graphclient/sources/gv2/introspectionSchema.js": - return Promise.resolve(importedModule$0); - default: - return Promise.reject( - new Error(`Cannot find module '${relativeModuleId}'.`), - ); - } + const relativeModuleId = (pathModule.isAbsolute(moduleId) ? pathModule.relative(baseDir, moduleId) : moduleId).split('\\').join('/').replace(baseDir + '/', ''); + switch (relativeModuleId) { + case ".graphclient/sources/gv2/introspectionSchema.js": + return Promise.resolve(importedModule$0); + default: + return Promise.reject(new Error(`Cannot find module '${relativeModuleId}'.`)); + } }; -const rootStore = new MeshStore( - ".graphclient", - new FsStoreStorageAdapter({ +const rootStore = new MeshStore('.graphclient', new FsStoreStorageAdapter({ cwd: baseDir, importFn, fileType: "js", - }), - { +}), { readonly: true, - validate: false, - }, -); + validate: false +}); export const rawServeConfig = undefined; export async function getMeshOptions() { - const pubsub = new PubSub(); - const sourcesStore = rootStore.child("sources"); - const logger = new DefaultLogger("GraphClient"); - const cache = new MeshCache({ - ...{}, - importFn, - store: rootStore.child("cache"), - pubsub, - logger, - }); - const sources = []; - const transforms = []; - const additionalEnvelopPlugins = []; - const gv2Transforms = []; - const additionalTypeDefs = []; - const gv2Handler = new GraphqlHandler({ - name: "gv2", - config: { - endpoint: - "https://api.studio.thegraph.com/query/40931/gardens-v2---arbitrum-sepolia/0.2.0", - }, - baseDir, - cache, - pubsub, - store: sourcesStore.child("gv2"), - logger: logger.child("gv2"), - importFn, - }); - sources[0] = { - name: "gv2", - handler: gv2Handler, - transforms: gv2Transforms, - }; - const additionalResolvers = []; - const merger = new BareMerger({ - cache, - pubsub, - logger: logger.child("bareMerger"), - store: rootStore.child("bareMerger"), - }); - const documentHashMap = { - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": - GetFactoriesDocument, - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": - GetTokenGardensDocument, - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": - GetMemberStrategyDocument, - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": - IsMemberDocument, - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": - GetMemberDocument, - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": - GetPoolCreationDataDocument, - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": - GetGardenCommunitiesDocument, - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": - GetCommunityDocument, - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": - GetCommunityCreationDataDocument, - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": - GetPoolDataDocument, - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": - GetProposalDataDocument, - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": - GetAlloDocument, - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": - GetStrategyByPoolDocument, - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": - GetTokenTitleDocument, - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": - GetCommunityTitlesDocument, - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": - GetPoolTitlesDocument, - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": - GetProposalTitlesDocument, - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": - GetPassportScorerDocument, - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": - GetPassportStrategyDocument, - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": - GetPassportUserDocument, - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": - GetProposalDisputesDocument, - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": - GetArbitrableConfigsDocument, - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": - GetMemberPassportAndCommunitiesDocument, - }; - additionalEnvelopPlugins.push( - usePersistedOperations({ - getPersistedOperation(key) { - return documentHashMap[key]; - }, - ...{}, - }), - ); - return { - sources, - transforms, - additionalTypeDefs, - additionalResolvers, - cache, - pubsub, - merger, - logger, - additionalEnvelopPlugins, - get documents() { - return [ - { - document: GetFactoriesDocument, - get rawSDL() { - return printWithCache(GetFactoriesDocument); - }, - location: "GetFactoriesDocument.graphql", - sha256Hash: - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa", - }, - { - document: GetTokenGardensDocument, - get rawSDL() { - return printWithCache(GetTokenGardensDocument); - }, - location: "GetTokenGardensDocument.graphql", - sha256Hash: - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa", - }, - { - document: GetMemberStrategyDocument, - get rawSDL() { - return printWithCache(GetMemberStrategyDocument); - }, - location: "GetMemberStrategyDocument.graphql", - sha256Hash: - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa", - }, - { - document: IsMemberDocument, - get rawSDL() { - return printWithCache(IsMemberDocument); - }, - location: "IsMemberDocument.graphql", - sha256Hash: - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa", - }, - { - document: GetMemberDocument, - get rawSDL() { - return printWithCache(GetMemberDocument); - }, - location: "GetMemberDocument.graphql", - sha256Hash: - "67f63761732b211149e54c0edb8712b2a2cddd1ab68a30429d5263de6b11e8ec", - }, - { - document: GetPoolCreationDataDocument, - get rawSDL() { - return printWithCache(GetPoolCreationDataDocument); - }, - location: "GetPoolCreationDataDocument.graphql", - sha256Hash: - "67f63761732b211149e54c0edb8712b2a2cddd1ab68a30429d5263de6b11e8ec", - }, - { - document: GetGardenCommunitiesDocument, - get rawSDL() { - return printWithCache(GetGardenCommunitiesDocument); - }, - location: "GetGardenCommunitiesDocument.graphql", - sha256Hash: - "67f63761732b211149e54c0edb8712b2a2cddd1ab68a30429d5263de6b11e8ec", - }, - { - document: GetCommunityDocument, - get rawSDL() { - return printWithCache(GetCommunityDocument); - }, - location: "GetCommunityDocument.graphql", - sha256Hash: - "67f63761732b211149e54c0edb8712b2a2cddd1ab68a30429d5263de6b11e8ec", - }, - { - document: GetCommunityCreationDataDocument, - get rawSDL() { - return printWithCache(GetCommunityCreationDataDocument); - }, - location: "GetCommunityCreationDataDocument.graphql", - sha256Hash: - "67f63761732b211149e54c0edb8712b2a2cddd1ab68a30429d5263de6b11e8ec", - }, - { - document: GetPoolDataDocument, - get rawSDL() { - return printWithCache(GetPoolDataDocument); - }, - location: "GetPoolDataDocument.graphql", - sha256Hash: - "67f63761732b211149e54c0edb8712b2a2cddd1ab68a30429d5263de6b11e8ec", - }, - { - document: GetProposalDataDocument, - get rawSDL() { - return printWithCache(GetProposalDataDocument); - }, - location: "GetProposalDataDocument.graphql", - sha256Hash: - "67f63761732b211149e54c0edb8712b2a2cddd1ab68a30429d5263de6b11e8ec", - }, - { - document: GetAlloDocument, - get rawSDL() { - return printWithCache(GetAlloDocument); - }, - location: "GetAlloDocument.graphql", - sha256Hash: - "67f63761732b211149e54c0edb8712b2a2cddd1ab68a30429d5263de6b11e8ec", - }, - { - document: GetStrategyByPoolDocument, - get rawSDL() { - return printWithCache(GetStrategyByPoolDocument); - }, - location: "GetStrategyByPoolDocument.graphql", - sha256Hash: - "67f63761732b211149e54c0edb8712b2a2cddd1ab68a30429d5263de6b11e8ec", - }, - { - document: GetTokenTitleDocument, - get rawSDL() { - return printWithCache(GetTokenTitleDocument); - }, - location: "GetTokenTitleDocument.graphql", - sha256Hash: - "67f63761732b211149e54c0edb8712b2a2cddd1ab68a30429d5263de6b11e8ec", - }, - { - document: GetCommunityTitlesDocument, - get rawSDL() { - return printWithCache(GetCommunityTitlesDocument); - }, - location: "GetCommunityTitlesDocument.graphql", - sha256Hash: - "67f63761732b211149e54c0edb8712b2a2cddd1ab68a30429d5263de6b11e8ec", - }, - { - document: GetPoolTitlesDocument, - get rawSDL() { - return printWithCache(GetPoolTitlesDocument); - }, - location: "GetPoolTitlesDocument.graphql", - sha256Hash: - "67f63761732b211149e54c0edb8712b2a2cddd1ab68a30429d5263de6b11e8ec", - }, - { - document: GetProposalTitlesDocument, - get rawSDL() { - return printWithCache(GetProposalTitlesDocument); - }, - location: "GetProposalTitlesDocument.graphql", - sha256Hash: - "67f63761732b211149e54c0edb8712b2a2cddd1ab68a30429d5263de6b11e8ec", - }, - { - document: GetPassportScorerDocument, - get rawSDL() { - return printWithCache(GetPassportScorerDocument); - }, - location: "GetPassportScorerDocument.graphql", - sha256Hash: - "67f63761732b211149e54c0edb8712b2a2cddd1ab68a30429d5263de6b11e8ec", - }, - { - document: GetPassportStrategyDocument, - get rawSDL() { - return printWithCache(GetPassportStrategyDocument); - }, - location: "GetPassportStrategyDocument.graphql", - sha256Hash: - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa", - }, - { - document: GetPassportUserDocument, - get rawSDL() { - return printWithCache(GetPassportUserDocument); - }, - location: "GetPassportUserDocument.graphql", - sha256Hash: - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa", - }, - { - document: GetProposalDisputesDocument, - get rawSDL() { - return printWithCache(GetProposalDisputesDocument); - }, - location: "GetProposalDisputesDocument.graphql", - sha256Hash: - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa", + const pubsub = new PubSub(); + const sourcesStore = rootStore.child('sources'); + const logger = new DefaultLogger("GraphClient"); + const cache = new MeshCache({ + ...{}, + importFn, + store: rootStore.child('cache'), + pubsub, + logger, + }); + const sources = []; + const transforms = []; + const additionalEnvelopPlugins = []; + const gv2Transforms = []; + const additionalTypeDefs = []; + const gv2Handler = new GraphqlHandler({ + name: "gv2", + config: { "endpoint": "https://api.studio.thegraph.com/query/70985/gardens-v2---arbitrum-sepolia/0.3.0" }, + baseDir, + cache, + pubsub, + store: sourcesStore.child("gv2"), + logger: logger.child("gv2"), + importFn, + }); + sources[0] = { + name: 'gv2', + handler: gv2Handler, + transforms: gv2Transforms + }; + const additionalResolvers = []; + const merger = new BareMerger({ + cache, + pubsub, + logger: logger.child('bareMerger'), + store: rootStore.child('bareMerger') + }); + const documentHashMap = { + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": GetFactoriesDocument, + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": GetTokenGardensDocument, + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": GetMemberStrategyDocument, + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": IsMemberDocument, + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": GetMemberDocument, + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": GetPoolCreationDataDocument, + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": GetProposalSupportersDocument, + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": GetGardenCommunitiesDocument, + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": GetCommunityDocument, + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": GetCommunityCreationDataDocument, + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": GetPoolDataDocument, + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": GetProposalDataDocument, + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": GetAlloDocument, + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": GetStrategyByPoolDocument, + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": GetTokenTitleDocument, + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": GetCommunityTitlesDocument, + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": GetPoolTitlesDocument, + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": GetProposalTitlesDocument, + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": GetPassportScorerDocument, + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": GetPassportStrategyDocument, + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": GetPassportUserDocument, + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": GetProposalDisputesDocument, + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": GetArbitrableConfigsDocument, + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": GetMemberPassportAndCommunitiesDocument + }; + additionalEnvelopPlugins.push(usePersistedOperations({ + getPersistedOperation(key) { + return documentHashMap[key]; }, - { - document: GetArbitrableConfigsDocument, - get rawSDL() { - return printWithCache(GetArbitrableConfigsDocument); - }, - location: "GetArbitrableConfigsDocument.graphql", - sha256Hash: - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa", + ...{} + })); + return { + sources, + transforms, + additionalTypeDefs, + additionalResolvers, + cache, + pubsub, + merger, + logger, + additionalEnvelopPlugins, + get documents() { + return [ + { + document: GetFactoriesDocument, + get rawSDL() { + return printWithCache(GetFactoriesDocument); + }, + location: 'GetFactoriesDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + }, { + document: GetTokenGardensDocument, + get rawSDL() { + return printWithCache(GetTokenGardensDocument); + }, + location: 'GetTokenGardensDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + }, { + document: GetMemberStrategyDocument, + get rawSDL() { + return printWithCache(GetMemberStrategyDocument); + }, + location: 'GetMemberStrategyDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + }, { + document: IsMemberDocument, + get rawSDL() { + return printWithCache(IsMemberDocument); + }, + location: 'IsMemberDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + }, { + document: GetMemberDocument, + get rawSDL() { + return printWithCache(GetMemberDocument); + }, + location: 'GetMemberDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + }, { + document: GetPoolCreationDataDocument, + get rawSDL() { + return printWithCache(GetPoolCreationDataDocument); + }, + location: 'GetPoolCreationDataDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + }, { + document: GetProposalSupportersDocument, + get rawSDL() { + return printWithCache(GetProposalSupportersDocument); + }, + location: 'GetProposalSupportersDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + }, { + document: GetGardenCommunitiesDocument, + get rawSDL() { + return printWithCache(GetGardenCommunitiesDocument); + }, + location: 'GetGardenCommunitiesDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + }, { + document: GetCommunityDocument, + get rawSDL() { + return printWithCache(GetCommunityDocument); + }, + location: 'GetCommunityDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + }, { + document: GetCommunityCreationDataDocument, + get rawSDL() { + return printWithCache(GetCommunityCreationDataDocument); + }, + location: 'GetCommunityCreationDataDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + }, { + document: GetPoolDataDocument, + get rawSDL() { + return printWithCache(GetPoolDataDocument); + }, + location: 'GetPoolDataDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + }, { + document: GetProposalDataDocument, + get rawSDL() { + return printWithCache(GetProposalDataDocument); + }, + location: 'GetProposalDataDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + }, { + document: GetAlloDocument, + get rawSDL() { + return printWithCache(GetAlloDocument); + }, + location: 'GetAlloDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + }, { + document: GetStrategyByPoolDocument, + get rawSDL() { + return printWithCache(GetStrategyByPoolDocument); + }, + location: 'GetStrategyByPoolDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + }, { + document: GetTokenTitleDocument, + get rawSDL() { + return printWithCache(GetTokenTitleDocument); + }, + location: 'GetTokenTitleDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + }, { + document: GetCommunityTitlesDocument, + get rawSDL() { + return printWithCache(GetCommunityTitlesDocument); + }, + location: 'GetCommunityTitlesDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + }, { + document: GetPoolTitlesDocument, + get rawSDL() { + return printWithCache(GetPoolTitlesDocument); + }, + location: 'GetPoolTitlesDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + }, { + document: GetProposalTitlesDocument, + get rawSDL() { + return printWithCache(GetProposalTitlesDocument); + }, + location: 'GetProposalTitlesDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + }, { + document: GetPassportScorerDocument, + get rawSDL() { + return printWithCache(GetPassportScorerDocument); + }, + location: 'GetPassportScorerDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + }, { + document: GetPassportStrategyDocument, + get rawSDL() { + return printWithCache(GetPassportStrategyDocument); + }, + location: 'GetPassportStrategyDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + }, { + document: GetPassportUserDocument, + get rawSDL() { + return printWithCache(GetPassportUserDocument); + }, + location: 'GetPassportUserDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + }, { + document: GetProposalDisputesDocument, + get rawSDL() { + return printWithCache(GetProposalDisputesDocument); + }, + location: 'GetProposalDisputesDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + }, { + document: GetArbitrableConfigsDocument, + get rawSDL() { + return printWithCache(GetArbitrableConfigsDocument); + }, + location: 'GetArbitrableConfigsDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + }, { + document: GetMemberPassportAndCommunitiesDocument, + get rawSDL() { + return printWithCache(GetMemberPassportAndCommunitiesDocument); + }, + location: 'GetMemberPassportAndCommunitiesDocument.graphql', + sha256Hash: '9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346' + } + ]; }, - { - document: GetMemberPassportAndCommunitiesDocument, - get rawSDL() { - return printWithCache(GetMemberPassportAndCommunitiesDocument); - }, - location: "GetMemberPassportAndCommunitiesDocument.graphql", - sha256Hash: - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa", - }, - ]; - }, - fetchFn, - }; + fetchFn, + }; } export function createBuiltMeshHTTPHandler() { - return createMeshHTTPHandler({ - baseDir, - getBuiltMesh: getBuiltGraphClient, - rawServeConfig: undefined, - }); + return createMeshHTTPHandler({ + baseDir, + getBuiltMesh: getBuiltGraphClient, + rawServeConfig: undefined, + }); } let meshInstance$; export const pollingInterval = null; export function getBuiltGraphClient() { - if (meshInstance$ == null) { - if (pollingInterval) { - setInterval(() => { - getMeshOptions() - .then((meshOptions) => getMesh(meshOptions)) - .then((newMesh) => - meshInstance$.then((oldMesh) => { - oldMesh.destroy(); - meshInstance$ = Promise.resolve(newMesh); - }), - ) - .catch((err) => { - console.error( - "Mesh polling failed so the existing version will be used:", - err, - ); - }); - }, pollingInterval); - } - meshInstance$ = getMeshOptions() - .then((meshOptions) => getMesh(meshOptions)) - .then((mesh) => { - const id = mesh.pubsub.subscribe("destroy", () => { - meshInstance$ = undefined; - mesh.pubsub.unsubscribe(id); + if (meshInstance$ == null) { + if (pollingInterval) { + setInterval(() => { + getMeshOptions() + .then(meshOptions => getMesh(meshOptions)) + .then(newMesh => meshInstance$.then(oldMesh => { + oldMesh.destroy(); + meshInstance$ = Promise.resolve(newMesh); + })).catch(err => { + console.error("Mesh polling failed so the existing version will be used:", err); + }); + }, pollingInterval); + } + meshInstance$ = getMeshOptions().then(meshOptions => getMesh(meshOptions)).then(mesh => { + const id = mesh.pubsub.subscribe('destroy', () => { + meshInstance$ = undefined; + mesh.pubsub.unsubscribe(id); + }); + return mesh; }); - return mesh; - }); - } - return meshInstance$; + } + return meshInstance$; } -export const execute = (...args) => - getBuiltGraphClient().then(({ execute }) => execute(...args)); -export const subscribe = (...args) => - getBuiltGraphClient().then(({ subscribe }) => subscribe(...args)); +export const execute = (...args) => getBuiltGraphClient().then(({ execute }) => execute(...args)); +export const subscribe = (...args) => getBuiltGraphClient().then(({ subscribe }) => subscribe(...args)); export function getBuiltGraphSDK(globalContext) { - const sdkRequester$ = getBuiltGraphClient().then(({ sdkRequesterFactory }) => - sdkRequesterFactory(globalContext), - ); - return getSdk((...args) => - sdkRequester$.then((sdkRequester) => sdkRequester(...args)), - ); + const sdkRequester$ = getBuiltGraphClient().then(({ sdkRequesterFactory }) => sdkRequesterFactory(globalContext)); + return getSdk((...args) => sdkRequester$.then(sdkRequester => sdkRequester(...args))); } -export const getFactoriesDocument = gql` - query getFactories { - registryFactories { +export const getFactoriesDocument = gql ` + query getFactories { + registryFactories { + id + registryCommunities { id - registryCommunities { + chainId + isValid + communityName + covenantIpfsHash + registerToken + alloAddress + members { + memberAddress + } + strategies { id - chainId - isValid - communityName - covenantIpfsHash - registerToken - alloAddress - members { - memberAddress - } - strategies { + poolId + isEnabled + config { id - poolId - isEnabled - config { - id - decay - maxRatio - weight - minThresholdPoints - } + decay + maxRatio + weight + minThresholdPoints } } } } -`; -export const getTokenGardensDocument = gql` - query getTokenGardens { - tokenGardens { +} + `; +export const getTokenGardensDocument = gql ` + query getTokenGardens { + tokenGardens { + id + chainId + name + symbol + decimals + totalBalance + communities { id chainId - name - symbol - decimals - totalBalance - communities { + covenantIpfsHash + communityFee + isValid + communityName + strategies { id - chainId - covenantIpfsHash - communityFee - isValid - communityName - strategies { - id - } - members { - id - memberAddress - } + } + members { + id + memberAddress } } } -`; -export const getMemberStrategyDocument = gql` - query getMemberStrategy($member_strategy: ID!) { - memberStrategy(id: $member_strategy) { +} + `; +export const getMemberStrategyDocument = gql ` + query getMemberStrategy($member_strategy: ID!) { + memberStrategy(id: $member_strategy) { + id + totalStakedPoints + activatedPoints + strategy { + id + } + member { id - totalStakedPoints - activatedPoints - strategy { - id - } - member { - id - } } } -`; -export const isMemberDocument = gql` - query isMember($me: ID!, $comm: String!) { - member(id: $me) { +} + `; +export const isMemberDocument = gql ` + query isMember($me: ID!, $comm: String!) { + member(id: $me) { + id + stakes { id - stakes { + amount + proposal { id - amount - proposal { + proposalNumber + stakedAmount + strategy { id - proposalNumber - stakedAmount - strategy { + poolId + registryCommunity { id - poolId - registryCommunity { + isValid + garden { id - isValid - garden { - id - symbol - decimals - } + symbol + decimals } } } } - memberCommunity(where: { registryCommunity_contains: $comm }) { - stakedTokens - isRegistered - registryCommunity { - id - } + } + memberCommunity(where: {registryCommunity_contains: $comm}) { + stakedTokens + isRegistered + registryCommunity { + id } } } -`; -export const getMemberDocument = gql` - query getMember($me: ID!) { - member(id: $me) { +} + `; +export const getMemberDocument = gql ` + query getMember($me: ID!) { + member(id: $me) { + id + memberCommunity { id - memberCommunity { + stakedTokens + isRegistered + registryCommunity { id - stakedTokens - isRegistered - registryCommunity { - id - isValid - } + isValid } - stakes { + } + stakes { + id + proposal { + proposalNumber id - proposal { - proposalNumber - id - } - amount - createdAt } + amount + createdAt } } -`; -export const getPoolCreationDataDocument = gql` - query getPoolCreationData($communityAddr: ID!, $tokenAddr: ID!) { - tokenGarden(id: $tokenAddr) { - decimals - id - symbol - } - allos { - id - } - registryCommunity(id: $communityAddr) { - communityName - isValid - } +} + `; +export const getPoolCreationDataDocument = gql ` + query getPoolCreationData($communityAddr: ID!, $tokenAddr: ID!) { + tokenGarden(id: $tokenAddr) { + decimals + id + symbol } -`; -export const getProposalSupportersDocument = gql` - query getProposalSupporters($proposalId: String!) { - members { - id - stakes(where: { proposal: $proposalId }) { - amount - proposal { - proposalNumber - id - } - } - } + allos { + id } -`; -export const getGardenCommunitiesDocument = gql` - query getGardenCommunities($chainId: BigInt!, $tokenGarden: ID!) { - registryCommunities( - where: { chainId: $chainId, garden_: { id: $tokenGarden } } - ) { - id - garden { - id - } - chainId - isValid - covenantIpfsHash - communityName - protocolFee - communityFee - registerToken - registerStakeAmount - alloAddress - members(where: { stakedTokens_gt: "0" }) { - id - memberAddress - } - strategies(where: { isEnabled: true }) { + registryCommunity(id: $communityAddr) { + communityName + isValid + } +} + `; +export const getProposalSupportersDocument = gql ` + query getProposalSupporters($proposalId: String!) { + members { + id + stakes(where: {proposal: $proposalId}) { + amount + proposal { + proposalNumber id - totalEffectiveActivePoints - poolId - poolAmount } } } -`; -export const getCommunityDocument = gql` - query getCommunity($communityAddr: ID!, $tokenAddr: ID!) { - registryCommunity(id: $communityAddr) { - communityName +} + `; +export const getGardenCommunitiesDocument = gql ` + query getGardenCommunities($chainId: BigInt!, $tokenGarden: ID!) { + registryCommunities(where: {chainId: $chainId, garden_: {id: $tokenGarden}}) { + id + garden { id - members(where: { stakedTokens_gt: "0" }) { - id - stakedTokens - } - strategies( - orderBy: poolId - orderDirection: desc - where: { archived: false } - ) { - id - proposals { - id - } - isEnabled - poolAmount - poolId - token - metadata - config { - proposalType - pointSystem - } - proposals { - id - } - } - covenantIpfsHash - communityFee - protocolFee - registerStakeAmount - registerToken } - tokenGarden(id: $tokenAddr) { - symbol - decimals + chainId + isValid + covenantIpfsHash + communityName + protocolFee + communityFee + registerToken + registerStakeAmount + alloAddress + members(where: {stakedTokens_gt: "0"}) { id + memberAddress } - } -`; -export const getCommunityCreationDataDocument = gql` - query getCommunityCreationData { - registryFactories { + strategies(where: {isEnabled: true}) { id + totalEffectiveActivePoints + poolId + poolAmount } } -`; -export const getPoolDataDocument = gql` - query getPoolData($garden: ID!, $poolId: BigInt!) { - allos { +} + `; +export const getCommunityDocument = gql ` + query getCommunity($communityAddr: ID!, $tokenAddr: ID!, $showArchived: Boolean) { + registryCommunity(id: $communityAddr) { + communityName + id + members(where: {stakedTokens_gt: "0"}) { id - chainId - tokenNative + stakedTokens } - tokenGarden(id: $garden) { - address - name - symbol - description - totalBalance - ipfsCovenant - decimals - } - cvstrategies(where: { poolId: $poolId }) { - token - poolAmount - metadata + strategies( + orderBy: poolId + orderDirection: desc + where: {archived: $showArchived} + ) { id - poolId - totalEffectiveActivePoints - isEnabled - maxCVSupply - archived - sybilScorer { - id - } - memberActive { + proposals { id } + isEnabled + poolAmount + poolId + token + metadata config { - id - weight - decay - maxAmount - maxRatio - minThresholdPoints - pointSystem proposalType - allowlist + pointSystem } - registryCommunity { + proposals { id - councilSafe - isValid - garden { - id - symbol - decimals - } } - proposals(orderBy: createdAt, orderDirection: desc) { - id - proposalNumber - metadata { - title - description - } - metadataHash - beneficiary - requestedAmount - requestedToken - proposalStatus - stakedAmount - convictionLast - createdAt - blockLast - threshold - strategy { - id - maxCVSupply - totalEffectiveActivePoints - } - } - } - arbitrableConfigs( - first: 1 - orderBy: version - orderDirection: desc - where: { strategy_: { poolId: $poolId } } - ) { - submitterCollateralAmount - challengerCollateralAmount - arbitrator - defaultRuling - defaultRulingTimeout - tribunalSafe } + covenantIpfsHash + communityFee + protocolFee + registerStakeAmount + registerToken } -`; -export const getProposalDataDocument = gql` - query getProposalData($garden: ID!, $proposalId: ID!, $communityId: ID!) { - allos { + tokenGarden(id: $tokenAddr) { + symbol + decimals + id + } +} + `; +export const getCommunityCreationDataDocument = gql ` + query getCommunityCreationData { + registryFactories { + id + } +} + `; +export const getPoolDataDocument = gql ` + query getPoolData($garden: ID!, $poolId: BigInt!) { + allos { + id + chainId + tokenNative + } + tokenGarden(id: $garden) { + address + name + symbol + description + totalBalance + ipfsCovenant + decimals + } + cvstrategies(where: {poolId: $poolId}) { + token + poolAmount + metadata + id + poolId + totalEffectiveActivePoints + isEnabled + maxCVSupply + archived + sybilScorer { id - chainId - tokenNative } - tokenGarden(id: $garden) { - name - symbol - decimals + memberActive { + id } - registryCommunity(id: $communityId) { + config { + id + weight + decay + maxAmount + maxRatio + minThresholdPoints + pointSystem + proposalType + allowlist + } + registryCommunity { + id councilSafe + isValid + garden { + id + symbol + decimals + } } - cvproposal(id: $proposalId) { + proposals(orderBy: createdAt, orderDirection: desc) { id proposalNumber - beneficiary - blockLast - convictionLast - createdAt metadata { title description } metadataHash - proposalStatus + beneficiary requestedAmount requestedToken + proposalStatus stakedAmount - submitter + convictionLast + createdAt + blockLast threshold - updatedAt - version strategy { id - token maxCVSupply totalEffectiveActivePoints - poolId - config { - proposalType - pointSystem - minThresholdPoints - decay - } - } - arbitrableConfig { - arbitrator - defaultRuling - defaultRulingTimeout - challengerCollateralAmount - submitterCollateralAmount - tribunalSafe } } } -`; -export const getAlloDocument = gql` - query getAllo { - allos { - id - chainId - tokenNative - } + arbitrableConfigs( + first: 1 + orderBy: version + orderDirection: desc + where: {strategy_: {poolId: $poolId}} + ) { + submitterCollateralAmount + challengerCollateralAmount + arbitrator + defaultRuling + defaultRulingTimeout + tribunalSafe } -`; -export const getStrategyByPoolDocument = gql` - query getStrategyByPool($poolId: BigInt!) { - cvstrategies(where: { poolId: $poolId }) { +} + `; +export const getProposalDataDocument = gql ` + query getProposalData($garden: ID!, $proposalId: ID!, $communityId: ID!) { + allos { + id + chainId + tokenNative + } + tokenGarden(id: $garden) { + name + symbol + decimals + } + registryCommunity(id: $communityId) { + councilSafe + } + cvproposal(id: $proposalId) { + id + proposalNumber + beneficiary + blockLast + convictionLast + createdAt + metadata { + title + description + } + metadataHash + proposalStatus + requestedAmount + requestedToken + stakedAmount + submitter + threshold + updatedAt + version + strategy { id - poolId + token + maxCVSupply totalEffectiveActivePoints - isEnabled - archived + poolId config { - id proposalType pointSystem minThresholdPoints + decay } - memberActive { - id - } - registryCommunity { + } + arbitrableConfig { + arbitrator + defaultRuling + defaultRulingTimeout + challengerCollateralAmount + submitterCollateralAmount + tribunalSafe + } + } +} + `; +export const getAlloDocument = gql ` + query getAllo { + allos { + id + chainId + tokenNative + } +} + `; +export const getStrategyByPoolDocument = gql ` + query getStrategyByPool($poolId: BigInt!) { + cvstrategies(where: {poolId: $poolId}) { + id + poolId + totalEffectiveActivePoints + isEnabled + archived + config { + id + proposalType + pointSystem + minThresholdPoints + } + memberActive { + id + } + registryCommunity { + id + isValid + garden { id - isValid - garden { - id - symbol - decimals - } + symbol + decimals } - proposals { - id - proposalNumber - metadata { - title - description - } - metadataHash - beneficiary - requestedAmount - requestedToken - proposalStatus - stakedAmount + } + proposals { + id + proposalNumber + metadata { + title + description } + metadataHash + beneficiary + requestedAmount + requestedToken + proposalStatus + stakedAmount } } -`; -export const getTokenTitleDocument = gql` - query getTokenTitle($tokenAddr: ID!) { - tokenGarden(id: $tokenAddr) { +} + `; +export const getTokenTitleDocument = gql ` + query getTokenTitle($tokenAddr: ID!) { + tokenGarden(id: $tokenAddr) { + name + } +} + `; +export const getCommunityTitlesDocument = gql ` + query getCommunityTitles($communityAddr: ID!) { + registryCommunity(id: $communityAddr) { + communityName + garden { name } } -`; -export const getCommunityTitlesDocument = gql` - query getCommunityTitles($communityAddr: ID!) { - registryCommunity(id: $communityAddr) { +} + `; +export const getPoolTitlesDocument = gql ` + query getPoolTitles($poolId: BigInt!) { + cvstrategies(where: {poolId: $poolId}) { + poolId + metadata + registryCommunity { communityName garden { name } } + metadata } -`; -export const getPoolTitlesDocument = gql` - query getPoolTitles($poolId: BigInt!) { - cvstrategies(where: { poolId: $poolId }) { +} + `; +export const getProposalTitlesDocument = gql ` + query getProposalTitles($proposalId: ID!) { + cvproposal(id: $proposalId) { + proposalNumber + metadata { + title + description + } + metadataHash + strategy { poolId metadata registryCommunity { @@ -899,57 +824,15 @@ export const getPoolTitlesDocument = gql` name } } - metadata - } - } -`; -export const getProposalTitlesDocument = gql` - query getProposalTitles($proposalId: ID!) { - cvproposal(id: $proposalId) { - proposalNumber - metadata { - title - description - } - metadataHash - strategy { - poolId - metadata - registryCommunity { - communityName - garden { - name - } - } - } } } -`; -export const getPassportScorerDocument = gql` - query getPassportScorer($scorerId: ID!) { - passportScorer(id: $scorerId) { - id - strategies { - id - strategy { - id - } - threshold - councilSafe - active - } - users { - id - userAddress - score - lastUpdated - } - } - } -`; -export const getPassportStrategyDocument = gql` - query getPassportStrategy($strategyId: ID!) { - passportStrategy(id: $strategyId) { +} + `; +export const getPassportScorerDocument = gql ` + query getPassportScorer($scorerId: ID!) { + passportScorer(id: $scorerId) { + id + strategies { id strategy { id @@ -958,137 +841,153 @@ export const getPassportStrategyDocument = gql` councilSafe active } - } -`; -export const getPassportUserDocument = gql` - query getPassportUser($userId: ID!) { - passportUser(id: $userId) { + users { id userAddress score lastUpdated } } -`; -export const getProposalDisputesDocument = gql` - query getProposalDisputes($proposalId: ID!) { - proposalDisputes(where: { proposal_: { id: $proposalId } }) { +} + `; +export const getPassportStrategyDocument = gql ` + query getPassportStrategy($strategyId: ID!) { + passportStrategy(id: $strategyId) { + id + strategy { id - disputeId - status - challenger - context - metadata { - reason - } - createdAt - ruledAt - rulingOutcome } + threshold + councilSafe + active } -`; -export const getArbitrableConfigsDocument = gql` - query getArbitrableConfigs($strategyId: String!) { - arbitrableConfigs(where: { strategy: $strategyId }) { - arbitrator - challengerCollateralAmount - submitterCollateralAmount - tribunalSafe - defaultRuling - defaultRulingTimeout - } +} + `; +export const getPassportUserDocument = gql ` + query getPassportUser($userId: ID!) { + passportUser(id: $userId) { + id + userAddress + score + lastUpdated } -`; -export const getMemberPassportAndCommunitiesDocument = gql` - query getMemberPassportAndCommunities($memberId: ID!) { - member(id: $memberId) { - memberCommunity { - id - } - } - passportUser(id: $memberId) { - lastUpdated - score +} + `; +export const getProposalDisputesDocument = gql ` + query getProposalDisputes($proposalId: ID!) { + proposalDisputes(where: {proposal_: {id: $proposalId}}) { + id + disputeId + status + challenger + context + metadata { + reason + } + createdAt + ruledAt + rulingOutcome + } +} + `; +export const getArbitrableConfigsDocument = gql ` + query getArbitrableConfigs($strategyId: String!) { + arbitrableConfigs(where: {strategy: $strategyId}) { + arbitrator + challengerCollateralAmount + submitterCollateralAmount + tribunalSafe + defaultRuling + defaultRulingTimeout + } +} + `; +export const getMemberPassportAndCommunitiesDocument = gql ` + query getMemberPassportAndCommunities($memberId: ID!) { + member(id: $memberId) { + memberCommunity { + id } } -`; + passportUser(id: $memberId) { + lastUpdated + score + } +} + `; export function getSdk(requester) { - return { - getFactories(variables, options) { - return requester(getFactoriesDocument, variables, options); - }, - getTokenGardens(variables, options) { - return requester(getTokenGardensDocument, variables, options); - }, - getMemberStrategy(variables, options) { - return requester(getMemberStrategyDocument, variables, options); - }, - isMember(variables, options) { - return requester(isMemberDocument, variables, options); - }, - getMember(variables, options) { - return requester(getMemberDocument, variables, options); - }, - getPoolCreationData(variables, options) { - return requester(getPoolCreationDataDocument, variables, options); - }, - getProposalSupporters(variables, options) { - return requester(getProposalSupportersDocument, variables, options); - }, - getGardenCommunities(variables, options) { - return requester(getGardenCommunitiesDocument, variables, options); - }, - getCommunity(variables, options) { - return requester(getCommunityDocument, variables, options); - }, - getCommunityCreationData(variables, options) { - return requester(getCommunityCreationDataDocument, variables, options); - }, - getPoolData(variables, options) { - return requester(getPoolDataDocument, variables, options); - }, - getProposalData(variables, options) { - return requester(getProposalDataDocument, variables, options); - }, - getAllo(variables, options) { - return requester(getAlloDocument, variables, options); - }, - getStrategyByPool(variables, options) { - return requester(getStrategyByPoolDocument, variables, options); - }, - getTokenTitle(variables, options) { - return requester(getTokenTitleDocument, variables, options); - }, - getCommunityTitles(variables, options) { - return requester(getCommunityTitlesDocument, variables, options); - }, - getPoolTitles(variables, options) { - return requester(getPoolTitlesDocument, variables, options); - }, - getProposalTitles(variables, options) { - return requester(getProposalTitlesDocument, variables, options); - }, - getPassportScorer(variables, options) { - return requester(getPassportScorerDocument, variables, options); - }, - getPassportStrategy(variables, options) { - return requester(getPassportStrategyDocument, variables, options); - }, - getPassportUser(variables, options) { - return requester(getPassportUserDocument, variables, options); - }, - getProposalDisputes(variables, options) { - return requester(getProposalDisputesDocument, variables, options); - }, - getArbitrableConfigs(variables, options) { - return requester(getArbitrableConfigsDocument, variables, options); - }, - getMemberPassportAndCommunities(variables, options) { - return requester( - getMemberPassportAndCommunitiesDocument, - variables, - options, - ); - }, - }; + return { + getFactories(variables, options) { + return requester(getFactoriesDocument, variables, options); + }, + getTokenGardens(variables, options) { + return requester(getTokenGardensDocument, variables, options); + }, + getMemberStrategy(variables, options) { + return requester(getMemberStrategyDocument, variables, options); + }, + isMember(variables, options) { + return requester(isMemberDocument, variables, options); + }, + getMember(variables, options) { + return requester(getMemberDocument, variables, options); + }, + getPoolCreationData(variables, options) { + return requester(getPoolCreationDataDocument, variables, options); + }, + getProposalSupporters(variables, options) { + return requester(getProposalSupportersDocument, variables, options); + }, + getGardenCommunities(variables, options) { + return requester(getGardenCommunitiesDocument, variables, options); + }, + getCommunity(variables, options) { + return requester(getCommunityDocument, variables, options); + }, + getCommunityCreationData(variables, options) { + return requester(getCommunityCreationDataDocument, variables, options); + }, + getPoolData(variables, options) { + return requester(getPoolDataDocument, variables, options); + }, + getProposalData(variables, options) { + return requester(getProposalDataDocument, variables, options); + }, + getAllo(variables, options) { + return requester(getAlloDocument, variables, options); + }, + getStrategyByPool(variables, options) { + return requester(getStrategyByPoolDocument, variables, options); + }, + getTokenTitle(variables, options) { + return requester(getTokenTitleDocument, variables, options); + }, + getCommunityTitles(variables, options) { + return requester(getCommunityTitlesDocument, variables, options); + }, + getPoolTitles(variables, options) { + return requester(getPoolTitlesDocument, variables, options); + }, + getProposalTitles(variables, options) { + return requester(getProposalTitlesDocument, variables, options); + }, + getPassportScorer(variables, options) { + return requester(getPassportScorerDocument, variables, options); + }, + getPassportStrategy(variables, options) { + return requester(getPassportStrategyDocument, variables, options); + }, + getPassportUser(variables, options) { + return requester(getPassportUserDocument, variables, options); + }, + getProposalDisputes(variables, options) { + return requester(getProposalDisputesDocument, variables, options); + }, + getArbitrableConfigs(variables, options) { + return requester(getArbitrableConfigsDocument, variables, options); + }, + getMemberPassportAndCommunities(variables, options) { + return requester(getMemberPassportAndCommunitiesDocument, variables, options); + } + }; } diff --git a/pkg/subgraph/.graphclient/persisted_operations.json b/pkg/subgraph/.graphclient/persisted_operations.json index 48ae65257..49e948410 100644 --- a/pkg/subgraph/.graphclient/persisted_operations.json +++ b/pkg/subgraph/.graphclient/persisted_operations.json @@ -1,3 +1,3 @@ { - "67f63761732b211149e54c0edb8712b2a2cddd1ab68a30429d5263de6b11e8ec": "query getFactories {\n registryFactories {\n id\n registryCommunities {\n id\n chainId\n isValid\n communityName\n covenantIpfsHash\n registerToken\n alloAddress\n members {\n memberAddress\n }\n strategies {\n id\n poolId\n isEnabled\n config {\n id\n decay\n maxRatio\n weight\n minThresholdPoints\n }\n }\n }\n }\n}\n\nquery getTokenGardens {\n tokenGardens {\n id\n chainId\n name\n symbol\n decimals\n totalBalance\n communities {\n id\n chainId\n covenantIpfsHash\n communityFee\n isValid\n communityName\n strategies {\n id\n }\n members {\n id\n memberAddress\n }\n }\n }\n}\n\nquery getMemberStrategy($member_strategy: ID!) {\n memberStrategy(id: $member_strategy) {\n id\n totalStakedPoints\n activatedPoints\n strategy {\n id\n }\n member {\n id\n }\n }\n}\n\nquery isMember($me: ID!, $comm: String!) {\n member(id: $me) {\n id\n stakes {\n id\n amount\n proposal {\n id\n proposalNumber\n stakedAmount\n strategy {\n id\n poolId\n registryCommunity {\n id\n isValid\n garden {\n id\n symbol\n decimals\n }\n }\n }\n }\n }\n memberCommunity(where: {registryCommunity_contains: $comm}) {\n stakedTokens\n isRegistered\n registryCommunity {\n id\n }\n }\n }\n}\n\nquery getMember($me: ID!) {\n member(id: $me) {\n id\n memberCommunity {\n id\n stakedTokens\n isRegistered\n registryCommunity {\n id\n isValid\n }\n }\n stakes {\n id\n proposal {\n proposalNumber\n id\n }\n amount\n createdAt\n }\n }\n}\n\nquery getPoolCreationData($communityAddr: ID!, $tokenAddr: ID!) {\n tokenGarden(id: $tokenAddr) {\n decimals\n id\n symbol\n }\n allos {\n id\n }\n registryCommunity(id: $communityAddr) {\n communityName\n isValid\n }\n}\n\nquery getGardenCommunities($chainId: BigInt!, $tokenGarden: ID!) {\n registryCommunities(where: {chainId: $chainId, garden_: {id: $tokenGarden}}) {\n id\n garden {\n id\n }\n chainId\n isValid\n covenantIpfsHash\n communityName\n protocolFee\n communityFee\n registerToken\n registerStakeAmount\n alloAddress\n members(where: {stakedTokens_gt: \"0\"}) {\n id\n memberAddress\n }\n strategies(where: {isEnabled: true}) {\n id\n totalEffectiveActivePoints\n poolId\n poolAmount\n }\n }\n}\n\nquery getCommunity($communityAddr: ID!, $tokenAddr: ID!) {\n registryCommunity(id: $communityAddr) {\n communityName\n id\n members(where: {stakedTokens_gt: \"0\"}) {\n id\n stakedTokens\n }\n strategies(orderBy: poolId, orderDirection: desc, where: {archived: false}) {\n id\n proposals {\n id\n }\n isEnabled\n poolAmount\n poolId\n token\n metadata\n config {\n proposalType\n pointSystem\n }\n proposals {\n id\n }\n }\n covenantIpfsHash\n communityFee\n protocolFee\n registerStakeAmount\n registerToken\n }\n tokenGarden(id: $tokenAddr) {\n symbol\n decimals\n id\n }\n}\n\nquery getCommunityCreationData {\n registryFactories {\n id\n }\n}\n\nquery getPoolData($garden: ID!, $poolId: BigInt!) {\n allos {\n id\n chainId\n tokenNative\n }\n tokenGarden(id: $garden) {\n address\n name\n symbol\n description\n totalBalance\n ipfsCovenant\n decimals\n }\n cvstrategies(where: {poolId: $poolId}) {\n token\n poolAmount\n metadata\n id\n poolId\n totalEffectiveActivePoints\n isEnabled\n maxCVSupply\n archived\n sybilScorer {\n id\n }\n memberActive {\n id\n }\n config {\n id\n weight\n decay\n maxAmount\n maxRatio\n minThresholdPoints\n pointSystem\n proposalType\n allowlist\n }\n registryCommunity {\n id\n councilSafe\n isValid\n garden {\n id\n symbol\n decimals\n }\n }\n proposals(orderBy: createdAt, orderDirection: desc) {\n id\n proposalNumber\n metadata {\n title\n description\n }\n metadataHash\n beneficiary\n requestedAmount\n requestedToken\n proposalStatus\n stakedAmount\n convictionLast\n createdAt\n blockLast\n threshold\n strategy {\n id\n maxCVSupply\n totalEffectiveActivePoints\n }\n }\n }\n arbitrableConfigs(\n first: 1\n orderBy: version\n orderDirection: desc\n where: {strategy_: {poolId: $poolId}}\n ) {\n submitterCollateralAmount\n challengerCollateralAmount\n arbitrator\n defaultRuling\n defaultRulingTimeout\n tribunalSafe\n }\n}\n\nquery getProposalData($garden: ID!, $proposalId: ID!) {\n allos {\n id\n chainId\n tokenNative\n }\n tokenGarden(id: $garden) {\n name\n symbol\n decimals\n }\n cvproposal(id: $proposalId) {\n id\n proposalNumber\n beneficiary\n blockLast\n convictionLast\n createdAt\n metadata {\n title\n description\n }\n metadataHash\n proposalStatus\n requestedAmount\n requestedToken\n stakedAmount\n submitter\n threshold\n updatedAt\n version\n strategy {\n id\n token\n maxCVSupply\n totalEffectiveActivePoints\n poolId\n config {\n proposalType\n pointSystem\n minThresholdPoints\n decay\n }\n }\n arbitrableConfig {\n arbitrator\n defaultRuling\n defaultRulingTimeout\n challengerCollateralAmount\n submitterCollateralAmount\n tribunalSafe\n }\n }\n}\n\nquery getAllo {\n allos {\n id\n chainId\n tokenNative\n }\n}\n\nquery getStrategyByPool($poolId: BigInt!) {\n cvstrategies(where: {poolId: $poolId}) {\n id\n poolId\n totalEffectiveActivePoints\n isEnabled\n archived\n config {\n id\n proposalType\n pointSystem\n minThresholdPoints\n }\n memberActive {\n id\n }\n registryCommunity {\n id\n isValid\n garden {\n id\n symbol\n decimals\n }\n }\n proposals {\n id\n proposalNumber\n metadata {\n title\n description\n }\n metadataHash\n beneficiary\n requestedAmount\n requestedToken\n proposalStatus\n stakedAmount\n }\n }\n}\n\nquery getTokenTitle($tokenAddr: ID!) {\n tokenGarden(id: $tokenAddr) {\n name\n }\n}\n\nquery getCommunityTitles($communityAddr: ID!) {\n registryCommunity(id: $communityAddr) {\n communityName\n garden {\n name\n }\n }\n}\n\nquery getPoolTitles($poolId: BigInt!) {\n cvstrategies(where: {poolId: $poolId}) {\n poolId\n metadata\n registryCommunity {\n communityName\n garden {\n name\n }\n }\n metadata\n }\n}\n\nquery getProposalTitles($proposalId: ID!) {\n cvproposal(id: $proposalId) {\n proposalNumber\n metadata {\n title\n description\n }\n metadataHash\n strategy {\n poolId\n metadata\n registryCommunity {\n communityName\n garden {\n name\n }\n }\n }\n }\n}\n\nquery getPassportScorer($scorerId: ID!) {\n passportScorer(id: $scorerId) {\n id\n strategies {\n id\n strategy {\n id\n }\n threshold\n councilSafe\n active\n }\n users {\n id\n userAddress\n score\n lastUpdated\n }\n }\n}\n\nquery getPassportStrategy($strategyId: ID!) {\n passportStrategy(id: $strategyId) {\n id\n strategy {\n id\n }\n threshold\n councilSafe\n active\n }\n}\n\nquery getPassportUser($userId: ID!) {\n passportUser(id: $userId) {\n id\n userAddress\n score\n lastUpdated\n }\n}\n\nquery getProposalDisputes($proposalId: ID!) {\n proposalDisputes(where: {proposal_: {id: $proposalId}}) {\n id\n disputeId\n status\n challenger\n context\n metadata {\n reason\n }\n createdAt\n ruledAt\n rulingOutcome\n }\n}\n\nquery getArbitrableConfigs($strategyId: String!) {\n arbitrableConfigs(where: {strategy: $strategyId}) {\n arbitrator\n challengerCollateralAmount\n submitterCollateralAmount\n tribunalSafe\n defaultRuling\n defaultRulingTimeout\n }\n}\n\nquery getMemberPassportAndCommunities($memberId: ID!) {\n member(id: $memberId) {\n memberCommunity {\n id\n }\n }\n passportUser(id: $memberId) {\n lastUpdated\n score\n }\n}" + "9dc927413ef3462e5c58461381d9cf8abbc8f7001d19a55fcf23773554d84346": "query getFactories {\n registryFactories {\n id\n registryCommunities {\n id\n chainId\n isValid\n communityName\n covenantIpfsHash\n registerToken\n alloAddress\n members {\n memberAddress\n }\n strategies {\n id\n poolId\n isEnabled\n config {\n id\n decay\n maxRatio\n weight\n minThresholdPoints\n }\n }\n }\n }\n}\n\nquery getTokenGardens {\n tokenGardens {\n id\n chainId\n name\n symbol\n decimals\n totalBalance\n communities {\n id\n chainId\n covenantIpfsHash\n communityFee\n isValid\n communityName\n strategies {\n id\n }\n members {\n id\n memberAddress\n }\n }\n }\n}\n\nquery getMemberStrategy($member_strategy: ID!) {\n memberStrategy(id: $member_strategy) {\n id\n totalStakedPoints\n activatedPoints\n strategy {\n id\n }\n member {\n id\n }\n }\n}\n\nquery isMember($me: ID!, $comm: String!) {\n member(id: $me) {\n id\n stakes {\n id\n amount\n proposal {\n id\n proposalNumber\n stakedAmount\n strategy {\n id\n poolId\n registryCommunity {\n id\n isValid\n garden {\n id\n symbol\n decimals\n }\n }\n }\n }\n }\n memberCommunity(where: {registryCommunity_contains: $comm}) {\n stakedTokens\n isRegistered\n registryCommunity {\n id\n }\n }\n }\n}\n\nquery getMember($me: ID!) {\n member(id: $me) {\n id\n memberCommunity {\n id\n stakedTokens\n isRegistered\n registryCommunity {\n id\n isValid\n }\n }\n stakes {\n id\n proposal {\n proposalNumber\n id\n }\n amount\n createdAt\n }\n }\n}\n\nquery getPoolCreationData($communityAddr: ID!, $tokenAddr: ID!) {\n tokenGarden(id: $tokenAddr) {\n decimals\n id\n symbol\n }\n allos {\n id\n }\n registryCommunity(id: $communityAddr) {\n communityName\n isValid\n }\n}\n\nquery getProposalSupporters($proposalId: String!) {\n members {\n id\n stakes(where: {proposal: $proposalId}) {\n amount\n proposal {\n proposalNumber\n id\n }\n }\n }\n}\n\nquery getGardenCommunities($chainId: BigInt!, $tokenGarden: ID!) {\n registryCommunities(where: {chainId: $chainId, garden_: {id: $tokenGarden}}) {\n id\n garden {\n id\n }\n chainId\n isValid\n covenantIpfsHash\n communityName\n protocolFee\n communityFee\n registerToken\n registerStakeAmount\n alloAddress\n members(where: {stakedTokens_gt: \"0\"}) {\n id\n memberAddress\n }\n strategies(where: {isEnabled: true}) {\n id\n totalEffectiveActivePoints\n poolId\n poolAmount\n }\n }\n}\n\nquery getCommunity($communityAddr: ID!, $tokenAddr: ID!, $showArchived: Boolean) {\n registryCommunity(id: $communityAddr) {\n communityName\n id\n members(where: {stakedTokens_gt: \"0\"}) {\n id\n stakedTokens\n }\n strategies(\n orderBy: poolId\n orderDirection: desc\n where: {archived: $showArchived}\n ) {\n id\n proposals {\n id\n }\n isEnabled\n poolAmount\n poolId\n token\n metadata\n config {\n proposalType\n pointSystem\n }\n proposals {\n id\n }\n }\n covenantIpfsHash\n communityFee\n protocolFee\n registerStakeAmount\n registerToken\n }\n tokenGarden(id: $tokenAddr) {\n symbol\n decimals\n id\n }\n}\n\nquery getCommunityCreationData {\n registryFactories {\n id\n }\n}\n\nquery getPoolData($garden: ID!, $poolId: BigInt!) {\n allos {\n id\n chainId\n tokenNative\n }\n tokenGarden(id: $garden) {\n address\n name\n symbol\n description\n totalBalance\n ipfsCovenant\n decimals\n }\n cvstrategies(where: {poolId: $poolId}) {\n token\n poolAmount\n metadata\n id\n poolId\n totalEffectiveActivePoints\n isEnabled\n maxCVSupply\n archived\n sybilScorer {\n id\n }\n memberActive {\n id\n }\n config {\n id\n weight\n decay\n maxAmount\n maxRatio\n minThresholdPoints\n pointSystem\n proposalType\n allowlist\n }\n registryCommunity {\n id\n councilSafe\n isValid\n garden {\n id\n symbol\n decimals\n }\n }\n proposals(orderBy: createdAt, orderDirection: desc) {\n id\n proposalNumber\n metadata {\n title\n description\n }\n metadataHash\n beneficiary\n requestedAmount\n requestedToken\n proposalStatus\n stakedAmount\n convictionLast\n createdAt\n blockLast\n threshold\n strategy {\n id\n maxCVSupply\n totalEffectiveActivePoints\n }\n }\n }\n arbitrableConfigs(\n first: 1\n orderBy: version\n orderDirection: desc\n where: {strategy_: {poolId: $poolId}}\n ) {\n submitterCollateralAmount\n challengerCollateralAmount\n arbitrator\n defaultRuling\n defaultRulingTimeout\n tribunalSafe\n }\n}\n\nquery getProposalData($garden: ID!, $proposalId: ID!, $communityId: ID!) {\n allos {\n id\n chainId\n tokenNative\n }\n tokenGarden(id: $garden) {\n name\n symbol\n decimals\n }\n registryCommunity(id: $communityId) {\n councilSafe\n }\n cvproposal(id: $proposalId) {\n id\n proposalNumber\n beneficiary\n blockLast\n convictionLast\n createdAt\n metadata {\n title\n description\n }\n metadataHash\n proposalStatus\n requestedAmount\n requestedToken\n stakedAmount\n submitter\n threshold\n updatedAt\n version\n strategy {\n id\n token\n maxCVSupply\n totalEffectiveActivePoints\n poolId\n config {\n proposalType\n pointSystem\n minThresholdPoints\n decay\n }\n }\n arbitrableConfig {\n arbitrator\n defaultRuling\n defaultRulingTimeout\n challengerCollateralAmount\n submitterCollateralAmount\n tribunalSafe\n }\n }\n}\n\nquery getAllo {\n allos {\n id\n chainId\n tokenNative\n }\n}\n\nquery getStrategyByPool($poolId: BigInt!) {\n cvstrategies(where: {poolId: $poolId}) {\n id\n poolId\n totalEffectiveActivePoints\n isEnabled\n archived\n config {\n id\n proposalType\n pointSystem\n minThresholdPoints\n }\n memberActive {\n id\n }\n registryCommunity {\n id\n isValid\n garden {\n id\n symbol\n decimals\n }\n }\n proposals {\n id\n proposalNumber\n metadata {\n title\n description\n }\n metadataHash\n beneficiary\n requestedAmount\n requestedToken\n proposalStatus\n stakedAmount\n }\n }\n}\n\nquery getTokenTitle($tokenAddr: ID!) {\n tokenGarden(id: $tokenAddr) {\n name\n }\n}\n\nquery getCommunityTitles($communityAddr: ID!) {\n registryCommunity(id: $communityAddr) {\n communityName\n garden {\n name\n }\n }\n}\n\nquery getPoolTitles($poolId: BigInt!) {\n cvstrategies(where: {poolId: $poolId}) {\n poolId\n metadata\n registryCommunity {\n communityName\n garden {\n name\n }\n }\n metadata\n }\n}\n\nquery getProposalTitles($proposalId: ID!) {\n cvproposal(id: $proposalId) {\n proposalNumber\n metadata {\n title\n description\n }\n metadataHash\n strategy {\n poolId\n metadata\n registryCommunity {\n communityName\n garden {\n name\n }\n }\n }\n }\n}\n\nquery getPassportScorer($scorerId: ID!) {\n passportScorer(id: $scorerId) {\n id\n strategies {\n id\n strategy {\n id\n }\n threshold\n councilSafe\n active\n }\n users {\n id\n userAddress\n score\n lastUpdated\n }\n }\n}\n\nquery getPassportStrategy($strategyId: ID!) {\n passportStrategy(id: $strategyId) {\n id\n strategy {\n id\n }\n threshold\n councilSafe\n active\n }\n}\n\nquery getPassportUser($userId: ID!) {\n passportUser(id: $userId) {\n id\n userAddress\n score\n lastUpdated\n }\n}\n\nquery getProposalDisputes($proposalId: ID!) {\n proposalDisputes(where: {proposal_: {id: $proposalId}}) {\n id\n disputeId\n status\n challenger\n context\n metadata {\n reason\n }\n createdAt\n ruledAt\n rulingOutcome\n }\n}\n\nquery getArbitrableConfigs($strategyId: String!) {\n arbitrableConfigs(where: {strategy: $strategyId}) {\n arbitrator\n challengerCollateralAmount\n submitterCollateralAmount\n tribunalSafe\n defaultRuling\n defaultRulingTimeout\n }\n}\n\nquery getMemberPassportAndCommunities($memberId: ID!) {\n member(id: $memberId) {\n memberCommunity {\n id\n }\n }\n passportUser(id: $memberId) {\n lastUpdated\n score\n }\n}" } \ No newline at end of file diff --git a/pkg/subgraph/.graphclientrc.yml b/pkg/subgraph/.graphclientrc.yml index 50ee8dddc..6f0a94047 100644 --- a/pkg/subgraph/.graphclientrc.yml +++ b/pkg/subgraph/.graphclientrc.yml @@ -2,6 +2,6 @@ sources: - name: gv2 handler: graphql: - endpoint: https://api.studio.thegraph.com/query/70985/gardens-v2---arbitrum-sepolia/0.2.4 + endpoint: https://api.studio.thegraph.com/query/70985/gardens-v2---arbitrum-sepolia/0.3.0 documents: - ./src/query/queries.graphql diff --git a/pkg/subgraph/src/query/queries.graphql b/pkg/subgraph/src/query/queries.graphql index e33776a44..6f2808cd3 100644 --- a/pkg/subgraph/src/query/queries.graphql +++ b/pkg/subgraph/src/query/queries.graphql @@ -185,7 +185,11 @@ query getGardenCommunities($chainId: BigInt!, $tokenGarden: ID!) { } } -query getCommunity($communityAddr: ID!, $tokenAddr: ID!) { +query getCommunity( + $communityAddr: ID! + $tokenAddr: ID! + $showArchived: Boolean +) { registryCommunity(id: $communityAddr) { communityName id @@ -196,7 +200,7 @@ query getCommunity($communityAddr: ID!, $tokenAddr: ID!) { strategies( orderBy: poolId orderDirection: desc - where: { archived: false } + where: { archived: $showArchived } ) { id proposals {