From fe1e369491826f7bf5d503635f134913877de087 Mon Sep 17 00:00:00 2001 From: Matias Date: Fri, 6 Dec 2024 20:51:14 -0300 Subject: [PATCH 1/9] upgrade subgraph endpoint + create query `getProposalSupporter`s + fetch query in `proposalId` page --- .../[poolId]/[proposalId]/page.tsx | 18 ++- pkg/subgraph/.graphclient/index.d.ts | 35 ++++- pkg/subgraph/.graphclient/index.js | 119 ++++++++------ .../.graphclient/persisted_operations.json | 2 +- pkg/subgraph/.graphclient/schema.graphql | 12 ++ .../sources/gv2/introspectionSchema.js | 147 ++++++++++++++++++ .../.graphclient/sources/gv2/schema.graphql | 12 ++ .../.graphclient/sources/gv2/types.ts | 14 +- pkg/subgraph/.graphclientrc.template.yml | 2 +- pkg/subgraph/.graphclientrc.yml | 2 +- pkg/subgraph/src/query/queries.graphql | 13 ++ 11 files changed, 317 insertions(+), 59 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 d1a369b9..405a5595 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 @@ -13,6 +13,8 @@ import { useAccount, useToken } from "wagmi"; import { getProposalDataDocument, getProposalDataQuery, + getProposalSupportersQuery, + getProposalSupportersDocument, isMemberDocument, isMemberQuery, } from "#/subgraph/.graphclient"; @@ -74,6 +76,16 @@ export default function Page({ }, }); + //query to get proposal supporters + const { data: supportersData } = useSubgraphQuery( + { + query: getProposalSupportersDocument, + variables: { + proposalId: proposalId.toLowerCase(), + }, + }, + ); + //query to get member registry in community const { data: memberData } = useSubgraphQuery({ query: isMemberDocument, @@ -89,6 +101,7 @@ export default function Page({ // const proposalData = data?.cvproposal; + const proposalSupporters = supportersData?.members; const proposalIdNumber = proposalData?.proposalNumber ? BigInt(proposalData.proposalNumber) @@ -107,6 +120,8 @@ export default function Page({ const isProposerConnected = proposalData?.submitter === address?.toLowerCase(); + console.log(proposalSupporters); + const proposalType = proposalData?.strategy.config?.proposalType; const isSignalingType = PoolTypes[proposalType] === "signaling"; const requestedAmount = proposalData?.requestedAmount; @@ -204,6 +219,7 @@ export default function Page({ if ( !proposalData || + !supportersData || !metadata || proposalIdNumber == null || updatedConviction == null @@ -345,7 +361,7 @@ export default function Page({ } disabled={currentConvictionPct < thresholdPct || !isConnected} tooltip={ - tooltipMessage ?? currentConvictionPct < thresholdPct ? + (tooltipMessage ?? currentConvictionPct < thresholdPct) ? "Proposal not executable" : undefined } diff --git a/pkg/subgraph/.graphclient/index.d.ts b/pkg/subgraph/.graphclient/index.d.ts index b2137593..5b963934 100644 --- a/pkg/subgraph/.graphclient/index.d.ts +++ b/pkg/subgraph/.graphclient/index.d.ts @@ -254,7 +254,7 @@ export type ArbitrableConfig_filter = { and?: InputMaybe>>; or?: InputMaybe>>; }; -export type ArbitrableConfig_orderBy = 'id' | 'version' | 'strategy' | 'strategy__id' | 'strategy__poolId' | 'strategy__poolAmount' | 'strategy__metadata' | 'strategy__maxCVSupply' | 'strategy__totalEffectiveActivePoints' | 'strategy__isEnabled' | 'strategy__token' | 'arbitrator' | 'tribunalSafe' | 'challengerCollateralAmount' | 'submitterCollateralAmount' | 'defaultRuling' | 'defaultRulingTimeout' | 'allowlist'; +export type ArbitrableConfig_orderBy = 'id' | 'version' | 'strategy' | 'strategy__id' | 'strategy__poolId' | 'strategy__poolAmount' | 'strategy__metadata' | 'strategy__maxCVSupply' | 'strategy__totalEffectiveActivePoints' | 'strategy__isEnabled' | 'strategy__token' | 'strategy__archived' | 'arbitrator' | 'tribunalSafe' | 'challengerCollateralAmount' | 'submitterCollateralAmount' | 'defaultRuling' | 'defaultRulingTimeout' | 'allowlist'; export type BlockChangedFilter = { number_gte: Scalars['Int']['input']; }; @@ -529,7 +529,7 @@ export type CVProposal_filter = { and?: InputMaybe>>; or?: InputMaybe>>; }; -export type CVProposal_orderBy = 'id' | 'proposalNumber' | 'metadata' | 'metadata__id' | 'metadata__title' | 'metadata__description' | 'metadataHash' | 'version' | 'strategy' | 'strategy__id' | 'strategy__poolId' | 'strategy__poolAmount' | 'strategy__metadata' | 'strategy__maxCVSupply' | 'strategy__totalEffectiveActivePoints' | 'strategy__isEnabled' | 'strategy__token' | 'beneficiary' | 'requestedAmount' | 'requestedToken' | 'proposalStatus' | 'blockLast' | 'convictionLast' | 'threshold' | 'maxCVStaked' | 'stakedAmount' | 'submitter' | 'createdAt' | 'updatedAt' | 'arbitrableConfig' | 'arbitrableConfig__id' | 'arbitrableConfig__version' | 'arbitrableConfig__arbitrator' | 'arbitrableConfig__tribunalSafe' | 'arbitrableConfig__challengerCollateralAmount' | 'arbitrableConfig__submitterCollateralAmount' | 'arbitrableConfig__defaultRuling' | 'arbitrableConfig__defaultRulingTimeout'; +export type CVProposal_orderBy = 'id' | 'proposalNumber' | 'metadata' | 'metadata__id' | 'metadata__title' | 'metadata__description' | 'metadataHash' | 'version' | 'strategy' | 'strategy__id' | 'strategy__poolId' | 'strategy__poolAmount' | 'strategy__metadata' | 'strategy__maxCVSupply' | 'strategy__totalEffectiveActivePoints' | 'strategy__isEnabled' | 'strategy__token' | 'strategy__archived' | 'beneficiary' | 'requestedAmount' | 'requestedToken' | 'proposalStatus' | 'blockLast' | 'convictionLast' | 'threshold' | 'maxCVStaked' | 'stakedAmount' | 'submitter' | 'createdAt' | 'updatedAt' | 'arbitrableConfig' | 'arbitrableConfig__id' | 'arbitrableConfig__version' | 'arbitrableConfig__arbitrator' | 'arbitrableConfig__tribunalSafe' | 'arbitrableConfig__challengerCollateralAmount' | 'arbitrableConfig__submitterCollateralAmount' | 'arbitrableConfig__defaultRuling' | 'arbitrableConfig__defaultRulingTimeout'; export type CVStrategy = { id: Scalars['ID']['output']; poolId: Scalars['BigInt']['output']; @@ -544,6 +544,7 @@ export type CVStrategy = { isEnabled: Scalars['Boolean']['output']; token: Scalars['String']['output']; sybilScorer?: Maybe; + archived: Scalars['Boolean']['output']; }; export type CVStrategyproposalsArgs = { skip?: InputMaybe; @@ -657,7 +658,7 @@ export type CVStrategyConfig_filter = { and?: InputMaybe>>; or?: InputMaybe>>; }; -export type CVStrategyConfig_orderBy = 'id' | 'strategy' | 'strategy__id' | 'strategy__poolId' | 'strategy__poolAmount' | 'strategy__metadata' | 'strategy__maxCVSupply' | 'strategy__totalEffectiveActivePoints' | 'strategy__isEnabled' | 'strategy__token' | 'D' | 'decay' | 'maxRatio' | 'minThresholdPoints' | 'weight' | 'proposalType' | 'pointSystem' | 'maxAmount' | 'allowlist'; +export type CVStrategyConfig_orderBy = 'id' | 'strategy' | 'strategy__id' | 'strategy__poolId' | 'strategy__poolAmount' | 'strategy__metadata' | 'strategy__maxCVSupply' | 'strategy__totalEffectiveActivePoints' | 'strategy__isEnabled' | 'strategy__token' | 'strategy__archived' | 'D' | 'decay' | 'maxRatio' | 'minThresholdPoints' | 'weight' | 'proposalType' | 'pointSystem' | 'maxAmount' | 'allowlist'; export type CVStrategy_filter = { id?: InputMaybe; id_not?: InputMaybe; @@ -814,12 +815,16 @@ export type CVStrategy_filter = { sybilScorer_not_ends_with?: InputMaybe; sybilScorer_not_ends_with_nocase?: InputMaybe; sybilScorer_?: InputMaybe; + archived?: InputMaybe; + archived_not?: InputMaybe; + archived_in?: InputMaybe>; + archived_not_in?: InputMaybe>; /** Filter for the block changed event. */ _change_block?: InputMaybe; and?: InputMaybe>>; or?: InputMaybe>>; }; -export type CVStrategy_orderBy = 'id' | 'poolId' | 'poolAmount' | 'metadata' | 'registryCommunity' | 'registryCommunity__id' | 'registryCommunity__chainId' | 'registryCommunity__strategyTemplate' | 'registryCommunity__profileId' | 'registryCommunity__communityFee' | 'registryCommunity__protocolFee' | 'registryCommunity__protocolFeeReceiver' | 'registryCommunity__communityName' | 'registryCommunity__covenantIpfsHash' | 'registryCommunity__councilSafe' | 'registryCommunity__pendingNewCouncilSafe' | 'registryCommunity__isKickEnabled' | 'registryCommunity__registerStakeAmount' | 'registryCommunity__registerToken' | 'registryCommunity__alloAddress' | 'registryCommunity__isValid' | 'config' | 'config__id' | 'config__D' | 'config__decay' | 'config__maxRatio' | 'config__minThresholdPoints' | 'config__weight' | 'config__proposalType' | 'config__pointSystem' | 'config__maxAmount' | 'proposals' | 'memberActive' | 'maxCVSupply' | 'totalEffectiveActivePoints' | 'isEnabled' | 'token' | 'sybilScorer' | 'sybilScorer__id'; +export type CVStrategy_orderBy = 'id' | 'poolId' | 'poolAmount' | 'metadata' | 'registryCommunity' | 'registryCommunity__id' | 'registryCommunity__chainId' | 'registryCommunity__strategyTemplate' | 'registryCommunity__profileId' | 'registryCommunity__communityFee' | 'registryCommunity__protocolFee' | 'registryCommunity__protocolFeeReceiver' | 'registryCommunity__communityName' | 'registryCommunity__covenantIpfsHash' | 'registryCommunity__councilSafe' | 'registryCommunity__pendingNewCouncilSafe' | 'registryCommunity__isKickEnabled' | 'registryCommunity__registerStakeAmount' | 'registryCommunity__registerToken' | 'registryCommunity__alloAddress' | 'registryCommunity__isValid' | 'config' | 'config__id' | 'config__D' | 'config__decay' | 'config__maxRatio' | 'config__minThresholdPoints' | 'config__weight' | 'config__proposalType' | 'config__pointSystem' | 'config__maxAmount' | 'proposals' | 'memberActive' | 'maxCVSupply' | 'totalEffectiveActivePoints' | 'isEnabled' | 'token' | 'sybilScorer' | 'sybilScorer__id' | 'archived'; export type CollateralVault = { id: Scalars['ID']['output']; strategy: CVStrategy; @@ -966,7 +971,7 @@ export type CollateralVault_filter = { and?: InputMaybe>>; or?: InputMaybe>>; }; -export type CollateralVault_orderBy = 'id' | 'strategy' | 'strategy__id' | 'strategy__poolId' | 'strategy__poolAmount' | 'strategy__metadata' | 'strategy__maxCVSupply' | 'strategy__totalEffectiveActivePoints' | 'strategy__isEnabled' | 'strategy__token' | 'collaterals'; +export type CollateralVault_orderBy = 'id' | 'strategy' | 'strategy__id' | 'strategy__poolId' | 'strategy__poolAmount' | 'strategy__metadata' | 'strategy__maxCVSupply' | 'strategy__totalEffectiveActivePoints' | 'strategy__isEnabled' | 'strategy__token' | 'strategy__archived' | 'collaterals'; export type Member = { id: Scalars['ID']['output']; memberCommunity?: Maybe>; @@ -1183,7 +1188,7 @@ export type MemberStrategy_filter = { and?: InputMaybe>>; or?: InputMaybe>>; }; -export type MemberStrategy_orderBy = 'id' | 'member' | 'member__id' | 'strategy' | 'strategy__id' | 'strategy__poolId' | 'strategy__poolAmount' | 'strategy__metadata' | 'strategy__maxCVSupply' | 'strategy__totalEffectiveActivePoints' | 'strategy__isEnabled' | 'strategy__token' | 'totalStakedPoints' | 'activatedPoints'; +export type MemberStrategy_orderBy = 'id' | 'member' | 'member__id' | 'strategy' | 'strategy__id' | 'strategy__poolId' | 'strategy__poolAmount' | 'strategy__metadata' | 'strategy__maxCVSupply' | 'strategy__totalEffectiveActivePoints' | 'strategy__isEnabled' | 'strategy__token' | 'strategy__archived' | 'totalStakedPoints' | 'activatedPoints'; export type Member_filter = { id?: InputMaybe; id_not?: InputMaybe; @@ -1335,7 +1340,7 @@ export type PassportStrategy_filter = { and?: InputMaybe>>; or?: InputMaybe>>; }; -export type PassportStrategy_orderBy = 'id' | 'passportScorer' | 'passportScorer__id' | 'strategy' | 'strategy__id' | 'strategy__poolId' | 'strategy__poolAmount' | 'strategy__metadata' | 'strategy__maxCVSupply' | 'strategy__totalEffectiveActivePoints' | 'strategy__isEnabled' | 'strategy__token' | 'threshold' | 'councilSafe' | 'active'; +export type PassportStrategy_orderBy = 'id' | 'passportScorer' | 'passportScorer__id' | 'strategy' | 'strategy__id' | 'strategy__poolId' | 'strategy__poolAmount' | 'strategy__metadata' | 'strategy__maxCVSupply' | 'strategy__totalEffectiveActivePoints' | 'strategy__isEnabled' | 'strategy__token' | 'strategy__archived' | 'threshold' | 'councilSafe' | 'active'; export type PassportUser = { id: Scalars['ID']['output']; passportScorer: PassportScorer; @@ -3198,6 +3203,7 @@ export type CVStrategyResolvers; token?: Resolver; sybilScorer?: Resolver, ParentType, ContextType>; + archived?: Resolver; __isTypeOf?: IsTypeOfResolverFn; }>; export type CVStrategyConfigResolvers = ResolversObject<{ @@ -3523,6 +3529,9 @@ export declare function getBuiltGraphSDK, options?: TOperationContext): Promise; + getProposalSupporters(variables: Exact<{ + proposalId: Scalars["String"]["input"]; + }>, options?: TOperationContext): Promise; getGardenCommunities(variables: Exact<{ chainId: Scalars["BigInt"]["input"]; tokenGarden: Scalars["ID"]["input"]; @@ -3654,6 +3663,16 @@ export type getPoolCreationDataQuery = { allos: Array>; registryCommunity?: Maybe>; }; +export type getProposalSupportersQueryVariables = Exact<{ + proposalId: Scalars['String']['input']; +}>; +export type getProposalSupportersQuery = { + members: Array<(Pick & { + stakes?: Maybe & { + proposal: Pick; + })>>; + })>; +}; export type getGardenCommunitiesQueryVariables = Exact<{ chainId: Scalars['BigInt']['input']; tokenGarden: Scalars['ID']['input']; @@ -3833,6 +3852,7 @@ export declare const getMemberStrategyDocument: DocumentNode; export declare const getMemberDocument: DocumentNode; export declare const getPoolCreationDataDocument: DocumentNode; +export declare const getProposalSupportersDocument: DocumentNode; export declare const getGardenCommunitiesDocument: DocumentNode; export declare const getCommunityDocument: DocumentNode; export declare const getCommunityCreationDataDocument: DocumentNode; @@ -3858,6 +3878,7 @@ export declare function getSdk(requester: Requester): { isMember(variables: isMemberQueryVariables, options?: C): Promise; getMember(variables: getMemberQueryVariables, options?: C): Promise; getPoolCreationData(variables: getPoolCreationDataQueryVariables, options?: C): Promise; + getProposalSupporters(variables: getProposalSupportersQueryVariables, options?: C): Promise; getGardenCommunities(variables: getGardenCommunitiesQueryVariables, options?: C): Promise; getCommunity(variables: getCommunityQueryVariables, options?: C): Promise; getCommunityCreationData(variables?: getCommunityCreationDataQueryVariables, options?: C): Promise; diff --git a/pkg/subgraph/.graphclient/index.js b/pkg/subgraph/.graphclient/index.js index 4f6b1c3c..847d0e65 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/40931/gardens-v2---arbitrum-sepolia/0.2.0" }, + config: { "endpoint": "https://api.studio.thegraph.com/query/70985/gardens-v2---arbitrum-sepolia/version/latest" }, baseDir, cache, pubsub, @@ -71,29 +71,30 @@ export async function getMeshOptions() { 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 + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetFactoriesDocument, + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetTokenGardensDocument, + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetMemberStrategyDocument, + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": IsMemberDocument, + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetMemberDocument, + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetPoolCreationDataDocument, + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetProposalSupportersDocument, + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetGardenCommunitiesDocument, + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetCommunityDocument, + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetCommunityCreationDataDocument, + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetPoolDataDocument, + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetProposalDataDocument, + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetAlloDocument, + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetStrategyByPoolDocument, + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetTokenTitleDocument, + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetCommunityTitlesDocument, + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetPoolTitlesDocument, + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetProposalTitlesDocument, + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetPassportScorerDocument, + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetPassportStrategyDocument, + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetPassportUserDocument, + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetProposalDisputesDocument, + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetArbitrableConfigsDocument, + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetMemberPassportAndCommunitiesDocument }; additionalEnvelopPlugins.push(usePersistedOperations({ getPersistedOperation(key) { @@ -119,161 +120,168 @@ export async function getMeshOptions() { return printWithCache(GetFactoriesDocument); }, location: 'GetFactoriesDocument.graphql', - sha256Hash: '21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa' + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' }, { document: GetTokenGardensDocument, get rawSDL() { return printWithCache(GetTokenGardensDocument); }, location: 'GetTokenGardensDocument.graphql', - sha256Hash: '21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa' + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' }, { document: GetMemberStrategyDocument, get rawSDL() { return printWithCache(GetMemberStrategyDocument); }, location: 'GetMemberStrategyDocument.graphql', - sha256Hash: '21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa' + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' }, { document: IsMemberDocument, get rawSDL() { return printWithCache(IsMemberDocument); }, location: 'IsMemberDocument.graphql', - sha256Hash: '21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa' + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' }, { document: GetMemberDocument, get rawSDL() { return printWithCache(GetMemberDocument); }, location: 'GetMemberDocument.graphql', - sha256Hash: '21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa' + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' }, { document: GetPoolCreationDataDocument, get rawSDL() { return printWithCache(GetPoolCreationDataDocument); }, location: 'GetPoolCreationDataDocument.graphql', - sha256Hash: '21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa' + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + }, { + document: GetProposalSupportersDocument, + get rawSDL() { + return printWithCache(GetProposalSupportersDocument); + }, + location: 'GetProposalSupportersDocument.graphql', + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' }, { document: GetGardenCommunitiesDocument, get rawSDL() { return printWithCache(GetGardenCommunitiesDocument); }, location: 'GetGardenCommunitiesDocument.graphql', - sha256Hash: '21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa' + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' }, { document: GetCommunityDocument, get rawSDL() { return printWithCache(GetCommunityDocument); }, location: 'GetCommunityDocument.graphql', - sha256Hash: '21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa' + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' }, { document: GetCommunityCreationDataDocument, get rawSDL() { return printWithCache(GetCommunityCreationDataDocument); }, location: 'GetCommunityCreationDataDocument.graphql', - sha256Hash: '21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa' + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' }, { document: GetPoolDataDocument, get rawSDL() { return printWithCache(GetPoolDataDocument); }, location: 'GetPoolDataDocument.graphql', - sha256Hash: '21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa' + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' }, { document: GetProposalDataDocument, get rawSDL() { return printWithCache(GetProposalDataDocument); }, location: 'GetProposalDataDocument.graphql', - sha256Hash: '21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa' + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' }, { document: GetAlloDocument, get rawSDL() { return printWithCache(GetAlloDocument); }, location: 'GetAlloDocument.graphql', - sha256Hash: '21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa' + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' }, { document: GetStrategyByPoolDocument, get rawSDL() { return printWithCache(GetStrategyByPoolDocument); }, location: 'GetStrategyByPoolDocument.graphql', - sha256Hash: '21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa' + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' }, { document: GetTokenTitleDocument, get rawSDL() { return printWithCache(GetTokenTitleDocument); }, location: 'GetTokenTitleDocument.graphql', - sha256Hash: '21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa' + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' }, { document: GetCommunityTitlesDocument, get rawSDL() { return printWithCache(GetCommunityTitlesDocument); }, location: 'GetCommunityTitlesDocument.graphql', - sha256Hash: '21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa' + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' }, { document: GetPoolTitlesDocument, get rawSDL() { return printWithCache(GetPoolTitlesDocument); }, location: 'GetPoolTitlesDocument.graphql', - sha256Hash: '21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa' + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' }, { document: GetProposalTitlesDocument, get rawSDL() { return printWithCache(GetProposalTitlesDocument); }, location: 'GetProposalTitlesDocument.graphql', - sha256Hash: '21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa' + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' }, { document: GetPassportScorerDocument, get rawSDL() { return printWithCache(GetPassportScorerDocument); }, location: 'GetPassportScorerDocument.graphql', - sha256Hash: '21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa' + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' }, { document: GetPassportStrategyDocument, get rawSDL() { return printWithCache(GetPassportStrategyDocument); }, location: 'GetPassportStrategyDocument.graphql', - sha256Hash: '21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa' + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' }, { document: GetPassportUserDocument, get rawSDL() { return printWithCache(GetPassportUserDocument); }, location: 'GetPassportUserDocument.graphql', - sha256Hash: '21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa' + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' }, { document: GetProposalDisputesDocument, get rawSDL() { return printWithCache(GetProposalDisputesDocument); }, location: 'GetProposalDisputesDocument.graphql', - sha256Hash: '21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa' + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' }, { document: GetArbitrableConfigsDocument, get rawSDL() { return printWithCache(GetArbitrableConfigsDocument); }, location: 'GetArbitrableConfigsDocument.graphql', - sha256Hash: '21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa' + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' }, { document: GetMemberPassportAndCommunitiesDocument, get rawSDL() { return printWithCache(GetMemberPassportAndCommunitiesDocument); }, location: 'GetMemberPassportAndCommunitiesDocument.graphql', - sha256Hash: '21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa' + sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' } ]; }, @@ -469,6 +477,20 @@ export const getPoolCreationDataDocument = gql ` } } `; +export const getProposalSupportersDocument = gql ` + query getProposalSupporters($proposalId: String!) { + members { + id + stakes(where: {proposal: $proposalId}) { + amount + proposal { + proposalNumber + id + } + } + } +} + `; export const getGardenCommunitiesDocument = gql ` query getGardenCommunities($chainId: BigInt!, $tokenGarden: ID!) { registryCommunities(where: {chainId: $chainId, garden_: {id: $tokenGarden}}) { @@ -904,6 +926,9 @@ export function getSdk(requester) { getPoolCreationData(variables, options) { return requester(getPoolCreationDataDocument, variables, options); }, + getProposalSupporters(variables, options) { + return requester(getProposalSupportersDocument, variables, options); + }, getGardenCommunities(variables, options) { return requester(getGardenCommunitiesDocument, variables, options); }, diff --git a/pkg/subgraph/.graphclient/persisted_operations.json b/pkg/subgraph/.graphclient/persisted_operations.json index e889d047..a3aefcf9 100644 --- a/pkg/subgraph/.graphclient/persisted_operations.json +++ b/pkg/subgraph/.graphclient/persisted_operations.json @@ -1,3 +1,3 @@ { - "21229f9d4b89789bd890d0c0bb2110cff569de8fcc57bc021b4610c3e7397bfa": "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) {\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 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 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}" + "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": "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!) {\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) {\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 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 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/.graphclient/schema.graphql b/pkg/subgraph/.graphclient/schema.graphql index d11a1a59..5bc26dc6 100644 --- a/pkg/subgraph/.graphclient/schema.graphql +++ b/pkg/subgraph/.graphclient/schema.graphql @@ -223,6 +223,7 @@ enum ArbitrableConfig_orderBy { strategy__totalEffectiveActivePoints strategy__isEnabled strategy__token + strategy__archived arbitrator tribunalSafe challengerCollateralAmount @@ -534,6 +535,7 @@ enum CVProposal_orderBy { strategy__totalEffectiveActivePoints strategy__isEnabled strategy__token + strategy__archived beneficiary requestedAmount requestedToken @@ -571,6 +573,7 @@ type CVStrategy { isEnabled: Boolean! token: String! sybilScorer: PassportScorer + archived: Boolean! } type CVStrategyConfig { @@ -684,6 +687,7 @@ enum CVStrategyConfig_orderBy { strategy__totalEffectiveActivePoints strategy__isEnabled strategy__token + strategy__archived D decay maxRatio @@ -851,6 +855,10 @@ input CVStrategy_filter { sybilScorer_not_ends_with: String sybilScorer_not_ends_with_nocase: String sybilScorer_: PassportScorer_filter + archived: Boolean + archived_not: Boolean + archived_in: [Boolean!] + archived_not_in: [Boolean!] """Filter for the block changed event.""" _change_block: BlockChangedFilter and: [CVStrategy_filter] @@ -897,6 +905,7 @@ enum CVStrategy_orderBy { token sybilScorer sybilScorer__id + archived } type CollateralVault { @@ -1064,6 +1073,7 @@ enum CollateralVault_orderBy { strategy__totalEffectiveActivePoints strategy__isEnabled strategy__token + strategy__archived collaterals } @@ -1319,6 +1329,7 @@ enum MemberStrategy_orderBy { strategy__totalEffectiveActivePoints strategy__isEnabled strategy__token + strategy__archived totalStakedPoints activatedPoints } @@ -1492,6 +1503,7 @@ enum PassportStrategy_orderBy { strategy__totalEffectiveActivePoints strategy__isEnabled strategy__token + strategy__archived threshold councilSafe active diff --git a/pkg/subgraph/.graphclient/sources/gv2/introspectionSchema.js b/pkg/subgraph/.graphclient/sources/gv2/introspectionSchema.js index 41c8f66d..55e45310 100644 --- a/pkg/subgraph/.graphclient/sources/gv2/introspectionSchema.js +++ b/pkg/subgraph/.graphclient/sources/gv2/introspectionSchema.js @@ -3134,6 +3134,14 @@ const schemaAST = { }, "directives": [] }, + { + "kind": "EnumValueDefinition", + "name": { + "kind": "Name", + "value": "strategy__archived" + }, + "directives": [] + }, { "kind": "EnumValueDefinition", "name": { @@ -7688,6 +7696,14 @@ const schemaAST = { }, "directives": [] }, + { + "kind": "EnumValueDefinition", + "name": { + "kind": "Name", + "value": "strategy__archived" + }, + "directives": [] + }, { "kind": "EnumValueDefinition", "name": { @@ -8283,6 +8299,25 @@ const schemaAST = { } }, "directives": [] + }, + { + "kind": "FieldDefinition", + "name": { + "kind": "Name", + "value": "archived" + }, + "arguments": [], + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "Boolean" + } + } + }, + "directives": [] } ], "interfaces": [], @@ -9990,6 +10025,14 @@ const schemaAST = { }, "directives": [] }, + { + "kind": "EnumValueDefinition", + "name": { + "kind": "Name", + "value": "strategy__archived" + }, + "directives": [] + }, { "kind": "EnumValueDefinition", "name": { @@ -12565,6 +12608,78 @@ const schemaAST = { }, "directives": [] }, + { + "kind": "InputValueDefinition", + "name": { + "kind": "Name", + "value": "archived" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "Boolean" + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "name": { + "kind": "Name", + "value": "archived_not" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "Boolean" + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "name": { + "kind": "Name", + "value": "archived_in" + }, + "type": { + "kind": "ListType", + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "Boolean" + } + } + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "name": { + "kind": "Name", + "value": "archived_not_in" + }, + "type": { + "kind": "ListType", + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "Boolean" + } + } + } + }, + "directives": [] + }, { "kind": "InputValueDefinition", "description": { @@ -12942,6 +13057,14 @@ const schemaAST = { "value": "sybilScorer__id" }, "directives": [] + }, + { + "kind": "EnumValueDefinition", + "name": { + "kind": "Name", + "value": "archived" + }, + "directives": [] } ], "directives": [] @@ -15344,6 +15467,14 @@ const schemaAST = { }, "directives": [] }, + { + "kind": "EnumValueDefinition", + "name": { + "kind": "Name", + "value": "strategy__archived" + }, + "directives": [] + }, { "kind": "EnumValueDefinition", "name": { @@ -18946,6 +19077,14 @@ const schemaAST = { }, "directives": [] }, + { + "kind": "EnumValueDefinition", + "name": { + "kind": "Name", + "value": "strategy__archived" + }, + "directives": [] + }, { "kind": "EnumValueDefinition", "name": { @@ -21358,6 +21497,14 @@ const schemaAST = { }, "directives": [] }, + { + "kind": "EnumValueDefinition", + "name": { + "kind": "Name", + "value": "strategy__archived" + }, + "directives": [] + }, { "kind": "EnumValueDefinition", "name": { diff --git a/pkg/subgraph/.graphclient/sources/gv2/schema.graphql b/pkg/subgraph/.graphclient/sources/gv2/schema.graphql index d11a1a59..5bc26dc6 100644 --- a/pkg/subgraph/.graphclient/sources/gv2/schema.graphql +++ b/pkg/subgraph/.graphclient/sources/gv2/schema.graphql @@ -223,6 +223,7 @@ enum ArbitrableConfig_orderBy { strategy__totalEffectiveActivePoints strategy__isEnabled strategy__token + strategy__archived arbitrator tribunalSafe challengerCollateralAmount @@ -534,6 +535,7 @@ enum CVProposal_orderBy { strategy__totalEffectiveActivePoints strategy__isEnabled strategy__token + strategy__archived beneficiary requestedAmount requestedToken @@ -571,6 +573,7 @@ type CVStrategy { isEnabled: Boolean! token: String! sybilScorer: PassportScorer + archived: Boolean! } type CVStrategyConfig { @@ -684,6 +687,7 @@ enum CVStrategyConfig_orderBy { strategy__totalEffectiveActivePoints strategy__isEnabled strategy__token + strategy__archived D decay maxRatio @@ -851,6 +855,10 @@ input CVStrategy_filter { sybilScorer_not_ends_with: String sybilScorer_not_ends_with_nocase: String sybilScorer_: PassportScorer_filter + archived: Boolean + archived_not: Boolean + archived_in: [Boolean!] + archived_not_in: [Boolean!] """Filter for the block changed event.""" _change_block: BlockChangedFilter and: [CVStrategy_filter] @@ -897,6 +905,7 @@ enum CVStrategy_orderBy { token sybilScorer sybilScorer__id + archived } type CollateralVault { @@ -1064,6 +1073,7 @@ enum CollateralVault_orderBy { strategy__totalEffectiveActivePoints strategy__isEnabled strategy__token + strategy__archived collaterals } @@ -1319,6 +1329,7 @@ enum MemberStrategy_orderBy { strategy__totalEffectiveActivePoints strategy__isEnabled strategy__token + strategy__archived totalStakedPoints activatedPoints } @@ -1492,6 +1503,7 @@ enum PassportStrategy_orderBy { strategy__totalEffectiveActivePoints strategy__isEnabled strategy__token + strategy__archived threshold councilSafe active diff --git a/pkg/subgraph/.graphclient/sources/gv2/types.ts b/pkg/subgraph/.graphclient/sources/gv2/types.ts index eede775d..5b9396f4 100644 --- a/pkg/subgraph/.graphclient/sources/gv2/types.ts +++ b/pkg/subgraph/.graphclient/sources/gv2/types.ts @@ -230,6 +230,7 @@ export type ArbitrableConfig_orderBy = | 'strategy__totalEffectiveActivePoints' | 'strategy__isEnabled' | 'strategy__token' + | 'strategy__archived' | 'arbitrator' | 'tribunalSafe' | 'challengerCollateralAmount' @@ -534,6 +535,7 @@ export type CVProposal_orderBy = | 'strategy__totalEffectiveActivePoints' | 'strategy__isEnabled' | 'strategy__token' + | 'strategy__archived' | 'beneficiary' | 'requestedAmount' | 'requestedToken' @@ -570,6 +572,7 @@ export type CVStrategy = { isEnabled: Scalars['Boolean']['output']; token: Scalars['String']['output']; sybilScorer?: Maybe; + archived: Scalars['Boolean']['output']; }; @@ -701,6 +704,7 @@ export type CVStrategyConfig_orderBy = | 'strategy__totalEffectiveActivePoints' | 'strategy__isEnabled' | 'strategy__token' + | 'strategy__archived' | 'D' | 'decay' | 'maxRatio' @@ -867,6 +871,10 @@ export type CVStrategy_filter = { sybilScorer_not_ends_with?: InputMaybe; sybilScorer_not_ends_with_nocase?: InputMaybe; sybilScorer_?: InputMaybe; + archived?: InputMaybe; + archived_not?: InputMaybe; + archived_in?: InputMaybe>; + archived_not_in?: InputMaybe>; /** Filter for the block changed event. */ _change_block?: InputMaybe; and?: InputMaybe>>; @@ -912,7 +920,8 @@ export type CVStrategy_orderBy = | 'isEnabled' | 'token' | 'sybilScorer' - | 'sybilScorer__id'; + | 'sybilScorer__id' + | 'archived'; export type CollateralVault = { id: Scalars['ID']['output']; @@ -1087,6 +1096,7 @@ export type CollateralVault_orderBy = | 'strategy__totalEffectiveActivePoints' | 'strategy__isEnabled' | 'strategy__token' + | 'strategy__archived' | 'collaterals'; export type Member = { @@ -1352,6 +1362,7 @@ export type MemberStrategy_orderBy = | 'strategy__totalEffectiveActivePoints' | 'strategy__isEnabled' | 'strategy__token' + | 'strategy__archived' | 'totalStakedPoints' | 'activatedPoints'; @@ -1539,6 +1550,7 @@ export type PassportStrategy_orderBy = | 'strategy__totalEffectiveActivePoints' | 'strategy__isEnabled' | 'strategy__token' + | 'strategy__archived' | 'threshold' | 'councilSafe' | 'active'; diff --git a/pkg/subgraph/.graphclientrc.template.yml b/pkg/subgraph/.graphclientrc.template.yml index 2454baab..bec00dc8 100644 --- a/pkg/subgraph/.graphclientrc.template.yml +++ b/pkg/subgraph/.graphclientrc.template.yml @@ -2,6 +2,6 @@ sources: - name: gv2 handler: graphql: - endpoint: https://api.studio.thegraph.com/query/40931/gardens-v2---arbitrum-sepolia/{{VERSION_TESTNET}} + endpoint: https://api.studio.thegraph.com/query/70985/gardens-v2---arbitrum-sepolia/version/latest documents: - ./src/query/queries.graphql diff --git a/pkg/subgraph/.graphclientrc.yml b/pkg/subgraph/.graphclientrc.yml index e4710594..bec00dc8 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/40931/gardens-v2---arbitrum-sepolia/0.2.0 + endpoint: https://api.studio.thegraph.com/query/70985/gardens-v2---arbitrum-sepolia/version/latest documents: - ./src/query/queries.graphql diff --git a/pkg/subgraph/src/query/queries.graphql b/pkg/subgraph/src/query/queries.graphql index 4db39a23..5534ca10 100644 --- a/pkg/subgraph/src/query/queries.graphql +++ b/pkg/subgraph/src/query/queries.graphql @@ -142,6 +142,19 @@ query getPoolCreationData($communityAddr: ID!, $tokenAddr: ID!) { } } +query getProposalSupporters($proposalId: String!) { + members { + id + stakes(where: { proposal: $proposalId }) { + amount + proposal { + proposalNumber + id + } + } + } +} + query getGardenCommunities($chainId: BigInt!, $tokenGarden: ID!) { registryCommunities( where: { chainId: $chainId, garden_: { id: $tokenGarden } } From a58560582b30d778d19fb916e3f1b8f859042b3c Mon Sep 17 00:00:00 2001 From: Matias Date: Sat, 7 Dec 2024 18:41:31 -0300 Subject: [PATCH 2/9] add filtered data --- .../[poolId]/[proposalId]/page.tsx | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 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 405a5595..611306d8 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 @@ -102,6 +102,27 @@ export default function Page({ const proposalData = data?.cvproposal; const proposalSupporters = supportersData?.members; + + const filteredAndSortedProposalSupporters = + proposalSupporters ? + proposalSupporters + .filter((item) => item.stakes && item.stakes.length > 0) + .sort((a, b) => { + const maxStakeA = Math.max( + ...(a.stakes ?? []).map((stake) => stake.amount), + ); + const maxStakeB = Math.max( + ...(b.stakes ?? []).map((stake) => stake.amount), + ); + return maxStakeB - maxStakeA; + }) + : []; + const stakedAmount = proposalData?.stakedAmount; + const totalEffectiveActivePoints = + proposalData?.strategy?.totalEffectiveActivePoints; + + // + const proposalIdNumber = proposalData?.proposalNumber ? BigInt(proposalData.proposalNumber) @@ -120,8 +141,6 @@ export default function Page({ const isProposerConnected = proposalData?.submitter === address?.toLowerCase(); - console.log(proposalSupporters); - const proposalType = proposalData?.strategy.config?.proposalType; const isSignalingType = PoolTypes[proposalType] === "signaling"; const requestedAmount = proposalData?.requestedAmount; @@ -347,7 +366,7 @@ export default function Page({ onReadyToExecute={triggerConvictionRefetch} defaultChartMaxValue /> -
+
{status === "active" && !isSignalingType && (
- -
- {status === "active" && !isSignalingType && ( - - )} +
+ +
+ {status === "active" && !isSignalingType && ( + + )} +
} + {filteredAndSortedProposalSupporters.length > 0 && ( + + )} +
+ ); +} + +export function ProposalSupportersTable({ + _proposalSupporters, + _totalActivePoints, +}: { + _proposalSupporters: ProposalSupporter[]; + _totalActivePoints?: number; +}) { + return ( +
+
+
+

Supported By

+

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

+
+
+
+
+
+ + + + + + + + + + + {_proposalSupporters.map((supporter: ProposalSupporter) => ( + + + + + + + ))} + +
+
Supporter address
+
+
% pool weigth allocated
+
+
Role
+
+
+
+

{supporter.id}

+
+
+
+

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

{" "} +
+

role

+
+
+
+
); } From bd172497882f73b3744838bdec7459529c66d5e0 Mon Sep 17 00:00:00 2001 From: Matias Date: Mon, 9 Dec 2024 14:57:23 -0300 Subject: [PATCH 4/9] feat: add role info in `ProposalSupportersTable` + add total support info + pullish table ui styles --- .../[poolId]/[proposalId]/page.tsx | 65 ++++++++++++++----- 1 file changed, 47 insertions(+), 18 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 f1281972..4a7c6087 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 @@ -123,7 +123,6 @@ export default function Page({ return maxStakeB - maxStakeA; }) : []; - const stakedAmount = proposalData?.stakedAmount; const totalEffectiveActivePoints = proposalData?.strategy?.totalEffectiveActivePoints; @@ -265,7 +264,6 @@ export default function Page({ }; const status = ProposalStatus[proposalData.proposalStatus]; - return (
)}
@@ -417,50 +418,67 @@ export default function Page({ export function ProposalSupportersTable({ _proposalSupporters, _totalActivePoints, + _totalStakedAmount, + _beneficiary, + _submitter, }: { _proposalSupporters: ProposalSupporter[]; _totalActivePoints?: number; + _totalStakedAmount?: number; + _beneficiary?: string; + _submitter?: string; }) { return (

Supported By

-

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

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

- +
- - - + - + {_proposalSupporters.map((supporter: ProposalSupporter) => ( - - + {/* members support */} + - - ))} + + + + + + +
Supporter address
-
% pool weigth allocated
-
+
Role
+
Support
+
+

{supporter.id}

-

+ {/* members role */} +

+

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

+
+

{(_totalActivePoints ?? 0) > 0 ? calculatePercentageBigInt( BigInt(supporter?.stakes[0]?.amount), @@ -470,13 +488,24 @@ export function ProposalSupportersTable({ %

{" "}
-

role

-
+

Total Support:

+
+

{_totalStakedAmount} %

+
From 7970af4f1b99296a03d4955008c13e04a02568dd Mon Sep 17 00:00:00 2001 From: Matias Date: Mon, 9 Dec 2024 15:30:18 -0300 Subject: [PATCH 5/9] small fix --- .../[chain]/[garden]/[community]/[poolId]/[proposalId]/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 4a7c6087..803fce3e 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 @@ -415,7 +415,7 @@ export default function Page({ ); } -export function ProposalSupportersTable({ +function ProposalSupportersTable({ _proposalSupporters, _totalActivePoints, _totalStakedAmount, From 67c651ca2b72070221b9a28257c94bcf9f56797d Mon Sep 17 00:00:00 2001 From: Matias Date: Tue, 10 Dec 2024 15:39:47 -0300 Subject: [PATCH 6/9] upgrade `ProposalSupporters` --- .../[poolId]/[proposalId]/page.tsx | 43 +++++++++++++++---- 1 file changed, 35 insertions(+), 8 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 803fce3e..e7857fd4 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 @@ -9,7 +9,7 @@ import { import { usePathname, useRouter } from "next/navigation"; import { toast } from "react-toastify"; import { Address, encodeAbiParameters, formatUnits } from "viem"; -import { useAccount, useToken } from "wagmi"; +import { useAccount, useContractRead, useToken } from "wagmi"; import { getProposalDataDocument, getProposalDataQuery, @@ -39,7 +39,7 @@ import { useConvictionRead } from "@/hooks/useConvictionRead"; import { ConditionObject, useDisableButtons } from "@/hooks/useDisableButtons"; import { useMetadataIpfsFetch } from "@/hooks/useIpfsFetch"; import { useSubgraphQuery } from "@/hooks/useSubgraphQuery"; -import { alloABI } from "@/src/generated"; +import { alloABI, safeABI } from "@/src/generated"; import { PoolTypes, ProposalStatus } from "@/types"; import { useErrorDetails } from "@/utils/getErrorName"; @@ -153,6 +153,18 @@ export default function Page({ const submitter = proposalData?.submitter as Address | undefined; const proposalStatus = ProposalStatus[proposalData?.proposalStatus]; + const { data: isCouncilMember } = useContractRead({ + address: proposalData?.strategy?.id as Address, + abi: safeABI, + functionName: "isOwner", + chainId: Number(chainId), + enabled: !!address, + args: [address as Address], + onError: () => { + console.error("Error reading isOwner from Coucil Safe"); + }, + }); + const { data: poolToken } = useToken({ address: poolTokenAddr, enabled: !!poolTokenAddr && !isSignalingType, @@ -235,6 +247,7 @@ export default function Page({ router.push(newPath + `?${QUERY_PARAMS.poolPage.allocationView}=true`); }; const distributeErrorName = useErrorDetails(errorDistribute); + useEffect(() => { if (isErrorDistribute && distributeErrorName.errorName !== undefined) { toast.error("NOT EXECUTABLE:" + " " + distributeErrorName.errorName); @@ -409,6 +422,7 @@ export default function Page({ _totalStakedAmount={totalSupportPct} _beneficiary={beneficiary} _submitter={submitter} + _isCouncilMember={isCouncilMember} /> )}
@@ -421,12 +435,14 @@ function ProposalSupportersTable({ _totalStakedAmount, _beneficiary, _submitter, + _isCouncilMember, }: { _proposalSupporters: ProposalSupporter[]; - _totalActivePoints?: number; - _totalStakedAmount?: number; - _beneficiary?: string; - _submitter?: string; + _totalActivePoints: number; + _totalStakedAmount: number; + _beneficiary: string | undefined; + _submitter: string | undefined; + _isCouncilMember: boolean | undefined; }) { return (
@@ -446,7 +462,11 @@ function ProposalSupportersTable({ -
Supporter address
+
+ {_proposalSupporters.length > 1 ? + "Supporters" + : "Supporter"} +
Role
@@ -462,7 +482,12 @@ function ProposalSupportersTable({
-

{supporter.id}

+
@@ -473,6 +498,8 @@ function ProposalSupportersTable({ "Beneficiary" : supporter.id === _submitter ? "Submitter" + : _isCouncilMember ? + "Council Member" : "Member"}

From 2c73a08d59226950f679461c26c1ce4e33b929ee Mon Sep 17 00:00:00 2001 From: Matias Date: Tue, 10 Dec 2024 17:25:26 -0300 Subject: [PATCH 7/9] feat: update proposalData query to add council safe addres --- .../[poolId]/[proposalId]/page.tsx | 2 +- pkg/subgraph/.graphclient/index.d.ts | 3 + pkg/subgraph/.graphclient/index.js | 101 +++++++++--------- .../.graphclient/persisted_operations.json | 2 +- pkg/subgraph/src/query/queries.graphql | 5 +- pkg/subgraph/subgraph.yaml | 22 ++-- 6 files changed, 72 insertions(+), 63 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 e7857fd4..a2322f89 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 @@ -154,7 +154,7 @@ export default function Page({ const proposalStatus = ProposalStatus[proposalData?.proposalStatus]; const { data: isCouncilMember } = useContractRead({ - address: proposalData?.strategy?.id as Address, + address: data?.registryCommunity?.councilSafe as Address, abi: safeABI, functionName: "isOwner", chainId: Number(chainId), diff --git a/pkg/subgraph/.graphclient/index.d.ts b/pkg/subgraph/.graphclient/index.d.ts index 5b963934..00a3ebd3 100644 --- a/pkg/subgraph/.graphclient/index.d.ts +++ b/pkg/subgraph/.graphclient/index.d.ts @@ -3550,6 +3550,7 @@ export declare function getBuiltGraphSDK, options?: TOperationContext): Promise; getAllo(variables?: Exact<{ [key: string]: never; @@ -3728,10 +3729,12 @@ export type getPoolDataQuery = { export type getProposalDataQueryVariables = Exact<{ garden: Scalars['ID']['input']; proposalId: Scalars['ID']['input']; + communityId: Scalars['ID']['input']; }>; export type getProposalDataQuery = { allos: Array>; tokenGarden?: Maybe>; + registryCommunity?: Maybe>; cvproposal?: Maybe<(Pick & { metadata?: Maybe>; strategy: (Pick & { diff --git a/pkg/subgraph/.graphclient/index.js b/pkg/subgraph/.graphclient/index.js index 847d0e65..a8c977d5 100644 --- a/pkg/subgraph/.graphclient/index.js +++ b/pkg/subgraph/.graphclient/index.js @@ -71,30 +71,30 @@ export async function getMeshOptions() { store: rootStore.child('bareMerger') }); const documentHashMap = { - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetFactoriesDocument, - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetTokenGardensDocument, - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetMemberStrategyDocument, - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": IsMemberDocument, - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetMemberDocument, - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetPoolCreationDataDocument, - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetProposalSupportersDocument, - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetGardenCommunitiesDocument, - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetCommunityDocument, - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetCommunityCreationDataDocument, - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetPoolDataDocument, - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetProposalDataDocument, - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetAlloDocument, - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetStrategyByPoolDocument, - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetTokenTitleDocument, - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetCommunityTitlesDocument, - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetPoolTitlesDocument, - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetProposalTitlesDocument, - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetPassportScorerDocument, - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetPassportStrategyDocument, - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetPassportUserDocument, - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetProposalDisputesDocument, - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetArbitrableConfigsDocument, - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": GetMemberPassportAndCommunitiesDocument + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": GetFactoriesDocument, + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": GetTokenGardensDocument, + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": GetMemberStrategyDocument, + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": IsMemberDocument, + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": GetMemberDocument, + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": GetPoolCreationDataDocument, + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": GetProposalSupportersDocument, + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": GetGardenCommunitiesDocument, + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": GetCommunityDocument, + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": GetCommunityCreationDataDocument, + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": GetPoolDataDocument, + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": GetProposalDataDocument, + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": GetAlloDocument, + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": GetStrategyByPoolDocument, + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": GetTokenTitleDocument, + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": GetCommunityTitlesDocument, + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": GetPoolTitlesDocument, + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": GetProposalTitlesDocument, + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": GetPassportScorerDocument, + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": GetPassportStrategyDocument, + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": GetPassportUserDocument, + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": GetProposalDisputesDocument, + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": GetArbitrableConfigsDocument, + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": GetMemberPassportAndCommunitiesDocument }; additionalEnvelopPlugins.push(usePersistedOperations({ getPersistedOperation(key) { @@ -120,168 +120,168 @@ export async function getMeshOptions() { return printWithCache(GetFactoriesDocument); }, location: 'GetFactoriesDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' }, { document: GetTokenGardensDocument, get rawSDL() { return printWithCache(GetTokenGardensDocument); }, location: 'GetTokenGardensDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' }, { document: GetMemberStrategyDocument, get rawSDL() { return printWithCache(GetMemberStrategyDocument); }, location: 'GetMemberStrategyDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' }, { document: IsMemberDocument, get rawSDL() { return printWithCache(IsMemberDocument); }, location: 'IsMemberDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' }, { document: GetMemberDocument, get rawSDL() { return printWithCache(GetMemberDocument); }, location: 'GetMemberDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' }, { document: GetPoolCreationDataDocument, get rawSDL() { return printWithCache(GetPoolCreationDataDocument); }, location: 'GetPoolCreationDataDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' }, { document: GetProposalSupportersDocument, get rawSDL() { return printWithCache(GetProposalSupportersDocument); }, location: 'GetProposalSupportersDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' }, { document: GetGardenCommunitiesDocument, get rawSDL() { return printWithCache(GetGardenCommunitiesDocument); }, location: 'GetGardenCommunitiesDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' }, { document: GetCommunityDocument, get rawSDL() { return printWithCache(GetCommunityDocument); }, location: 'GetCommunityDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' }, { document: GetCommunityCreationDataDocument, get rawSDL() { return printWithCache(GetCommunityCreationDataDocument); }, location: 'GetCommunityCreationDataDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' }, { document: GetPoolDataDocument, get rawSDL() { return printWithCache(GetPoolDataDocument); }, location: 'GetPoolDataDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' }, { document: GetProposalDataDocument, get rawSDL() { return printWithCache(GetProposalDataDocument); }, location: 'GetProposalDataDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' }, { document: GetAlloDocument, get rawSDL() { return printWithCache(GetAlloDocument); }, location: 'GetAlloDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' }, { document: GetStrategyByPoolDocument, get rawSDL() { return printWithCache(GetStrategyByPoolDocument); }, location: 'GetStrategyByPoolDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' }, { document: GetTokenTitleDocument, get rawSDL() { return printWithCache(GetTokenTitleDocument); }, location: 'GetTokenTitleDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' }, { document: GetCommunityTitlesDocument, get rawSDL() { return printWithCache(GetCommunityTitlesDocument); }, location: 'GetCommunityTitlesDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' }, { document: GetPoolTitlesDocument, get rawSDL() { return printWithCache(GetPoolTitlesDocument); }, location: 'GetPoolTitlesDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' }, { document: GetProposalTitlesDocument, get rawSDL() { return printWithCache(GetProposalTitlesDocument); }, location: 'GetProposalTitlesDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' }, { document: GetPassportScorerDocument, get rawSDL() { return printWithCache(GetPassportScorerDocument); }, location: 'GetPassportScorerDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' }, { document: GetPassportStrategyDocument, get rawSDL() { return printWithCache(GetPassportStrategyDocument); }, location: 'GetPassportStrategyDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' }, { document: GetPassportUserDocument, get rawSDL() { return printWithCache(GetPassportUserDocument); }, location: 'GetPassportUserDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' }, { document: GetProposalDisputesDocument, get rawSDL() { return printWithCache(GetProposalDisputesDocument); }, location: 'GetProposalDisputesDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' }, { document: GetArbitrableConfigsDocument, get rawSDL() { return printWithCache(GetArbitrableConfigsDocument); }, location: 'GetArbitrableConfigsDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' }, { document: GetMemberPassportAndCommunitiesDocument, get rawSDL() { return printWithCache(GetMemberPassportAndCommunitiesDocument); }, location: 'GetMemberPassportAndCommunitiesDocument.graphql', - sha256Hash: '24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17' + sha256Hash: '5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13' } ]; }, @@ -659,7 +659,7 @@ export const getPoolDataDocument = gql ` } `; export const getProposalDataDocument = gql ` - query getProposalData($garden: ID!, $proposalId: ID!) { + query getProposalData($garden: ID!, $proposalId: ID!, $communityId: ID!) { allos { id chainId @@ -670,6 +670,9 @@ export const getProposalDataDocument = gql ` symbol decimals } + registryCommunity(id: $communityId) { + councilSafe + } cvproposal(id: $proposalId) { id proposalNumber diff --git a/pkg/subgraph/.graphclient/persisted_operations.json b/pkg/subgraph/.graphclient/persisted_operations.json index a3aefcf9..88bcf09d 100644 --- a/pkg/subgraph/.graphclient/persisted_operations.json +++ b/pkg/subgraph/.graphclient/persisted_operations.json @@ -1,3 +1,3 @@ { - "24f71bab6ccaea5916d9dea004777cf32433d854d97da2dd9fac3c2711997b17": "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!) {\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) {\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 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 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}" + "5739cc90895079ffe8a7220e506401b416e739046aa067ebf3a8bc262a134c13": "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!) {\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) {\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 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 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/src/query/queries.graphql b/pkg/subgraph/src/query/queries.graphql index 5534ca10..701f3b21 100644 --- a/pkg/subgraph/src/query/queries.graphql +++ b/pkg/subgraph/src/query/queries.graphql @@ -320,7 +320,7 @@ query getPoolData($garden: ID!, $poolId: BigInt!) { } } -query getProposalData($garden: ID!, $proposalId: ID!) { +query getProposalData($garden: ID!, $proposalId: ID!, $communityId: ID!) { allos { id chainId @@ -331,6 +331,9 @@ query getProposalData($garden: ID!, $proposalId: ID!) { symbol decimals } + registryCommunity(id: $communityId) { + councilSafe + } cvproposal(id: $proposalId) { id proposalNumber diff --git a/pkg/subgraph/subgraph.yaml b/pkg/subgraph/subgraph.yaml index a26cd30b..5d54395b 100644 --- a/pkg/subgraph/subgraph.yaml +++ b/pkg/subgraph/subgraph.yaml @@ -6,15 +6,15 @@ schema: dataSources: - kind: ethereum/contract name: RegistryFactoryV0_0 - network: arbitrum-sepolia + network: localhost context: chainId: type: Int - data: 421614 + data: 1337 source: - address: "0x2689b1e4afcbfb393d9727fba2ab52930035ee85" + address: "0xb7f8bc63bbcad18155201308c8f3540b07f84f5e" abi: RegistryFactoryV0_0 - startBlock: 95965509 + startBlock: 0 mapping: kind: ethereum/events apiVersion: 0.0.7 @@ -40,15 +40,15 @@ dataSources: - kind: ethereum/contract name: PassportScorer - network: arbitrum-sepolia + network: localhost context: chainId: type: Int - data: 421614 + data: 1337 source: - address: "0x2053E225672776deb23Af0A3EBa9CE2c87838a72" + address: "0x0165878a594ca255338adfa4d48449f69242eb8f" abi: PassportScorer - startBlock: 95965509 + startBlock: 0 mapping: kind: ethereum/events apiVersion: 0.0.7 @@ -78,7 +78,7 @@ dataSources: templates: - kind: ethereum/contract name: RegistryCommunityV0_0 - network: arbitrum-sepolia + network: localhost source: abi: RegistryCommunityV0_0 mapping: @@ -150,7 +150,7 @@ templates: - kind: ethereum/contract name: CVStrategyV0_0 - network: arbitrum-sepolia + network: localhost source: abi: CVStrategyV0_0 mapping: @@ -209,7 +209,7 @@ templates: - kind: ethereum/contract name: CollateralVault - network: arbitrum-sepolia + network: localhost source: abi: CollateralVault mapping: From 6c1e56d713d7b5e6a48be4ebed7485846b913ad1 Mon Sep 17 00:00:00 2001 From: Matias Date: Tue, 10 Dec 2024 17:46:13 -0300 Subject: [PATCH 8/9] add variable to query --- .../[chain]/[garden]/[community]/[poolId]/[proposalId]/page.tsx | 1 + 1 file changed, 1 insertion(+) 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 a2322f89..995ba6a6 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 @@ -73,6 +73,7 @@ export default function Page({ variables: { garden: garden.toLowerCase(), proposalId: proposalId.toLowerCase(), + communityId: communityAddr.toLowerCase(), }, changeScope: { topic: "proposal", From f55544e422b3f8bf7fce9a428d71e99de8328803 Mon Sep 17 00:00:00 2001 From: Matias Date: Wed, 11 Dec 2024 13:47:32 -0300 Subject: [PATCH 9/9] remove coucill safe is member logic for `ProposalSupportersTable` --- .../[poolId]/[proposalId]/page.tsx | 19 +------------------ 1 file changed, 1 insertion(+), 18 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 995ba6a6..3e314d1f 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 @@ -9,7 +9,7 @@ import { import { usePathname, useRouter } from "next/navigation"; import { toast } from "react-toastify"; import { Address, encodeAbiParameters, formatUnits } from "viem"; -import { useAccount, useContractRead, useToken } from "wagmi"; +import { useAccount, useToken } from "wagmi"; import { getProposalDataDocument, getProposalDataQuery, @@ -154,18 +154,6 @@ export default function Page({ const submitter = proposalData?.submitter as Address | undefined; const proposalStatus = ProposalStatus[proposalData?.proposalStatus]; - const { data: isCouncilMember } = useContractRead({ - address: data?.registryCommunity?.councilSafe as Address, - abi: safeABI, - functionName: "isOwner", - chainId: Number(chainId), - enabled: !!address, - args: [address as Address], - onError: () => { - console.error("Error reading isOwner from Coucil Safe"); - }, - }); - const { data: poolToken } = useToken({ address: poolTokenAddr, enabled: !!poolTokenAddr && !isSignalingType, @@ -423,7 +411,6 @@ export default function Page({ _totalStakedAmount={totalSupportPct} _beneficiary={beneficiary} _submitter={submitter} - _isCouncilMember={isCouncilMember} /> )}
@@ -436,14 +423,12 @@ function ProposalSupportersTable({ _totalStakedAmount, _beneficiary, _submitter, - _isCouncilMember, }: { _proposalSupporters: ProposalSupporter[]; _totalActivePoints: number; _totalStakedAmount: number; _beneficiary: string | undefined; _submitter: string | undefined; - _isCouncilMember: boolean | undefined; }) { return (
@@ -499,8 +484,6 @@ function ProposalSupportersTable({ "Beneficiary" : supporter.id === _submitter ? "Submitter" - : _isCouncilMember ? - "Council Member" : "Member"}