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 537b7589f..539fadbe0 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 @@ -25,6 +25,7 @@ import { EthAddress, InfoBox, Statistic, + DataTable, } from "@/components"; import CancelButton from "@/components/CancelButton"; import { ConvictionBarChart } from "@/components/Charts/ConvictionBarChart"; @@ -41,7 +42,7 @@ import { ConditionObject, useDisableButtons } from "@/hooks/useDisableButtons"; import { useMetadataIpfsFetch } from "@/hooks/useIpfsFetch"; import { useSubgraphQuery } from "@/hooks/useSubgraphQuery"; import { alloABI } from "@/src/generated"; -import { PoolTypes, ProposalStatus } from "@/types"; +import { PoolTypes, ProposalStatus, Column } from "@/types"; import { useErrorDetails } from "@/utils/getErrorName"; import { calculatePercentageBigInt } from "@/utils/numbers"; @@ -51,6 +52,7 @@ type ProposalSupporter = { id: string; stakes: { amount: number }[]; }; +type SupporterColumn = Column; export default function Page({ params: { proposalId, garden, community: communityAddr, poolId }, @@ -111,10 +113,14 @@ export default function Page({ const proposalData = data?.cvproposal; const proposalSupporters = supportersData?.members; - const filteredAndSortedProposalSupporters = + const filteredAndSortedProposalSupporters: ProposalSupporter[] = proposalSupporters ? proposalSupporters .filter((item) => item.stakes && item.stakes.length > 0) + .map((item) => ({ + id: item.id, + stakes: item.stakes?.map((stake) => ({ amount: stake.amount })) ?? [], + })) .sort((a, b) => { const maxStakeA = Math.max( ...(a.stakes ?? []).map((stake) => stake.amount), @@ -415,123 +421,77 @@ export default function Page({ )} {filteredAndSortedProposalSupporters.length > 0 && ( )} ); } -function ProposalSupportersTable({ - _proposalSupporters, - _totalActivePoints, - _totalStakedAmount, - _beneficiary, - _submitter, +const ProposalSupportersTable = ({ + supporters, + beneficiary, + submitter, + totalActivePoints, + totalStakedAmount, }: { - _proposalSupporters: ProposalSupporter[]; - _totalActivePoints: number; - _totalStakedAmount: number; - _beneficiary: string | undefined; - _submitter: string | undefined; -}) { + supporters: ProposalSupporter[]; + beneficiary: string | undefined; + submitter: string | undefined; + totalActivePoints: number; + totalStakedAmount: number; +}) => { + const columns: SupporterColumn[] = [ + { + header: supporters.length > 1 ? "Supporters" : "Supporter", + render: (supporter: ProposalSupporter) => ( + + ), + }, + { + header: "Role", + render: (supporter: ProposalSupporter) => + supporter.id === beneficiary ? "Beneficiary" + : supporter.id === submitter ? "Submitter" + : "Member", + }, + { + header: "Support", + render: (supporter: ProposalSupporter) => + totalActivePoints > 0 ? + `${calculatePercentageBigInt( + BigInt(supporter?.stakes[0]?.amount), + BigInt(totalActivePoints), + )} %` + : undefined, + className: "text-center", + }, + ]; + return ( -
-
-
-

Supported By

-

- A list of all the community members that are supporting this - proposal. + +

Total Support:

+

+ {totalStakedAmount} %

-
-
-
-
- - - - - - - - - - {_proposalSupporters.map((supporter: ProposalSupporter) => ( - - - {/* members role */} - - {/* members support */} - - - ))} - - - - - - - - -
-
- {_proposalSupporters.length > 1 ? - "Supporters" - : "Supporter"} -
-
-
Role
-
-
Support
-
-
-
- -
-
-
-

- {supporter.id === _beneficiary ? - "Beneficiary" - : supporter.id === _submitter ? - "Submitter" - : "Member"} -

-
-

- {(_totalActivePoints ?? 0) > 0 ? - calculatePercentageBigInt( - BigInt(supporter?.stakes[0]?.amount), - BigInt(_totalActivePoints ?? 0), - ) - : undefined}{" "} - % -

{" "} -
-

Total Support:

-
-

{_totalStakedAmount} %

-
-
-
-
-
+ } + /> ); -} +}; 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 ccb28ca82..d27254861 100644 --- a/apps/web/app/(app)/gardens/[chain]/[garden]/[community]/page.tsx +++ b/apps/web/app/(app)/gardens/[chain]/[garden]/[community]/page.tsx @@ -7,6 +7,8 @@ import { RectangleGroupIcon, UserGroupIcon, } from "@heroicons/react/24/outline"; + +import { FetchTokenResult } from "@wagmi/core"; import { Dnum, multiply } from "dnum"; import Image from "next/image"; import Link from "next/link"; @@ -28,6 +30,7 @@ import { RegisterMember, Statistic, InfoWrapper, + DataTable, } from "@/components"; import { LoadingSpinner } from "@/components/LoadingSpinner"; import MarkdownWrapper from "@/components/MarkdownWrapper"; @@ -39,7 +42,7 @@ 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 { PoolTypes, Column } from "@/types"; import { fetchIpfs } from "@/utils/ipfsUtils"; import { parseToken, @@ -47,6 +50,19 @@ import { SCALE_PRECISION_DECIMALS, } from "@/utils/numbers"; +type MembersStaked = { + memberAddress: string; + stakedTokens: string; +}; + +type CommunityMetricsProps = { + membersStaked: MembersStaked[] | undefined; + tokenGarden: FetchTokenResult; + communityStakedTokens: number | bigint; +}; + +type MemberColumn = Column; + export default function Page({ params: { chain, garden: tokenAddr, community: communityAddr }, }: { @@ -55,6 +71,8 @@ export default function Page({ const searchParams = useCollectQueryParams(); const { address: accountAddress } = useAccount(); const [covenant, setCovenant] = useState(); + const [openCommDetails, setOpenCommDetails] = useState(false); + const covenantSectionRef = useRef(null); const { data: tokenGarden } = useToken({ address: tokenAddr as Address, @@ -278,6 +296,13 @@ export default function Page({ height={180} width={180} /> +
@@ -330,7 +355,15 @@ export default function Page({ registryCommunity={registryCommunity} />
+ {openCommDetails && ( + + )} + ); } + +const CommunityDetailsTable = ({ + membersStaked, + tokenGarden, + communityStakedTokens, +}: CommunityMetricsProps) => { + const columns: MemberColumn[] = [ + { + header: `Members (${membersStaked?.length})`, + render: (memberData: MembersStaked) => ( + + ), + }, + { + header: "Staked tokens", + render: (memberData: MembersStaked) => ( + + ), + className: "flex justify-end", + }, + ]; + + return ( + +

Total Staked:

+ +
+ } + /> + ); +}; diff --git a/apps/web/components/DataTable.tsx b/apps/web/components/DataTable.tsx new file mode 100644 index 000000000..855cab2ca --- /dev/null +++ b/apps/web/components/DataTable.tsx @@ -0,0 +1,88 @@ +import React from "react"; + +interface DataTableProps { + title: string; + description?: string; + data: any[]; + columns: TableColumn[]; + footer?: React.ReactNode; + className?: string; +} + +interface TableColumn { + header: string | React.ReactNode; + render: (item: any) => React.ReactNode; + className?: string; +} + +export const DataTable: React.FC = ({ + title, + description, + data, + columns, + footer, + className = "", +}) => { + return ( +
+
+
+

{title}

+ {description && ( +

+ {description} +

+ )} +
+
+
+
+
+ + + + {columns.map((col) => ( + + ))} + + + + {data && + data.map((item) => ( + + {columns.map((col) => ( + + ))} + + ))} + + {footer && ( + + + + + + )} +
+
{col.header}
+
+

{col.render(item)}

+
+ {footer} +
+
+
+
+
+ ); +}; diff --git a/apps/web/components/PoolGovernance.tsx b/apps/web/components/PoolGovernance.tsx index 17fe7218d..384e7a62b 100644 --- a/apps/web/components/PoolGovernance.tsx +++ b/apps/web/components/PoolGovernance.tsx @@ -1,6 +1,6 @@ "use client"; -import React from "react"; +import React, { useState } from "react"; import { Dnum } from "dnum"; import { Address, useAccount } from "wagmi"; import { @@ -8,13 +8,19 @@ import { CVStrategyConfig, TokenGarden, } from "#/subgraph/.graphclient"; +import { MemberStrategyData } from "./Proposals"; import { ActivatePoints, Badge, DisplayNumber, CheckPassport, InfoBox, + Button, + EthAddress, + DataTable, } from "@/components/"; +import { Column } from "@/types"; +import { calculatePercentageBigInt } from "@/utils/numbers"; export type PoolGovernanceProps = { memberPoolWeight: number | undefined; @@ -27,6 +33,7 @@ export type PoolGovernanceProps = { memberTokensInCommunity: bigint; isMemberCommunity: boolean; memberActivatedStrategy: boolean; + membersStrategyData: any; }; export const PoolGovernance: React.FC = ({ @@ -37,9 +44,11 @@ export const PoolGovernance: React.FC = ({ memberTokensInCommunity, isMemberCommunity, memberActivatedStrategy, + membersStrategyData, }) => { const showPoolGovernanceData = isMemberCommunity && memberActivatedStrategy; const poolSystem = strategy.config.pointSystem; + const [openGovDetails, setOpenGovDetails] = useState(false); const { address } = useAccount(); const poolSystemDefinition: { [key: number]: string } = { @@ -53,55 +62,124 @@ export const PoolGovernance: React.FC = ({ }; return ( -
-
-

Pool Governance

-
- - +
+
+

Pool Governance

+
+ - -
-
- {address && ( -
-
-
-
-

Your stake in the community:

- - -
- {showPoolGovernanceData && ( -
-

Your voting weight:

-

- {memberPoolWeight?.toFixed(2)} % -

+ enableCheck={!memberActivatedStrategy} + > + + +
+
+ {address && ( +
+
+
+
+

Your stake in the community:

+ +
- )} + {showPoolGovernanceData && ( +
+

Your voting weight:

+

+ {memberPoolWeight?.toFixed(2)} % +

+
+ )} +
- - )} - -
+ )} + + + {openGovDetails && ( + + )} + + + ); +}; + +type MemberColumn = Column; + +const PoolGovernanceDetails: React.FC<{ + membersStrategyData: { + id: string; + activatedPoints: string; + totalStakedPoints: string; + member: { + memberCommunity: { + memberAddress: string; + }[]; + }; + }[]; +}> = ({ membersStrategyData }) => { + const columns: MemberColumn[] = [ + { + header: "Member", + render: (member) => ( + + ), + }, + { + header: "Voting weight used", + render: (member) => ( + + {calculatePercentageBigInt( + BigInt(member.totalStakedPoints), + BigInt(member.activatedPoints), + )}{" "} + % + + ), + className: "flex justify-end pr-4", + }, + ]; + + return ( + ); }; diff --git a/apps/web/components/Proposals.tsx b/apps/web/components/Proposals.tsx index 31b48fe36..44fa53950 100644 --- a/apps/web/components/Proposals.tsx +++ b/apps/web/components/Proposals.tsx @@ -19,6 +19,8 @@ import { isMemberQuery, CVStrategy, RegistryCommunity, + getMembersStrategyQuery, + getMembersStrategyDocument, } from "#/subgraph/.graphclient"; import { LoadingSpinner } from "./LoadingSpinner"; import { PoolGovernanceProps } from "./PoolGovernance"; @@ -51,6 +53,18 @@ export type ProposalInputItem = { value: bigint; }; +export type MemberStrategyData = { + activatedPoints: string; + id: string; + member?: { + memberCommunity?: { + isRegistered: boolean; + memberAddress: string; + }; + }; + totalStakedPoints: string; +}; + // export type Strategy = getStrategyByPoolQuery["cvstrategies"][number]; // export type Proposal = CVStrategy["proposals"][number]; export type StakesMemberType = NonNullable["stakes"]; @@ -157,6 +171,23 @@ export function Proposals({ }, ); + const { data: membersStrategyData } = + useSubgraphQuery({ + query: getMembersStrategyDocument, + variables: { + strategyId: `${strategy.id.toLowerCase()}`, + }, + changeScope: [ + { + topic: "proposal", + containerId: strategy.poolId, + type: "update", + }, + { topic: "member", id: wallet, containerId: strategy.poolId }, + ], + enabled: !!wallet, + }); + const memberActivatedPoints: bigint = BigInt( memberStrategyData?.memberStrategy?.activatedPoints ?? 0, ); @@ -447,6 +478,8 @@ export function Proposals({ (x) => stakedFilters[x.id]?.value, ); + const membersStrategies = membersStrategyData?.memberStrategies; + // Render return ( <> @@ -459,6 +492,7 @@ export function Proposals({ memberTokensInCommunity={memberTokensInCommunity} isMemberCommunity={isMemberCommunity} memberActivatedStrategy={memberActivatedStrategy} + membersStrategyData={membersStrategies} /> )}
diff --git a/apps/web/components/index.ts b/apps/web/components/index.ts index 3a60f3ee9..6b433f817 100644 --- a/apps/web/components/index.ts +++ b/apps/web/components/index.ts @@ -32,3 +32,4 @@ export { CheckPassport } from "./CheckPassport"; export { Modal } from "./Modal"; export { InfoBox } from "./InfoBox"; export { InfoWrapper } from "./InfoWrapper"; +export { DataTable } from "./DataTable"; diff --git a/apps/web/types/index.ts b/apps/web/types/index.ts index 4226c0112..c0387b1b6 100644 --- a/apps/web/types/index.ts +++ b/apps/web/types/index.ts @@ -56,3 +56,9 @@ export type SybilResistanceType = | "noSybilResist" | "gitcoinPassport" | "allowList"; + +export type Column = { + header: string | React.ReactNode; + render: (item: T) => React.ReactNode; + className?: string; +}; diff --git a/pkg/subgraph/.graphclient/index.d.ts b/pkg/subgraph/.graphclient/index.d.ts index ff228606b..1417cf25e 100644 --- a/pkg/subgraph/.graphclient/index.d.ts +++ b/pkg/subgraph/.graphclient/index.d.ts @@ -3515,6 +3515,9 @@ export declare function getBuiltGraphSDK, options?: TOperationContext): Promise; + getMembersStrategy(variables: Exact<{ + strategyId: Scalars["String"]["input"]; + }>, options?: TOperationContext): Promise; getMemberStrategy(variables: Exact<{ member_strategy: Scalars["ID"]["input"]; }>, options?: TOperationContext): Promise; @@ -3614,6 +3617,16 @@ export type getTokenGardensQuery = { })>>; })>; }; +export type getMembersStrategyQueryVariables = Exact<{ + strategyId: Scalars['String']['input']; +}>; +export type getMembersStrategyQuery = { + memberStrategies: Array<(Pick & { + member: { + memberCommunity?: Maybe>>; + }; + })>; +}; export type getMemberStrategyQueryVariables = Exact<{ member_strategy: Scalars['ID']['input']; }>; @@ -3692,8 +3705,8 @@ export type getCommunityQueryVariables = Exact<{ showArchived?: InputMaybe; }>; export type getCommunityQuery = { - registryCommunity?: Maybe<(Pick & { - members?: Maybe>>; + registryCommunity?: Maybe<(Pick & { + members?: Maybe>>; strategies?: Maybe & { proposals: Array>; config: Pick; @@ -3853,6 +3866,7 @@ export type getMemberPassportAndCommunitiesQuery = { }; export declare const getFactoriesDocument: DocumentNode; export declare const getTokenGardensDocument: DocumentNode; +export declare const getMembersStrategyDocument: DocumentNode; export declare const getMemberStrategyDocument: DocumentNode; export declare const isMemberDocument: DocumentNode; export declare const getMemberDocument: DocumentNode; @@ -3879,6 +3893,7 @@ export type Requester = (doc: DocumentNode, vars?: V, export declare function getSdk(requester: Requester): { getFactories(variables?: getFactoriesQueryVariables, options?: C): Promise; getTokenGardens(variables?: getTokenGardensQueryVariables, options?: C): Promise; + getMembersStrategy(variables: getMembersStrategyQueryVariables, options?: C): Promise; getMemberStrategy(variables: getMemberStrategyQueryVariables, options?: C): Promise; isMember(variables: isMemberQueryVariables, options?: C): Promise; getMember(variables: getMemberQueryVariables, options?: C): Promise; diff --git a/pkg/subgraph/.graphclient/index.js b/pkg/subgraph/.graphclient/index.js index a38dfb322..da9120e94 100644 --- a/pkg/subgraph/.graphclient/index.js +++ b/pkg/subgraph/.graphclient/index.js @@ -50,7 +50,7 @@ export async function getMeshOptions() { const additionalTypeDefs = []; const gv2Handler = new GraphqlHandler({ name: "gv2", - config: { "endpoint": "https://api.studio.thegraph.com/query/70985/gardens-v2---arbitrum-sepolia/0.3.0" }, + config: { "endpoint": "https://api.studio.thegraph.com/query/70985/gardens-v2---arbitrum-sepolia/0.3.1" }, baseDir, cache, pubsub, @@ -71,30 +71,31 @@ export async function getMeshOptions() { store: rootStore.child('bareMerger') }); const documentHashMap = { - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": GetFactoriesDocument, - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": GetTokenGardensDocument, - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": GetMemberStrategyDocument, - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": IsMemberDocument, - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": GetMemberDocument, - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": GetPoolCreationDataDocument, - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": GetProposalSupportersDocument, - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": GetGardenCommunitiesDocument, - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": GetCommunityDocument, - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": GetCommunityCreationDataDocument, - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": GetPoolDataDocument, - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": GetProposalDataDocument, - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": GetAlloDocument, - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": GetStrategyByPoolDocument, - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": GetTokenTitleDocument, - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": GetCommunityTitlesDocument, - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": GetPoolTitlesDocument, - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": GetProposalTitlesDocument, - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": GetPassportScorerDocument, - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": GetPassportStrategyDocument, - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": GetPassportUserDocument, - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": GetProposalDisputesDocument, - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": GetArbitrableConfigsDocument, - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": GetMemberPassportAndCommunitiesDocument + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetFactoriesDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetTokenGardensDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetMembersStrategyDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetMemberStrategyDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": IsMemberDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetMemberDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetPoolCreationDataDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetProposalSupportersDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetGardenCommunitiesDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetCommunityDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetCommunityCreationDataDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetPoolDataDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetProposalDataDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetAlloDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetStrategyByPoolDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetTokenTitleDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetCommunityTitlesDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetPoolTitlesDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetProposalTitlesDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetPassportScorerDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetPassportStrategyDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetPassportUserDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetProposalDisputesDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetArbitrableConfigsDocument, + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": GetMemberPassportAndCommunitiesDocument }; additionalEnvelopPlugins.push(usePersistedOperations({ getPersistedOperation(key) { @@ -120,168 +121,175 @@ export async function getMeshOptions() { return printWithCache(GetFactoriesDocument); }, location: 'GetFactoriesDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' }, { document: GetTokenGardensDocument, get rawSDL() { return printWithCache(GetTokenGardensDocument); }, location: 'GetTokenGardensDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' + }, { + document: GetMembersStrategyDocument, + get rawSDL() { + return printWithCache(GetMembersStrategyDocument); + }, + location: 'GetMembersStrategyDocument.graphql', + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' }, { document: GetMemberStrategyDocument, get rawSDL() { return printWithCache(GetMemberStrategyDocument); }, location: 'GetMemberStrategyDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' }, { document: IsMemberDocument, get rawSDL() { return printWithCache(IsMemberDocument); }, location: 'IsMemberDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' }, { document: GetMemberDocument, get rawSDL() { return printWithCache(GetMemberDocument); }, location: 'GetMemberDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' }, { document: GetPoolCreationDataDocument, get rawSDL() { return printWithCache(GetPoolCreationDataDocument); }, location: 'GetPoolCreationDataDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' }, { document: GetProposalSupportersDocument, get rawSDL() { return printWithCache(GetProposalSupportersDocument); }, location: 'GetProposalSupportersDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' }, { document: GetGardenCommunitiesDocument, get rawSDL() { return printWithCache(GetGardenCommunitiesDocument); }, location: 'GetGardenCommunitiesDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' }, { document: GetCommunityDocument, get rawSDL() { return printWithCache(GetCommunityDocument); }, location: 'GetCommunityDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' }, { document: GetCommunityCreationDataDocument, get rawSDL() { return printWithCache(GetCommunityCreationDataDocument); }, location: 'GetCommunityCreationDataDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' }, { document: GetPoolDataDocument, get rawSDL() { return printWithCache(GetPoolDataDocument); }, location: 'GetPoolDataDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' }, { document: GetProposalDataDocument, get rawSDL() { return printWithCache(GetProposalDataDocument); }, location: 'GetProposalDataDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' }, { document: GetAlloDocument, get rawSDL() { return printWithCache(GetAlloDocument); }, location: 'GetAlloDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' }, { document: GetStrategyByPoolDocument, get rawSDL() { return printWithCache(GetStrategyByPoolDocument); }, location: 'GetStrategyByPoolDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' }, { document: GetTokenTitleDocument, get rawSDL() { return printWithCache(GetTokenTitleDocument); }, location: 'GetTokenTitleDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' }, { document: GetCommunityTitlesDocument, get rawSDL() { return printWithCache(GetCommunityTitlesDocument); }, location: 'GetCommunityTitlesDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' }, { document: GetPoolTitlesDocument, get rawSDL() { return printWithCache(GetPoolTitlesDocument); }, location: 'GetPoolTitlesDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' }, { document: GetProposalTitlesDocument, get rawSDL() { return printWithCache(GetProposalTitlesDocument); }, location: 'GetProposalTitlesDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' }, { document: GetPassportScorerDocument, get rawSDL() { return printWithCache(GetPassportScorerDocument); }, location: 'GetPassportScorerDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' }, { document: GetPassportStrategyDocument, get rawSDL() { return printWithCache(GetPassportStrategyDocument); }, location: 'GetPassportStrategyDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' }, { document: GetPassportUserDocument, get rawSDL() { return printWithCache(GetPassportUserDocument); }, location: 'GetPassportUserDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' }, { document: GetProposalDisputesDocument, get rawSDL() { return printWithCache(GetProposalDisputesDocument); }, location: 'GetProposalDisputesDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' }, { document: GetArbitrableConfigsDocument, get rawSDL() { return printWithCache(GetArbitrableConfigsDocument); }, location: 'GetArbitrableConfigsDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' }, { document: GetMemberPassportAndCommunitiesDocument, get rawSDL() { return printWithCache(GetMemberPassportAndCommunitiesDocument); }, location: 'GetMemberPassportAndCommunitiesDocument.graphql', - sha256Hash: 'a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965' + sha256Hash: '82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814' } ]; }, @@ -385,6 +393,21 @@ export const getTokenGardensDocument = gql ` } } `; +export const getMembersStrategyDocument = gql ` + query getMembersStrategy($strategyId: String!) { + memberStrategies(where: {strategy: $strategyId}) { + activatedPoints + member { + memberCommunity { + memberAddress + isRegistered + } + } + totalStakedPoints + id + } +} + `; export const getMemberStrategyDocument = gql ` query getMemberStrategy($member_strategy: ID!) { memberStrategy(id: $member_strategy) { @@ -525,9 +548,12 @@ export const getCommunityDocument = gql ` registryCommunity(id: $communityAddr) { communityName id - councilSafe - members(where: {stakedTokens_gt: "0"}) { - id + members( + where: {stakedTokens_gt: "0"} + orderBy: stakedTokens + orderDirection: desc + ) { + memberAddress stakedTokens } strategies(orderBy: poolId, orderDirection: desc) { @@ -924,6 +950,9 @@ export function getSdk(requester) { getTokenGardens(variables, options) { return requester(getTokenGardensDocument, variables, options); }, + getMembersStrategy(variables, options) { + return requester(getMembersStrategyDocument, variables, options); + }, getMemberStrategy(variables, options) { return requester(getMemberStrategyDocument, variables, options); }, diff --git a/pkg/subgraph/.graphclient/persisted_operations.json b/pkg/subgraph/.graphclient/persisted_operations.json index 8efcc037e..29092ef29 100644 --- a/pkg/subgraph/.graphclient/persisted_operations.json +++ b/pkg/subgraph/.graphclient/persisted_operations.json @@ -1,3 +1,3 @@ { - "a30b2890fa186d3ab98b7e7bbd3fd9b8145f6b570188cd0e2a3e261225faf965": "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 councilSafe\n members(where: {stakedTokens_gt: \"0\"}) {\n id\n stakedTokens\n }\n strategies(orderBy: poolId, orderDirection: desc) {\n id\n proposals {\n id\n }\n archived\n isEnabled\n poolAmount\n poolId\n token\n metadata\n archived\n config {\n proposalType\n pointSystem\n }\n proposals {\n id\n }\n }\n covenantIpfsHash\n communityFee\n protocolFee\n registerStakeAmount\n registerToken\n councilSafe\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 isEnabled\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}" + "82025b9ed579f2b610866420e8b4511311ce31156520074ae683eca44d77f814": "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 getMembersStrategy($strategyId: String!) {\n memberStrategies(where: {strategy: $strategyId}) {\n activatedPoints\n member {\n memberCommunity {\n memberAddress\n isRegistered\n }\n }\n totalStakedPoints\n id\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(\n where: {stakedTokens_gt: \"0\"}\n orderBy: stakedTokens\n orderDirection: desc\n ) {\n memberAddress\n stakedTokens\n }\n strategies(orderBy: poolId, orderDirection: desc) {\n id\n proposals {\n id\n }\n archived\n isEnabled\n poolAmount\n poolId\n token\n metadata\n archived\n config {\n proposalType\n pointSystem\n }\n proposals {\n id\n }\n }\n covenantIpfsHash\n communityFee\n protocolFee\n registerStakeAmount\n registerToken\n councilSafe\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 isEnabled\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 6f0a94047..93f20f8f0 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.3.0 + endpoint: https://api.studio.thegraph.com/query/70985/gardens-v2---arbitrum-sepolia/0.3.1 documents: - ./src/query/queries.graphql diff --git a/pkg/subgraph/src/query/queries.graphql b/pkg/subgraph/src/query/queries.graphql index 8c8c3222b..1ee432429 100644 --- a/pkg/subgraph/src/query/queries.graphql +++ b/pkg/subgraph/src/query/queries.graphql @@ -54,6 +54,20 @@ query getTokenGardens { } } +query getMembersStrategy($strategyId: String!) { + memberStrategies(where: { strategy: $strategyId }) { + activatedPoints + member { + memberCommunity { + memberAddress + isRegistered + } + } + totalStakedPoints + id + } +} + query getMemberStrategy($member_strategy: ID!) { memberStrategy(id: $member_strategy) { id @@ -193,9 +207,12 @@ query getCommunity( registryCommunity(id: $communityAddr) { communityName id - councilSafe - members(where: { stakedTokens_gt: "0" }) { - id + members( + where: { stakedTokens_gt: "0" } + orderBy: stakedTokens + orderDirection: desc + ) { + memberAddress stakedTokens } strategies(orderBy: poolId, orderDirection: desc) { diff --git a/pkg/subgraph/subgraph.yaml b/pkg/subgraph/subgraph.yaml index e3288b4cb..858652e96 100644 --- a/pkg/subgraph/subgraph.yaml +++ b/pkg/subgraph/subgraph.yaml @@ -8,7 +8,7 @@ dataSources: name: RegistryFactoryV0_0 network: base context: - chainId: + chainId: type: Int data: 8453 source: @@ -33,16 +33,16 @@ dataSources: - event: CommunityValiditySet(address,bool) handler: handleCommunityValiditySet - event: ProtocolFeeSet(address,uint256) - handler: handleProtocolFeeSet + handler: handleProtocolFeeSet - event: Initialized(uint8) - handler: handleRegistryInitialized + handler: handleRegistryInitialized file: ./src/mappings/registry-factory.ts - kind: ethereum/contract name: PassportScorer network: base context: - chainId: + chainId: type: Int data: 8453 source: @@ -100,7 +100,7 @@ templates: file: ../contracts/out/CVStrategyV0_0.sol/CVStrategyV0_0.json - name: RegistryFactoryV0_0 file: ../contracts/out/RegistryFactoryV0_0.sol/RegistryFactoryV0_0.json - + eventHandlers: - event: RegistryInitialized(bytes32,string,(uint256,string)) handler: handleInitialized @@ -204,7 +204,7 @@ templates: handler: handleAllowlistMembersRemoved - event: SybilScorerUpdated(address) handler: handleSybilScorerUpdated - + file: ./src/mappings/cv-strategy.ts - kind: ethereum/contract @@ -229,8 +229,8 @@ templates: handler: handleCollateralWithdrawnFor - event: CollateralWithdrawn(uint256,indexed address,uint256,bool) handler: handleCollateralWithdrawn - file: ./src/mappings/cv-strategy.ts - + file: ./src/mappings/cv-strategy.ts + - name: ProposalDisputeMetadata kind: file/ipfs mapping: @@ -243,7 +243,7 @@ templates: abis: - name: CVStrategyV0_0 file: ../contracts/out/CVStrategyV0_0.sol/CVStrategyV0_0.json - + - name: ProposalMetadata kind: file/ipfs mapping: @@ -255,4 +255,4 @@ templates: - ProposalMetadata abis: - name: CVStrategyV0_0 - file: ../contracts/out/CVStrategyV0_0.sol/CVStrategyV0_0.json \ No newline at end of file + file: ../contracts/out/CVStrategyV0_0.sol/CVStrategyV0_0.json