Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F/subgraph #3

Merged
merged 11 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions packages/contracts/src/architecture.md

This file was deleted.

58 changes: 0 additions & 58 deletions packages/contracts/test/utils/types.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/contracts/test/vocdoni-voting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@ describe('Vocdoni Plugin', function () {
[signers[0].address], // signers[0] is listed
vocdoniVotingSettings
);

await expect(
vocdoniVoting
.connect(signers[2]) // not listed
Expand Down
11 changes: 0 additions & 11 deletions packages/js-client/src/internal/graphql-queries/example.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/js-client/src/internal/graphql-queries/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// add your grapql queries here and export them with this file
export * from './settings';
export * from './proposal';
export * from './token';
137 changes: 50 additions & 87 deletions packages/js-client/src/internal/graphql-queries/proposal.ts
Original file line number Diff line number Diff line change
@@ -1,77 +1,54 @@
import { gql } from 'graphql-request';

export const QueryTokenVotingProposal = gql`
query TokenVotingProposal($proposalId: ID!) {
tokenVotingProposal(id: $proposalId) {
export const QueryPluginProposal = gql`
query PluginProposal($proposalId: ID!) {
pluginProposals(id: $proposalId) {
id
dao {
id
subdomain
}
creator
metadata
createdAt
creationBlockNumber
executionDate
executionBlockNumber
actions {
to
id
value
data
}
yes
no
abstain
votingMode
supportThreshold
allowFailureMap
failureMap
pluginProposalId
vochainProposalId
creator
startDate
createdAt
voteEndDate
tallyEndDate
creationBlockNumber
snapshotBlock
executed
earlyExecutable
potentiallyExecutable
executionDate
executionBlockNumber
executionTxHash
voters {
voter {
address
}
voteReplaced
voteOption
votingPower
approvers {
id
}
plugin {
token {
id
name
symbol
__typename
... on ERC20Contract {
decimals
}
... on ERC20WrapperContract {
decimals
underlyingToken {
id
name
symbol
decimals
}
}
}
tally {
id
values
}
totalVotingPower
minVotingPower
tallyApproved
}
}
`;
export const QueryTokenVotingProposals = gql`
query TokenVotingProposals(
$where: TokenVotingProposal_filter!

export const QueryPluginProposals = gql`
query QueryPluginProposals(
$where: PluginProposal_filter!
$limit: Int!
$skip: Int!
$direction: OrderDirection!
$sortBy: TokenVotingProposal_orderBy!
$sortBy: TPluginProposal_orderBy!
) {
tokenVotingProposals(
pluginProposals(
where: $where
first: $limit
skip: $skip
Expand All @@ -81,50 +58,36 @@ export const QueryTokenVotingProposals = gql`
id
dao {
id
subdomain
}
creator
metadata
yes
no
abstain
actions {
id
value
data
}
allowFailureMap
failureMap
pluginProposalId
vochainProposalId
creator
startDate
createdAt
voteEndDate
tallyEndDate
creationBlockNumber
snapshotBlock
executed
earlyExecutable
potentiallyExecutable
votingMode
supportThreshold
minVotingPower
totalVotingPower
voters {
voter {
address
}
voteReplaced
voteOption
votingPower
executionDate
executionBlockNumber
executionTxHash
approvers {
id
}
plugin {
token {
id
name
symbol
__typename
... on ERC20Contract {
decimals
}
... on ERC20WrapperContract {
decimals
underlyingToken {
id
name
symbol
decimals
}
}
}
tally {
id
values
}
tallyApproved
}
}
`;
19 changes: 19 additions & 0 deletions packages/js-client/src/internal/graphql-queries/settings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { gql } from 'graphql-request';

export const QueryPluginSettings = gql`
query PluginSettings($address: ID!, $block: Block_height) {
plugin(id: $address, block: $block) {
id
onlyExecutionMultisigProposalCreation
minTallyApprovals
minParticipation
supportThreshold
minVoteDuration
minTallyDuration
daoTokenAddress
censusStrategyURI
minProposerVotingPower
executionMultisigMembers
}
}
`;
26 changes: 0 additions & 26 deletions packages/js-client/src/internal/graphql-queries/token.ts

This file was deleted.

16 changes: 13 additions & 3 deletions packages/subgraph/manifest/subgraph.placeholder.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{info}}
specVersion: 0.0.2
specVersion: 0.0.5
description: A template for Plugin subgraphs
repository: https://github.com/aragon/osx-plugin-subgraph
schema:
Expand All @@ -16,7 +16,7 @@ dataSources:
startBlock: {{startBlock}}
mapping:
kind: ethereum/events
apiVersion: 0.0.5
apiVersion: 0.0.7
language: wasm/assemblyscript
entities:
- PluginInstallation
Expand Down Expand Up @@ -52,17 +52,27 @@ templates:
abi: VocdoniVoting
mapping:
kind: ethereum/events
apiVersion: 0.0.5
apiVersion: 0.0.7
language: wasm/assemblyscript
entities:
- Plugin
abis:
- name: VocdoniVoting
file: $PLUGIN_MODULE/artifacts/src/VocdoniVoting.sol/VocdoniVoting.json
eventHandlers:
- event: PluginSettingsUpdated(bool,indexed uint16,uint32,uint32,uint64,uint64,indexed address,indexed string,uint256)
handler: handlePluginSettingsUpdated
- event: ProposalCreated(indexed uint256,indexed bytes32,indexed address,uint64,uint64,uint64,(address,uint256,bytes)[],uint256)
handler: handleProposalCreated
- event: ProposalExecuted(indexed uint256)
handler: handleProposalExecuted
- event: ExecutionMultisigMembersAdded(address[])
handler: handleExecutionMultisigMembersAdded
- event: ExecutionMultisigMembersRemoved(address[])
handler: handleExecutionMultisigMembersRemoved
- event: TallySet(indexed uint256,uint256[][])
handler: handleTallySet
- event: TallyApproval(indexed uint256,indexed address)
handler: handleTallyApproval
file: ./src/plugin/plugin.ts

Loading
Loading