Skip to content

Commit

Permalink
Merge pull request #439 from privacy-scaling-explorations/fix/subgrap…
Browse files Browse the repository at this point in the history
…h-tally-template

fix(subgraph): create template for tally to start parsing events
  • Loading branch information
0xmad authored Nov 5, 2024
2 parents 605b6f8 + f6390c3 commit 95d0f95
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/subgraph/src/maci.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Address, BigInt as GraphBN } from "@graphprotocol/graph-ts";

import { DeployPoll as DeployPollEvent, SignUp as SignUpEvent, MACI as MaciContract } from "../generated/MACI/MACI";
import { Poll } from "../generated/schema";
import { Poll as PollTemplate } from "../generated/templates";
import { Poll as PollTemplate, Tally as TallyTemplate } from "../generated/templates";
import { Poll as PollContract } from "../generated/templates/Poll/Poll";

import { ONE_BIG_INT, MESSAGE_TREE_ARITY } from "./utils/constants";
Expand Down Expand Up @@ -49,6 +49,9 @@ export function handleDeployPoll(event: DeployPollEvent): void {
PollTemplate.create(Address.fromBytes(poll.id));

createOrLoadTally(contracts.tally, poll.id);

// Start indexing the tally
TallyTemplate.create(Address.fromBytes(contracts.tally));
}

export function handleSignUp(event: SignUpEvent): void {
Expand Down
3 changes: 3 additions & 0 deletions packages/subgraph/templates/subgraph.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ templates:
language: wasm/assemblyscript
entities:
- Tally
- TallyResult
- Claim
- Deposit
abis:
- name: Tally
file: ./abi/Tally.json
Expand Down

0 comments on commit 95d0f95

Please sign in to comment.